@jossuealcala/madre 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.en.md +40 -1
- package/CHANGELOG.md +40 -1
- package/README.en.md +3 -3
- package/README.md +3 -3
- package/SECURITY.md +11 -6
- package/TRADEMARKS.md +6 -2
- package/bin/madre.mjs +76 -11
- package/docs/REFERENCE.md +16 -10
- package/docs/SDK.md +36 -9
- package/docs/en/REFERENCE.md +12 -8
- package/docs/en/SDK.md +34 -8
- package/docs/en/training/README.md +1 -1
- package/docs/sdk/connector-module.mjs +1 -1
- package/docs/sdk/hello-module.mjs +39 -4
- package/docs/training/README.md +1 -1
- package/docs/training/train.sh +3 -0
- package/habilidades/explicamelo-facil/HABILIDAD.md +19 -0
- package/habilidades/hojas-de-calculo/HABILIDAD.md +18 -0
- package/habilidades/mensajes-a-clientes/HABILIDAD.md +19 -0
- package/habilidades/publicaciones-para-redes/HABILIDAD.md +19 -0
- package/habilidades/resumen-y-pendientes/HABILIDAD.md +18 -0
- package/habilidades/tu-pagina-paso-a-paso/HABILIDAD.md +19 -0
- package/package.json +7 -4
- package/public/activity.js +66 -22
- package/public/app.js +4947 -894
- package/public/assets/brand/OFL-SpaceGrotesk.txt +93 -0
- package/public/assets/brand/SpaceGrotesk-latin-ext.woff2 +0 -0
- package/public/assets/brand/SpaceGrotesk-latin.woff2 +0 -0
- package/public/assets/brand/madre-app-180.png +0 -0
- package/public/assets/brand/madre-app-192.png +0 -0
- package/public/assets/brand/madre-app-512.png +0 -0
- package/public/assets/brand/madre-app.svg +1 -1
- package/public/assets/brand/madre-favicon.svg +1 -1
- package/public/attribution.js +29 -19
- package/public/auto-open.js +102 -0
- package/public/brands.js +36 -19
- package/public/changes.js +63 -0
- package/public/en.js +1085 -102
- package/public/es.js +2940 -1656
- package/public/i18n.js +11 -0
- package/public/index.html +31 -27
- package/public/loader.js +322 -117
- package/public/macroverso.js +57 -355
- package/public/manual-content.js +69 -9
- package/public/manual.js +21 -6
- package/public/market-view.js +298 -84
- package/public/market.js +25 -2
- package/public/mcp-catalog.js +7 -2
- package/public/missions.js +169 -0
- package/public/news-scenes.js +292 -0
- package/public/nostromo-engine.js +935 -654
- package/public/notices.js +78 -0
- package/public/notifications.js +119 -0
- package/public/power.js +1 -1
- package/public/provider-marks.js +170 -0
- package/public/provider-pick.js +147 -0
- package/public/resay.js +4 -0
- package/public/review-ask.js +16 -13
- package/public/routing.js +29 -3
- package/public/salas-mac.css +467 -47
- package/public/salas-mac.html +8 -5
- package/public/salas-mac.js +805 -109
- package/public/salas.css +2 -2
- package/public/salas.html +2 -2
- package/public/salas.js +1 -1
- package/public/starters.js +128 -0
- package/public/styles.css +3036 -340
- package/public/subscription.js +303 -0
- package/public/terms-field.js +170 -0
- package/public/terms.js +117 -19
- package/public/tips.js +158 -0
- package/public/tour-chapters.js +88 -88
- package/public/tour.js +364 -46
- package/public/troubleshooting.js +313 -27
- package/public/welcome-scene.js +446 -0
- package/public/welcome.js +827 -282
- package/src/adapters/claude.mjs +2 -1
- package/src/adapters/codex.mjs +2 -1
- package/src/adapters/cursor.mjs +9 -6
- package/src/adapters/gemini-rest.mjs +236 -0
- package/src/adapters/gemini.mjs +13 -7
- package/src/adapters/grok.mjs +290 -0
- package/src/adapters/madre.mjs +71 -23
- package/src/adapters/opencode.mjs +15 -2
- package/src/adapters/process.mjs +14 -3
- package/src/adapters/steps.mjs +176 -0
- package/src/app-invite.mjs +90 -0
- package/src/auth-probe.mjs +32 -0
- package/src/billing-key.mjs +8 -0
- package/src/billing.mjs +317 -0
- package/src/bridge/policy.mjs +1 -1
- package/src/capabilities.mjs +46 -10
- package/src/chats.mjs +44 -2
- package/src/checkpoint.mjs +119 -1
- package/src/codex-route.mjs +113 -0
- package/src/commands.mjs +5 -2
- package/src/credentials.mjs +46 -8
- package/src/dataset.mjs +18 -7
- package/src/directives.mjs +1 -0
- package/src/event-store.mjs +25 -2
- package/src/extensions.mjs +5 -1
- package/src/ficha.mjs +158 -0
- package/src/files.mjs +36 -2
- package/src/image-studio.mjs +13 -3
- package/src/install-metrics.mjs +9 -3
- package/src/lease.mjs +6 -1
- package/src/looks.mjs +4 -1
- package/src/market-check.mjs +1 -1
- package/src/market-remote.mjs +135 -1
- package/src/mcp/image-server.mjs +59 -90
- package/src/mcp/memory-server.mjs +10 -0
- package/src/memory-tools.mjs +3 -0
- package/src/memory.mjs +29 -4
- package/src/models.mjs +21 -3
- package/src/modules/ahp.mjs +10 -4
- package/src/modules/bishop-exam.mjs +41 -12
- package/src/modules/bishop.mjs +2 -2
- package/src/modules/choices.mjs +12 -10
- package/src/modules/fetch-alone.mjs +7 -0
- package/src/modules/github.mjs +6 -2
- package/src/modules/helpers.mjs +23 -5
- package/src/modules/image-providers.mjs +281 -0
- package/src/modules/image-studio.mjs +106 -39
- package/src/modules/index.mjs +61 -12
- package/src/modules/intents-observe.mjs +3 -1
- package/src/modules/isolated.mjs +160 -0
- package/src/modules/ollama.mjs +35 -6
- package/src/modules/playwright.mjs +78 -20
- package/src/modules/reminders.mjs +42 -2
- package/src/modules/ripley.mjs +2 -1
- package/src/modules/run-alone.mjs +122 -0
- package/src/modules/runs.mjs +11 -8
- package/src/modules/sdk.mjs +10 -3
- package/src/notices-key.mjs +8 -0
- package/src/notices.mjs +185 -0
- package/src/ollama.mjs +57 -15
- package/src/opencode-health.mjs +1 -1
- package/src/outbound.mjs +124 -13
- package/src/quota-sources.mjs +148 -3
- package/src/review-ask.mjs +55 -31
- package/src/room/archivist.mjs +30 -5
- package/src/room/busy.mjs +16 -0
- package/src/room/changes.mjs +79 -0
- package/src/room/control.mjs +36 -6
- package/src/room/economy.mjs +1 -1
- package/src/room/guard.mjs +39 -2
- package/src/room/prompt.mjs +49 -6
- package/src/room/vectors.mjs +7 -1
- package/src/room.mjs +181 -49
- package/src/router.mjs +1 -1
- package/src/runs.mjs +39 -0
- package/src/runtime-detection.mjs +46 -6
- package/src/salas.mjs +181 -18
- package/src/server.mjs +1101 -118
- package/src/service.mjs +116 -0
- package/src/setup-trouble.mjs +20 -1
- package/src/setup.mjs +1 -1
- package/src/skill-check.mjs +269 -0
- package/src/skills-import.mjs +128 -0
- package/src/skills.mjs +502 -0
- package/src/terms.mjs +23 -5
- package/src/tour.mjs +31 -5
- package/src/updates.mjs +47 -4
- package/src/web-preview.mjs +181 -0
- package/src/whats-new.mjs +121 -1
- package/src/rumbo.mjs +0 -337
package/public/salas-mac.js
CHANGED
|
@@ -7,9 +7,12 @@
|
|
|
7
7
|
//
|
|
8
8
|
// The phone has its own SALAS (salas.js), served by the bridge; the two read the same rooms.
|
|
9
9
|
|
|
10
|
-
import { browserLanguage, sessionDetail, setLanguage, t } from './i18n.js';
|
|
10
|
+
import { browserLanguage, dateWords, sessionDetail, setLanguage, t } from './i18n.js';
|
|
11
11
|
import { brandOf, monogram } from './brands.js';
|
|
12
|
-
import {
|
|
12
|
+
import { installTips } from './tips.js';
|
|
13
|
+
import { startReviewAsk } from './review-ask.js';
|
|
14
|
+
import { mountNotices } from './notices.js';
|
|
15
|
+
import { drawSubscription, mountSubscription, subscriptionLine, subscriptionShown } from './subscription.js';
|
|
13
16
|
import { startTour } from './tour.js';
|
|
14
17
|
import { dropStickyHover } from './touch.js';
|
|
15
18
|
import { AUTHOR, AUTHOR_URL, YEAR, drawAttribution, drawColophonKeys, drawLegal } from './attribution.js';
|
|
@@ -26,9 +29,12 @@ import { openWelcome, welcomeOpen, WELCOME_STEPS } from './welcome.js';
|
|
|
26
29
|
import { remedyKey } from './remedy.js';
|
|
27
30
|
import { loadMarket } from './market.js';
|
|
28
31
|
import { trazo, trazoDrawing } from './icons.js';
|
|
32
|
+
import { providerPick } from './provider-pick.js';
|
|
33
|
+
import { drawNotifications, notify } from './notifications.js';
|
|
29
34
|
import { tellFailures } from './page-errors.js';
|
|
30
35
|
import { mountActivity } from './activity.js';
|
|
31
36
|
import { ensureTerms } from './terms.js';
|
|
37
|
+
import { createNewsScene } from './news-scenes.js';
|
|
32
38
|
|
|
33
39
|
// Nothing of MADRE starts before its license and privacy notice are accepted on this computer
|
|
34
40
|
// (public/terms.js, src/terms.mjs): the page waits here.
|
|
@@ -75,11 +81,13 @@ let query = ''; // what the search box holds
|
|
|
75
81
|
const busy = new Map(); // room id → 'starting' | 'closing'
|
|
76
82
|
const asking = new Set(); // room ids whose card asks before closing
|
|
77
83
|
const forgetting = new Set(); // room ids whose card asks before leaving MADRE
|
|
84
|
+
const renaming = new Set(); // room ids whose card is having its name written (2026-11-13)
|
|
78
85
|
const failed = new Map(); // room id → what went wrong, said on its card
|
|
79
86
|
// One is one: «1 conversaciones» read wrong on every new project's card.
|
|
80
87
|
const conversationsCount = (n) => (n === 1 ? t('1 conversation') : t('{n} conversations', { n }));
|
|
81
88
|
const memoriesCount = (n) => (n === 1 ? t('1 memory') : t('{n} memories', { n }));
|
|
82
89
|
const revoking = new Set(); // link ids whose row asks before revoking
|
|
90
|
+
const linksOpen = new Set(); // link ids unfolded in the list (2026-11-07: folded by default)
|
|
83
91
|
|
|
84
92
|
// The room's looks, from this browser: the same keys the room's own page keeps (app.js, LOOKS),
|
|
85
93
|
// so a choice made here is the room's too when the room is served at this address.
|
|
@@ -160,6 +168,8 @@ function applyLooks() {
|
|
|
160
168
|
// The person's picture as this browser last knew it, before the first look is painted.
|
|
161
169
|
paintCustomWall(rememberedWall());
|
|
162
170
|
applyLooks();
|
|
171
|
+
// One small solid label for every key that explains itself (public/tips.js).
|
|
172
|
+
installTips();
|
|
163
173
|
function saveLooks({ theme, accent, wallpaper, style, bubbles, text }) {
|
|
164
174
|
// The first value of each look is the room as it always was, kept as no choice at all (app.js, saveLook).
|
|
165
175
|
const keep = (key, value, first) => { if (value === first) localStorage.removeItem(key); else localStorage.setItem(key, value); };
|
|
@@ -276,6 +286,15 @@ const el = (tag, className, text) => {
|
|
|
276
286
|
|
|
277
287
|
// The same small words as the phone's SALAS (salas.js).
|
|
278
288
|
const chatName = (title) => (title === 'First conversation' ? t('First conversation') : title === 'Untitled' ? t('Untitled') : title === 'Coordinator' ? t('Coordinator') : title);
|
|
289
|
+
// A title made from the first message is cut at 80 characters (src/chats.mjs, CHAT_TITLE_MAX), often
|
|
290
|
+
// inside a word («…y un botón. Explíc»): Home says it was cut, at the last whole word, and the whole
|
|
291
|
+
// title shows on the pointer, as a project's bar does (app.js, paintShellTitle; 2026-11-17).
|
|
292
|
+
function chatNameNode(tag, title) {
|
|
293
|
+
const whole = chatName(title);
|
|
294
|
+
const node = el(tag, null, whole.length >= 80 ? `${whole.replace(/\s+\S*$/, '').replace(/[\s.,;:·-]+$/, '')}…` : whole);
|
|
295
|
+
if (node.textContent !== whole) node.title = whole;
|
|
296
|
+
return node;
|
|
297
|
+
}
|
|
279
298
|
function ago(iso) {
|
|
280
299
|
const at = Date.parse(iso ?? '');
|
|
281
300
|
if (!Number.isFinite(at)) return '';
|
|
@@ -289,7 +308,7 @@ function ago(iso) {
|
|
|
289
308
|
return new Date(at).toLocaleDateString(language, { day: 'numeric', month: 'short' });
|
|
290
309
|
}
|
|
291
310
|
// The modes as the room names them (app.js, MODES): asked when shown, so the language is the page's.
|
|
292
|
-
const modeName = (n) => [t('
|
|
311
|
+
const modeName = (n) => [t('Not saved'), t('Just chat'), t('Can create'), t('Can edit'), t('Full access')][n] ?? '';
|
|
293
312
|
function askLine(ask) {
|
|
294
313
|
if (ask.kind === 'mode') return t('@{agent} asks for #{n} {label}', { agent: ask.agent, n: ask.mode, label: modeName(ask.mode) });
|
|
295
314
|
if (ask.kind === 'run') return ask.text ? t('@{agent} wants to run {line}', { agent: ask.agent, line: ask.text }) : t('@{agent} wants to run a command', { agent: ask.agent });
|
|
@@ -393,7 +412,8 @@ function card(room) {
|
|
|
393
412
|
node.addEventListener('contextmenu', (event) => pinsMenu(event, room));
|
|
394
413
|
|
|
395
414
|
const head = el('header', 'sm-card-head');
|
|
396
|
-
head.append(
|
|
415
|
+
if (renaming.has(room.id)) head.append(renameField(room));
|
|
416
|
+
else head.append(el('h3', null, room.name));
|
|
397
417
|
if (room.here) head.append(el('span', 'sm-chip here', t('You are here')));
|
|
398
418
|
else if (room.open) head.append(el('span', 'sm-chip port', `:${room.open.port}`));
|
|
399
419
|
// What the right-click offers, for whoever does not right-click: a key of its own.
|
|
@@ -421,7 +441,7 @@ function card(room) {
|
|
|
421
441
|
}
|
|
422
442
|
if (glance.chat && !glance.outdated) {
|
|
423
443
|
const chat = el('div', 'sm-chat');
|
|
424
|
-
chat.append(
|
|
444
|
+
chat.append(chatNameNode('b', glance.chat.title));
|
|
425
445
|
if (glance.chat.preview) chat.append(el('span', null, glance.chat.preview));
|
|
426
446
|
node.append(chat);
|
|
427
447
|
}
|
|
@@ -640,7 +660,7 @@ function drawWaiting() {
|
|
|
640
660
|
ui.waiting.count.textContent = String(total);
|
|
641
661
|
ui.waiting.box.classList.toggle('has', Boolean(total));
|
|
642
662
|
ui.waiting.body.replaceChildren();
|
|
643
|
-
if (!total) { ui.waiting.body.append(el('p', 'sm-hint', t('All caught up. When an
|
|
663
|
+
if (!total) { ui.waiting.body.append(el('p', 'sm-hint', t('All caught up. When an AI asks you something, it shows up here.'))); return; }
|
|
644
664
|
for (const room of rooms.slice(0, 2)) {
|
|
645
665
|
const row = el('a', 'sm-waiting-row');
|
|
646
666
|
row.href = addressOf(room);
|
|
@@ -673,7 +693,7 @@ function drawMemory() {
|
|
|
673
693
|
const item = el('span', `k-${kind}`, `${kindWord(kind)} · ${sum.kinds[kind]}`);
|
|
674
694
|
legend.append(item);
|
|
675
695
|
}
|
|
676
|
-
ui.memory.body.append(legend, el('p', 'sm-hint', [sum.memories ? t('{n} in use', { n: sum.travelling }) : null, t('
|
|
696
|
+
ui.memory.body.append(legend, el('p', 'sm-hint', [sum.memories ? t('{n} in use', { n: sum.travelling }) : null, t('From the projects that are open.')].filter(Boolean).join(' · ')));
|
|
677
697
|
}
|
|
678
698
|
|
|
679
699
|
// AGENTS: the ones on this computer, with the session each has. Connected once, every project
|
|
@@ -704,6 +724,8 @@ async function loadVersion() {
|
|
|
704
724
|
if (answer.available && answer.latest && versionAnnounced !== answer.latest) {
|
|
705
725
|
versionAnnounced = answer.latest;
|
|
706
726
|
toast(t('MADRE {version} is out. Update it from the bar.', { version: answer.latest }), 'look');
|
|
727
|
+
// Through the system too, once per version, if the person lets it (notifications.js, «A new version»).
|
|
728
|
+
notify('updates', t('A new version of MADRE'), t('MADRE {version} is out. Update it from Home.', { version: answer.latest }), { once: `version-${answer.latest}` });
|
|
707
729
|
}
|
|
708
730
|
drawAttention();
|
|
709
731
|
drawTopbar();
|
|
@@ -769,6 +791,9 @@ async function loadReminders({ opening = false } = {}) {
|
|
|
769
791
|
remindersSeen = answer.reminders ?? [];
|
|
770
792
|
if (answer.prefs) reminderPrefs = answer.prefs;
|
|
771
793
|
const due = remindersSeen.filter((one) => Date.parse(one.due) <= Date.now());
|
|
794
|
+
// At its hour, through the system, once per reminder and hour (2026-11-10): Reminders' own
|
|
795
|
+
// permission (`notifies`), handed out by MADRE, never by the module (notifications.js).
|
|
796
|
+
for (const one of due) notify('module:reminders', t('Reminder'), one.text, { tag: `reminder-${one.id}`, once: `reminder-${one.id}-${one.due}` });
|
|
772
797
|
// Said when MADRE opens, once: the reminders themselves stay in «Needs you» until settled.
|
|
773
798
|
if (opening && due.length) toast(due.length === 1 ? t('A reminder is due: {what}', { what: due[0].text }) : t('{n} reminders are due. They are in «Needs you».', { n: due.length }), 'done');
|
|
774
799
|
drawAttention();
|
|
@@ -829,7 +854,7 @@ function drawAttention() {
|
|
|
829
854
|
if (!items.length) {
|
|
830
855
|
const calm = el('li', 'sm-attention-item is-calm');
|
|
831
856
|
const words = el('div', 'sm-attention-words');
|
|
832
|
-
words.append(el('b', null, t('All in order.')), el('span', null, t('
|
|
857
|
+
words.append(el('b', null, t('All in order.')), el('span', null, t('Nothing needs you right now.')));
|
|
833
858
|
calm.append(el('i', 'dot'), words);
|
|
834
859
|
ui.attention.list.append(calm);
|
|
835
860
|
return;
|
|
@@ -923,7 +948,7 @@ function drawWork() {
|
|
|
923
948
|
for (const one of (work.sources ?? []).slice(0, 5)) {
|
|
924
949
|
const item = el('li', 'raw');
|
|
925
950
|
const words = el('span');
|
|
926
|
-
words.append(
|
|
951
|
+
words.append(chatNameNode('b', one.title));
|
|
927
952
|
if (one.last?.text) words.append(document.createTextNode(` — ${one.last.text}`));
|
|
928
953
|
item.append(roomTag(one.room, one.name), words, el('time', null, ago(one.at)));
|
|
929
954
|
w.list.append(item);
|
|
@@ -968,21 +993,33 @@ const LINK_ARROW = '<svg viewBox="0 0 60 16" aria-hidden="true"><path d="M58 8H6
|
|
|
968
993
|
const LINK_BOTH = '<svg viewBox="0 0 60 16" aria-hidden="true"><path d="M6 8h48M12 2.5 6 8l6 5.5M48 2.5 54 8l-6 5.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
969
994
|
function linkRow(enlace) {
|
|
970
995
|
const { source, reader } = endsOf(enlace);
|
|
971
|
-
|
|
996
|
+
// Folded by default (2026-11-07): one even row per connection — the pair centred, its kind and its
|
|
997
|
+
// readings under it — so a person with many finds theirs without scrolling; it unfolds in place.
|
|
998
|
+
const node = el('details', `sm-link${revoking.has(enlace.id) ? ' revoking' : ''}`);
|
|
972
999
|
node.dataset.link = enlace.id;
|
|
973
|
-
node.
|
|
1000
|
+
node.open = linksOpen.has(enlace.id) || revoking.has(enlace.id);
|
|
1001
|
+
node.addEventListener('toggle', () => { if (node.open) linksOpen.add(enlace.id); else linksOpen.delete(enlace.id); });
|
|
1002
|
+
const summary = el('summary', 'sm-link-summary');
|
|
1003
|
+
const body = el('div', 'sm-link-body');
|
|
974
1004
|
// Who looks up whom, as the map draws it.
|
|
975
1005
|
const pair = el('div', 'sm-link-pair');
|
|
976
1006
|
const arrow = el('span', 'sm-link-arrow');
|
|
977
1007
|
arrow.innerHTML = enlace.direction === 'both' ? LINK_BOTH : LINK_ARROW; // trusted: our own SVG strings
|
|
978
1008
|
arrow.append(el('small', null, enlace.direction === 'both' ? t('read each other') : t('looks up')));
|
|
979
|
-
|
|
1009
|
+
const left = LINK_MARK(reader);
|
|
1010
|
+
const right = LINK_MARK(source);
|
|
1011
|
+
left.classList.add('left');
|
|
1012
|
+
right.classList.add('right');
|
|
1013
|
+
pair.append(left, arrow, right);
|
|
980
1014
|
// The drawing says it; the sentence is kept for whoever hears the page.
|
|
981
1015
|
const who = el('span');
|
|
982
1016
|
who.append(enlace.direction === 'both' ? sayTinted('{a} and {b} read each other', { a: enlace.rooms.a, b: enlace.rooms.b }) : sayTinted('{reader} reads from {source}', { reader, source }));
|
|
983
1017
|
pair.setAttribute('role', 'img');
|
|
984
1018
|
pair.setAttribute('aria-label', who.textContent);
|
|
985
|
-
|
|
1019
|
+
summary.append(pair);
|
|
1020
|
+
// In order (2026-11-07): who reads whom, then what crosses, then on what terms, then the switches,
|
|
1021
|
+
// and at the foot how much it was read and the way out. Each part under its own small heading.
|
|
1022
|
+
const section = (title) => { const part = el('div', 'sm-link-part'); part.append(el('span', 'sm-link-part-title', title)); body.append(part); return part; };
|
|
986
1023
|
// What crosses, until when, and whether orders go.
|
|
987
1024
|
const tags = el('div', 'sm-link-tags');
|
|
988
1025
|
for (const kind of enlace.kinds ?? []) {
|
|
@@ -991,15 +1028,24 @@ function linkRow(enlace) {
|
|
|
991
1028
|
tag.append(el('i', `k-${kind}`), word.slice(0, 1).toLocaleUpperCase(language) + word.slice(1));
|
|
992
1029
|
tags.append(tag);
|
|
993
1030
|
}
|
|
994
|
-
|
|
995
|
-
|
|
1031
|
+
section(t('What crosses')).append(tags);
|
|
1032
|
+
const terms = el('div', 'sm-link-tags terms');
|
|
1033
|
+
terms.append(el('span', 'sm-link-tag plain', enlace.expires ? t('until {date}', { date: new Date(enlace.expires).toLocaleDateString(language, { day: 'numeric', month: 'short' }) }) : t('no expiry')));
|
|
1034
|
+
terms.append(el('span', 'sm-link-tag plain', enlace.orders?.allowed ? t('orders up to #{n}', { n: enlace.orders.maxMode }) : t('no orders')));
|
|
996
1035
|
// D-S13: a link BISHOP signed on its own says so, so it is never mistaken for one you signed.
|
|
997
|
-
if (enlace.signed?.by === 'bishop')
|
|
998
|
-
|
|
1036
|
+
if (enlace.signed?.by === 'bishop') terms.append(el('span', 'sm-link-tag plain', t('signed by the Coordinator')));
|
|
1037
|
+
section(t('Terms')).append(terms);
|
|
999
1038
|
const traffic = enlace.traffic ?? {};
|
|
1000
1039
|
// S-021: the last reading says who read, as the room that asked said it.
|
|
1001
1040
|
const last = traffic.lastAt ? (traffic.lastAgent ? t('last by @{agent} of {room}, {when}', { agent: traffic.lastAgent, room: roomName(traffic.lastRoom), when: ago(traffic.lastAt) }) : t('last {when}', { when: ago(traffic.lastAt) })) : t('none yet');
|
|
1002
|
-
|
|
1041
|
+
const trafficLine = el('p', 'traffic', [t('{n} reads in 24 h', { n: traffic.reads24h ?? 0 }), last].join(' · '));
|
|
1042
|
+
// Under the pair, folded: what kind of connection it is and how much it was read.
|
|
1043
|
+
const meta = el('span', 'sm-link-meta');
|
|
1044
|
+
meta.append(el('b', null, source === data.salas || reader === data.salas ? t('With the Coordinator') : t('Between projects')), el('span', null, t('{n} reads in 24 h', { n: traffic.reads24h ?? 0 })));
|
|
1045
|
+
const dots = el('span', 'sm-link-dots');
|
|
1046
|
+
for (const kind of enlace.kinds ?? []) dots.append(el('i', `k-${kind}`));
|
|
1047
|
+
meta.append(dots);
|
|
1048
|
+
summary.append(meta, el('span', 'sm-link-chevron'));
|
|
1003
1049
|
// What else it allows, each a switch that says what it does (Fase 3e, D-S15, D-S16, D-S17).
|
|
1004
1050
|
const options = el('div', 'sm-link-options');
|
|
1005
1051
|
const option = (on, title, says, path, payload) => {
|
|
@@ -1026,11 +1072,14 @@ function linkRow(enlace) {
|
|
|
1026
1072
|
if (reader === data.salas) option(enlace.train, t('The Coordinator learns from it'), t('What the Coordinator reads here also goes into what it is trained with.'), '/api/salas/enlaces/train', (on) => ({ id: enlace.id, train: on }));
|
|
1027
1073
|
option(enlace.state, t('It shares its state'), t('Its goal, phase, next step and what is open can be read too, never its files.'), '/api/salas/enlaces/allow', (on) => ({ id: enlace.id, field: 'state', on }));
|
|
1028
1074
|
option(enlace.deliver, t('It receives delivered notes'), t('Notes can be handed to it; they wait for you to accept them before entering its memory.'), '/api/salas/enlaces/allow', (on) => ({ id: enlace.id, field: 'deliver', on }));
|
|
1029
|
-
|
|
1075
|
+
section(t('What it allows')).append(options);
|
|
1030
1076
|
const actions = el('div', 'sm-actions');
|
|
1031
1077
|
if (revoking.has(enlace.id)) actions.append(el('span', 'sm-ask', t('Nothing crosses from then on.')), button('sm-btn danger small', t('Yes, cancel it'), () => revokeLink(enlace.id)), button('sm-btn ghost small', t('Keep the connection'), () => { revoking.delete(enlace.id); draw(); }));
|
|
1032
1078
|
else actions.append(button('sm-btn ghost small', t('Cancel the connection'), () => { revoking.add(enlace.id); draw(); }));
|
|
1033
|
-
|
|
1079
|
+
const foot = el('div', 'sm-link-foot');
|
|
1080
|
+
foot.append(trafficLine, actions);
|
|
1081
|
+
body.append(foot);
|
|
1082
|
+
node.append(summary, body);
|
|
1034
1083
|
return node;
|
|
1035
1084
|
}
|
|
1036
1085
|
// How a connection works, in three steps under the sheet's title, as the project map says its own
|
|
@@ -1056,7 +1105,7 @@ function drawLinks(projects) {
|
|
|
1056
1105
|
const reads = enlaces.reduce((sum, enlace) => sum + (enlace.traffic?.reads24h ?? 0), 0);
|
|
1057
1106
|
ui.linksSum.textContent = enlaces.length
|
|
1058
1107
|
? [enlaces.length === 1 ? t('1 in force') : t('{n} in force', { n: enlaces.length }), t('{n} reads in 24 h', { n: reads })].join(' · ')
|
|
1059
|
-
: enough ? t('
|
|
1108
|
+
: enough ? t('Connect two projects so one can look things up in the other.') : t('Add a project to connect it.');
|
|
1060
1109
|
ui.linksNote.textContent = t('A connection lets one project look up what another already learned: its decisions, facts and preferences. It only reads, never changes the other project, and you can cancel it whenever you want.');
|
|
1061
1110
|
drawLinkSteps();
|
|
1062
1111
|
ui.links.replaceChildren(...enlaces.map(linkRow));
|
|
@@ -1513,7 +1562,7 @@ const HOME_TILES = {
|
|
|
1513
1562
|
projects: { id: 'sm-drawer', name: () => t('Projects'), about: () => t('Every project, open or asleep, three rows at a time.'), size: 12, sizes: [12], kept: true },
|
|
1514
1563
|
decisions: { id: 'sm-decisions', name: () => t('Recent decisions'), about: () => t('What your projects decided lately.'), size: 4, rows: 3 },
|
|
1515
1564
|
attention: { id: 'sm-attention', name: () => t('Needs you'), about: () => t('What Home noticed that needs a hand.'), size: 4, rows: 3 },
|
|
1516
|
-
memory: { id: 'sm-memory', name: () => t('
|
|
1565
|
+
memory: { id: 'sm-memory', name: () => t('What MADRE remembers'), about: () => t('What your projects remember, by kind.'), size: 4, rows: 3 },
|
|
1517
1566
|
};
|
|
1518
1567
|
const WIDGETS = {
|
|
1519
1568
|
'w-system': { kind: 'system', name: () => t('System resources'), about: () => t('How busy this Mac\'s processor is, and how much memory is free.'), size: 4, rows: 3 },
|
|
@@ -1534,6 +1583,15 @@ const WIDGETS = {
|
|
|
1534
1583
|
// MADRE's course (2026-11-01, src/rumbo.mjs): the variables that decide where the project goes,
|
|
1535
1584
|
// from madre.run's funnel, GitHub and npm. Only in the author's copy run from source.
|
|
1536
1585
|
'w-rumbo': { kind: 'rumbo', owner: true, name: () => t('MADRE\'s course'), about: () => t('The variables that decide where MADRE goes: from a visit to a habit, what the numbers decide, and GitHub and npm. Only you see this.'), size: 12, sizes: [12] },
|
|
1586
|
+
// The author's error log (2026-11-05, src/madre-logs.mjs): ~/madre-logs as agents add and close
|
|
1587
|
+
// errors, read from this Mac's disk every few seconds. Only in the author's copy run from source.
|
|
1588
|
+
'w-madrelogs': { kind: 'madrelogs', owner: true, every: 5000, name: () => 'madre-logs', about: () => t('MADRE\'s errors as they are added and fixed: what is still to fix by class and type, what waits to be verified, and the last changes. Read from this Mac; only you see this.'), size: 8, rows: 8 },
|
|
1589
|
+
// The author's notices (Q-11, src/notices.mjs): written here, signed on this computer, read by every
|
|
1590
|
+
// copy. Only in the author's copy run from source, with the token and the notices' key.
|
|
1591
|
+
'w-notices': { kind: 'notices', owner: true, every: 60000, name: () => t('Notices to every copy'), about: () => t('Write a notice that every copy of MADRE shows, with or without diagnostics: signed on this computer, read from madre.run. Only you see this.'), size: 8, rows: 0 },
|
|
1592
|
+
// The author's switch for MADRE App's subscription (src/billing.mjs, docs/private/SUSCRIPCION.md):
|
|
1593
|
+
// signed on this computer with the notices' key, read by every app the next time it opens.
|
|
1594
|
+
'w-billing': { kind: 'billing', owner: true, every: 60000, name: () => t('MADRE App subscription'), about: () => t('Turn the subscription of MADRE App on or off for every copy of the app: free days first, then the monthly price or the limited mode. Signed on this computer; only you see this.'), size: 4, rows: 0 },
|
|
1537
1595
|
'w-models': { kind: 'models', name: () => t('Local models'), about: () => t('Ollama, its models, and how close each project is to its own.'), size: 4, rows: 3 },
|
|
1538
1596
|
// Your agenda (2026-10-28): every project's reminders by when they are due — late, today, tomorrow,
|
|
1539
1597
|
// this week, later —, each settled here, and a new one written as you would say it. Read from the
|
|
@@ -1566,6 +1624,9 @@ const TILE_ICONS = {
|
|
|
1566
1624
|
'w-installs': trazo('download'),
|
|
1567
1625
|
'w-environments': trazo('globe'),
|
|
1568
1626
|
'w-rumbo': trazo('trending'),
|
|
1627
|
+
'w-madrelogs': trazo('list'),
|
|
1628
|
+
'w-notices': trazo('broadcast'),
|
|
1629
|
+
'w-billing': trazo('star'),
|
|
1569
1630
|
};
|
|
1570
1631
|
const tileIcon = (id) => { const box = el('span', 'sm-tile-icon'); box.innerHTML = TILE_ICONS[id] ?? ''; return box; }; // trusted: our own SVG strings
|
|
1571
1632
|
const known = (id) => Object.hasOwn(HOME_TILES, id) || Object.hasOwn(WIDGETS, id);
|
|
@@ -1923,18 +1984,26 @@ async function openHomeAdd() {
|
|
|
1923
1984
|
sheetNow.show();
|
|
1924
1985
|
framed.raise();
|
|
1925
1986
|
} else sheetNow.showModal();
|
|
1987
|
+
// The window holds the focus, not its ✕ (2026-11-13, the author: «it looks already chosen»): opening
|
|
1988
|
+
// a dialog hands the focus to its first key, and the ✕ was lit red as if pointed at. Tab reaches it.
|
|
1989
|
+
sheetNow.tabIndex = -1;
|
|
1990
|
+
sheetNow.focus({ preventScroll: true });
|
|
1926
1991
|
void homeTour.hint('home-add', list, { inside: true, title: t('Add to Home'), text: t('The tiles you took off and the widgets you can add. A widget shows up only when this Mac has something to put in it. Right-click any tile to move it, change its size or take it off.') });
|
|
1927
1992
|
// The author's widget is asked about before the list is drawn: where it cannot be read, it is not listed at all.
|
|
1993
|
+
// All asked at once (2026-11-10): one after another, the list came in a row at a time.
|
|
1928
1994
|
const ownerOk = new Set();
|
|
1929
|
-
|
|
1995
|
+
await Promise.all(Object.entries(WIDGETS).filter(([id, spec]) => spec.owner && !placed(id)).map(async ([id, spec]) => {
|
|
1930
1996
|
if (await fetch(`/api/salas/widget?kind=${spec.kind}`, { cache: 'no-store' }).then((response) => response.ok).catch(() => false)) ownerOk.add(id);
|
|
1931
|
-
}
|
|
1997
|
+
}));
|
|
1932
1998
|
if (!homeAddSheet) return;
|
|
1933
1999
|
const entries = [
|
|
1934
2000
|
...Object.entries(HOME_TILES).filter(([id]) => !placed(id)).map(([id, spec]) => ({ id, spec, ready: true })),
|
|
1935
2001
|
...Object.entries(WIDGETS).filter(([id, spec]) => !placed(id) && (!spec.owner || ownerOk.has(id))).map(([id, spec]) => ({ id, spec, ready: null })),
|
|
1936
2002
|
];
|
|
1937
2003
|
if (!entries.length) { list.append(el('p', 'sm-hint', t('Everything is already on Home.'))); fit(); return; }
|
|
2004
|
+
// Every row is drawn at once; each widget then says, as soon as its own answer comes, whether
|
|
2005
|
+
// something feeds it.
|
|
2006
|
+
const checks = [];
|
|
1938
2007
|
for (const entry of entries) {
|
|
1939
2008
|
const row = el('div', 'sm-add-row');
|
|
1940
2009
|
row.append(tileIcon(entry.id));
|
|
@@ -1948,19 +2017,22 @@ async function openHomeAdd() {
|
|
|
1948
2017
|
// A widget is offered only when something feeds it: asked of the server, which says so.
|
|
1949
2018
|
if (entry.ready === null) {
|
|
1950
2019
|
add.disabled = true;
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
2020
|
+
checks.push((async () => {
|
|
2021
|
+
// One that reads for itself (the agenda) is ready when it can read: it has a box to start with.
|
|
2022
|
+
const reading = entry.spec.read ? ((await entry.spec.read()) ? { available: true } : { failed: true })
|
|
2023
|
+
: await fetch(`/api/salas/widget?kind=${entry.spec.kind}`, { cache: 'no-store' }).then((response) => (response.ok ? response.json() : { failed: response.status })).catch(() => ({ failed: true }));
|
|
2024
|
+
if (!row.isConnected) return;
|
|
2025
|
+
const ok = Boolean(reading?.available);
|
|
2026
|
+
add.disabled = !ok;
|
|
2027
|
+
// A page served by a project started before widgets existed cannot read them: said as that,
|
|
2028
|
+
// not as a Mac with nothing to show.
|
|
2029
|
+
said.textContent = ok ? '' : reading.failed === 404 ? t('This page is served by a project started before widgets existed: open Home from its own address, or restart that project.') : reading.failed ? t('It could not be read just now.') : (entry.spec.needs?.() ?? t('Nothing feeds it on this Mac yet.'));
|
|
2030
|
+
fit();
|
|
2031
|
+
})());
|
|
1961
2032
|
}
|
|
1962
2033
|
}
|
|
1963
2034
|
fit();
|
|
2035
|
+
await Promise.all(checks);
|
|
1964
2036
|
}
|
|
1965
2037
|
|
|
1966
2038
|
// ---- The widgets. Each is a tile that reads its own route every 20 s while Home is in view.
|
|
@@ -1976,6 +2048,10 @@ function meter(value, tone = null) {
|
|
|
1976
2048
|
const toneFor = (share) => (share >= 0.85 ? 'hot' : share >= 0.6 ? 'warm' : null);
|
|
1977
2049
|
const OS_WORDS = { darwin: 'macOS', linux: 'Linux', win32: 'Windows', other: () => t('other') };
|
|
1978
2050
|
const osWord = (name) => { const word = OS_WORDS[name] ?? name; return typeof word === 'function' ? word() : word; };
|
|
2051
|
+
// What is being written in the notices' widget, kept across its re-readings (it reads every minute).
|
|
2052
|
+
const freshNoticeDraft = () => ({ level: 'info', titleEs: '', titleEn: '', bodyEs: '', bodyEn: '', link: '', min: '', max: '', os: [], days: 7 });
|
|
2053
|
+
const noticeDraft = freshNoticeDraft();
|
|
2054
|
+
const noticeFlash = { text: '' };
|
|
1979
2055
|
const WIDGET_PAINT = {
|
|
1980
2056
|
// The agenda: what is late and what is today first, then tomorrow, this week and later; a line per
|
|
1981
2057
|
// reminder with its project and its keys; and a box for a new one, in the person's own words.
|
|
@@ -2130,7 +2206,7 @@ const WIDGET_PAINT = {
|
|
|
2130
2206
|
const SYSTEMS = { darwin: 'macOS', linux: 'Linux', win32: 'Windows', wsl: 'WSL', other: t('other') };
|
|
2131
2207
|
const CHANNELS = { npx: 'npx', global: t('installed (npm -g)'), project: t('inside a project'), source: t('from source') };
|
|
2132
2208
|
const LANGS = { es: t('Spanish'), en: t('English') };
|
|
2133
|
-
const AGENT_NAMES = { claude: 'Claude', codex: 'Codex', gemini: 'Gemini', opencode: 'OpenCode', cursor: 'Cursor' };
|
|
2209
|
+
const AGENT_NAMES = { claude: 'Claude', codex: 'Codex', gemini: 'Gemini', opencode: 'OpenCode', cursor: 'Cursor', grok: 'Grok' };
|
|
2134
2210
|
const said = (list, words = {}) => (list ?? []).filter((one) => one.name !== '?').slice(0, 5).map((one) => `${words[one.name] ?? one.name} ${share(one.n)}`).join(' · ') || '—';
|
|
2135
2211
|
const lines = el('div', 'sm-usage-lines sm-env-lines');
|
|
2136
2212
|
for (const [label, text] of [
|
|
@@ -2170,6 +2246,118 @@ const WIDGET_PAINT = {
|
|
|
2170
2246
|
// habit with its leak marked, what the numbers decide, every variable with how sure it is, the
|
|
2171
2247
|
// weeks, and the project's record on GitHub and npm. Read again every 20 s; each source keeps its
|
|
2172
2248
|
// own clock on the server.
|
|
2249
|
+
// The author's notices (Q-11): write one for every copy, see how it will read, send it, and take
|
|
2250
|
+
// back one that is out. Only in the author's copy run from source (src/server.mjs, ownerCanNotify).
|
|
2251
|
+
notices(body, reading, { again } = {}) {
|
|
2252
|
+
const d = noticeDraft;
|
|
2253
|
+
const LEVEL_NAMES = { info: () => t('Information'), important: () => t('Important'), security: () => t('Security') };
|
|
2254
|
+
const form = el('form', 'sm-notice-form');
|
|
2255
|
+
const field = (label, node) => { const row = el('label', 'sm-notice-field'); if (!node.matches('div')) node.setAttribute('aria-label', label); row.append(el('small', null, label), node); return row; };
|
|
2256
|
+
const input = (key, max, placeholder = '') => { const node = el('input'); node.type = 'text'; node.maxLength = max; node.value = d[key] ?? ''; node.placeholder = placeholder; node.addEventListener('input', () => { d[key] = node.value; preview(); }); return node; };
|
|
2257
|
+
const area = (key, max) => { const node = el('textarea'); node.maxLength = max; node.rows = 3; node.value = d[key] ?? ''; node.addEventListener('input', () => { d[key] = node.value; preview(); }); return node; };
|
|
2258
|
+
const level = el('select');
|
|
2259
|
+
for (const one of ['info', 'important', 'security']) { const option = el('option', null, LEVEL_NAMES[one]()); option.value = one; option.selected = d.level === one; level.append(option); }
|
|
2260
|
+
level.addEventListener('change', () => { d.level = level.value; preview(); });
|
|
2261
|
+
const days = el('select');
|
|
2262
|
+
for (const n of [1, 3, 7, 14, 30]) { const option = el('option', null, n === 1 ? t('1 day') : t('{n} days', { n })); option.value = String(n); option.selected = d.days === n; days.append(option); }
|
|
2263
|
+
days.addEventListener('change', () => { d.days = Number(days.value); });
|
|
2264
|
+
const systems = el('div', 'sm-notice-systems');
|
|
2265
|
+
for (const [id, name] of [['darwin', 'macOS'], ['linux', 'Linux'], ['win32', 'Windows'], ['wsl', 'WSL']]) {
|
|
2266
|
+
const box = el('input'); box.type = 'checkbox'; box.checked = d.os.includes(id);
|
|
2267
|
+
box.addEventListener('change', () => { d.os = box.checked ? [...new Set([...d.os, id])] : d.os.filter((one) => one !== id); });
|
|
2268
|
+
const label = el('label'); label.append(box, ` ${name}`); systems.append(label);
|
|
2269
|
+
}
|
|
2270
|
+
form.append(
|
|
2271
|
+
field(t('Level'), level),
|
|
2272
|
+
field(t('Title · Spanish'), input('titleEs', 80)), field(t('Title · English'), input('titleEn', 80)),
|
|
2273
|
+
field(t('Text · Spanish'), area('bodyEs', 400)), field(t('Text · English'), area('bodyEn', 400)),
|
|
2274
|
+
field(t('Link (madre.run only, optional)'), input('link', 200, 'https://madre.run/…')),
|
|
2275
|
+
field(t('From version (optional)'), input('min', 12, '1.1.3')), field(t('Up to version (optional)'), input('max', 12)),
|
|
2276
|
+
field(t('Systems (none: all)'), systems), field(t('Shows for'), days),
|
|
2277
|
+
);
|
|
2278
|
+
// How it will read, in both languages, in the same card every copy draws (public/notices.js).
|
|
2279
|
+
const look = el('div', 'sm-notice-preview');
|
|
2280
|
+
function preview() {
|
|
2281
|
+
look.replaceChildren();
|
|
2282
|
+
for (const [lang, title, words] of [['es', d.titleEs, d.bodyEs], ['en', d.titleEn, d.bodyEn]]) {
|
|
2283
|
+
const card = el('section', `madre-notice is-${d.level}`);
|
|
2284
|
+
const box = el('div', 'madre-notice-words');
|
|
2285
|
+
box.append(el('small', 'madre-notice-kind', `${lang.toUpperCase()} · ${LEVEL_NAMES[d.level]()}`), el('b', 'madre-notice-title', title || '—'), el('p', 'madre-notice-body', words || '—'));
|
|
2286
|
+
card.append(box);
|
|
2287
|
+
look.append(card);
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
preview();
|
|
2291
|
+
// Said once, after the widget reads again with what was just sent.
|
|
2292
|
+
const said = el('small', 'sm-notice-said', noticeFlash.text);
|
|
2293
|
+
noticeFlash.text = '';
|
|
2294
|
+
let armed = false;
|
|
2295
|
+
const send = button('sm-btn primary small', t('Send to every copy'), async (event) => {
|
|
2296
|
+
event.preventDefault();
|
|
2297
|
+
if (!armed) { armed = true; send.textContent = t('Sure? It reaches every copy · Send'); setTimeout(() => { armed = false; send.textContent = t('Send to every copy'); }, 5000); return; }
|
|
2298
|
+
send.disabled = true;
|
|
2299
|
+
const now = new Date();
|
|
2300
|
+
const stamp = now.toISOString().slice(0, 10).replaceAll('-', '');
|
|
2301
|
+
const slug = String(d.titleEs || d.titleEn).normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 30) || 'aviso';
|
|
2302
|
+
const notice = {
|
|
2303
|
+
id: `${stamp}-${slug}`.slice(0, 40).replace(/-+$/, ''), level: d.level,
|
|
2304
|
+
title: { es: d.titleEs.trim(), en: d.titleEn.trim() }, body: { es: d.bodyEs.trim(), en: d.bodyEn.trim() },
|
|
2305
|
+
link: d.link.trim() || null, to: { min: d.min.trim() || null, max: d.max.trim() || null, os: d.os },
|
|
2306
|
+
from: now.toISOString(), until: new Date(now.getTime() + d.days * 86_400_000).toISOString(),
|
|
2307
|
+
};
|
|
2308
|
+
const answer = await fetch('/api/owner/notices', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ notice }) }).then(async (response) => ({ ok: response.ok, body: await response.json().catch(() => ({})) })).catch(() => ({ ok: false, body: {} }));
|
|
2309
|
+
if (answer.ok) { Object.assign(noticeDraft, freshNoticeDraft()); noticeFlash.text = t('Sent: every copy shows it within 15 minutes.'); again?.(); }
|
|
2310
|
+
else { said.textContent = answer.body.error ?? t('It was not sent.'); send.disabled = false; }
|
|
2311
|
+
});
|
|
2312
|
+
form.append(look, send, said);
|
|
2313
|
+
// What is out now, with its way back.
|
|
2314
|
+
const out = el('div', 'sm-notice-list');
|
|
2315
|
+
const list = reading.notices ?? [];
|
|
2316
|
+
if (!reading.read) out.append(el('p', 'sm-hint', t('madre.run could not be read just now.')));
|
|
2317
|
+
else if (!list.length) out.append(el('p', 'sm-hint', t('No notice is out.')));
|
|
2318
|
+
for (const one of list) {
|
|
2319
|
+
const row = el('div', `sm-notice-row is-${one.level}`);
|
|
2320
|
+
const when = one.when === 'later' ? t('from {date}', { date: dateWords(one.from) }) : one.when === 'over' ? t('ended') : t('until {date}', { date: dateWords(one.until) });
|
|
2321
|
+
row.append(el('b', null, one.title?.[language] ?? one.title?.es ?? one.id), el('small', null, `${LEVEL_NAMES[one.level]()} · ${when}`));
|
|
2322
|
+
let sure = false;
|
|
2323
|
+
const back = button('sm-btn small', t('Take back'), async () => {
|
|
2324
|
+
if (!sure) { sure = true; back.textContent = t('Sure? Take back'); setTimeout(() => { sure = false; back.textContent = t('Take back'); }, 5000); return; }
|
|
2325
|
+
back.disabled = true;
|
|
2326
|
+
const ok = await fetch('/api/owner/notices/retire', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id: one.id }) }).then((response) => response.ok).catch(() => false);
|
|
2327
|
+
if (ok) again?.(); else { back.disabled = false; back.textContent = t('Take back'); }
|
|
2328
|
+
});
|
|
2329
|
+
row.append(back);
|
|
2330
|
+
out.append(row);
|
|
2331
|
+
}
|
|
2332
|
+
if (reading.unverified) out.append(el('p', 'sm-hint', t('{n} served by madre.run do not carry your signature: no copy shows them.', { n: reading.unverified })));
|
|
2333
|
+
body.append(out, form);
|
|
2334
|
+
},
|
|
2335
|
+
// The author's switch (src/billing.mjs): what madre.run serves now, checked as every app checks it,
|
|
2336
|
+
// and one button that turns it the other way, pressed twice to be sure.
|
|
2337
|
+
billing(body, reading, { again } = {}) {
|
|
2338
|
+
const now = reading.switch;
|
|
2339
|
+
const on = Boolean(now?.on);
|
|
2340
|
+
const lead = el('div', 'sm-usage-lead');
|
|
2341
|
+
lead.append(el('b', 'sm-w-big', on ? t('On') : t('Off')), el('span', null, on
|
|
2342
|
+
? t('since {date} · {days} days free, then {price} a month', { date: dateWords(now.from), days: now.trialDays, price: `$${now.price.mxn}` })
|
|
2343
|
+
: t('No copy of the app shows a price')));
|
|
2344
|
+
body.append(lead);
|
|
2345
|
+
if (!reading.read) body.append(el('p', 'sm-hint', t('madre.run could not be read just now.')));
|
|
2346
|
+
if (reading.unverified) body.append(el('p', 'sm-hint', t('madre.run serves a switch without your signature: no app reads it.')));
|
|
2347
|
+
if (!reading.keyReady) body.append(el('p', 'sm-hint', t('First make the key of the subscription keys: node scripts/billing-key.mjs. Without it nobody could pay.')));
|
|
2348
|
+
const said = el('small', 'sm-notice-said');
|
|
2349
|
+
let sure = false;
|
|
2350
|
+
const label = on ? t('Turn the subscription off') : t('Turn the subscription on');
|
|
2351
|
+
const turn = button(`sm-btn small${on ? '' : ' primary'}`, label, async () => {
|
|
2352
|
+
if (!sure) { sure = true; turn.textContent = on ? t('Sure? Every app goes back to free · Turn off') : t('Sure? Every app starts its free days · Turn on'); setTimeout(() => { sure = false; turn.textContent = label; }, 5000); return; }
|
|
2353
|
+
turn.disabled = true;
|
|
2354
|
+
const answer = await fetch('/api/owner/billing', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ on: !on }) }).then(async (response) => ({ ok: response.ok, body: await response.json().catch(() => ({})) })).catch(() => ({ ok: false, body: {} }));
|
|
2355
|
+
if (answer.ok) again?.();
|
|
2356
|
+
else { said.textContent = answer.body.error ?? t('It was not sent.'); turn.disabled = false; turn.textContent = label; sure = false; }
|
|
2357
|
+
});
|
|
2358
|
+
turn.disabled = !on && !reading.keyReady;
|
|
2359
|
+
body.append(turn, said);
|
|
2360
|
+
},
|
|
2173
2361
|
rumbo(body, reading) {
|
|
2174
2362
|
if (!reading.available) { body.append(el('p', 'sm-hint', reading.status ? t('madre.run answered {status}.', { status: reading.status }) : t('madre.run could not be reached.'))); return; }
|
|
2175
2363
|
const n = (value) => (value === null || value === undefined ? '—' : Number(value).toLocaleString());
|
|
@@ -2503,6 +2691,119 @@ const WIDGET_PAINT = {
|
|
|
2503
2691
|
// What fails in every copy, the widest first (2026-10-28). Each with what it is (its MU code when
|
|
2504
2692
|
// Diagnostics knows it), how many copies and times, which versions and systems, MADRE's own lines
|
|
2505
2693
|
// it went through, and the author's word on it.
|
|
2694
|
+
// madre-logs (2026-11-05): what is to fix, grouped by level (P0 and P1 first), each error in a row
|
|
2695
|
+
// of its own: id and level on the left, what happens and its state, then its class, type and
|
|
2696
|
+
// origin as tags. Then what waits to be verified, folded, and what the agents saved last.
|
|
2697
|
+
madrelogs(body, reading) {
|
|
2698
|
+
const { counts } = reading;
|
|
2699
|
+
const lead = el('div', 'sm-logs-lead');
|
|
2700
|
+
const figure = (n, words, tone) => { const one = el('div', `sm-logs-fig${tone ? ` ${tone}` : ''}`); one.append(el('b', null, String(n)), el('span', null, words)); return one; };
|
|
2701
|
+
lead.append(figure(counts.toFix, t('to fix'), counts.toFix ? 'is-due' : ''), figure(counts.inProgress, t('in progress'), counts.inProgress ? 'is-busy' : ''), figure(counts.toVerify, t('to verify')), figure(counts.verified, t('verified')));
|
|
2702
|
+
body.append(lead);
|
|
2703
|
+
const tags = (label, list) => {
|
|
2704
|
+
const row = el('div', 'sm-logs-tally');
|
|
2705
|
+
row.append(el('span', 'sm-logs-tally-label', label));
|
|
2706
|
+
const box = el('div', 'sm-logs-chips');
|
|
2707
|
+
for (const one of list) box.append(el('span', 'sm-logs-chip', `${one.name} ${one.n}`));
|
|
2708
|
+
row.append(box);
|
|
2709
|
+
return row;
|
|
2710
|
+
};
|
|
2711
|
+
// Who is working now (madre-logs' EN-CURSO.md): Claude, Codex and Antigravity each with its badge.
|
|
2712
|
+
const AGENTS = { claude: 'Claude', codex: 'Codex', antigravity: 'Antigravity' };
|
|
2713
|
+
// Whoever the row names, in its own words when they say more than the agent's name: the author
|
|
2714
|
+
// works with two Claude accounts (2026-11-08) and «claude-personal» is which one.
|
|
2715
|
+
const badge = (agent, who) => {
|
|
2716
|
+
const said = String(who ?? '').split('·')[0].trim();
|
|
2717
|
+
const known = AGENTS[agent] ?? null;
|
|
2718
|
+
return el('span', `sm-logs-agent ag-${agent ?? 'other'}`, said && said.toLowerCase() !== (known ?? '').toLowerCase() ? said : known ?? said);
|
|
2719
|
+
};
|
|
2720
|
+
const loose = reading.unregistered ?? [];
|
|
2721
|
+
if (reading.working?.length || loose.length) {
|
|
2722
|
+
const now = el('section', 'sm-logs-group sm-logs-working');
|
|
2723
|
+
const head = el('header', 'sm-logs-group-head');
|
|
2724
|
+
head.append(el('span', null, t('Working now')), el('small', null, String((reading.working?.length ?? 0) + loose.length)));
|
|
2725
|
+
now.append(head);
|
|
2726
|
+
// At work in the last minutes without its row in EN-CURSO.md: what it works on cannot be said.
|
|
2727
|
+
// One that took its row out a few minutes ago finished: its session may still be writing.
|
|
2728
|
+
for (const one of loose) {
|
|
2729
|
+
const row = el('div', `sm-logs-work ${one.finished ? 'is-done' : 'is-loose'}`);
|
|
2730
|
+
const top = el('div', 'sm-logs-top');
|
|
2731
|
+
top.append(badge(one.agent), el('b', 'sm-logs-title', one.finished ? t('Finished its work') : t('Working without registering in EN-CURSO.md')), el('small', 'sm-logs-when', ago(one.finished ?? one.at)));
|
|
2732
|
+
row.append(top, el('small', 'sm-logs-zone', one.finished ? t('It took its row out of EN-CURSO.md; it may still be saving or answering.') : t('Nobody can tell which error it has. Ask it to follow rule 12 of ~/madre-logs/AGENTS.md.')));
|
|
2733
|
+
now.append(row);
|
|
2734
|
+
}
|
|
2735
|
+
for (const work of reading.working ?? []) {
|
|
2736
|
+
const row = el('div', 'sm-logs-work');
|
|
2737
|
+
const top = el('div', 'sm-logs-top');
|
|
2738
|
+
top.append(badge(work.agent, work.who), el('b', 'sm-logs-title', work.what));
|
|
2739
|
+
row.append(top);
|
|
2740
|
+
if (work.zone) row.append(el('small', 'sm-logs-zone', work.zone));
|
|
2741
|
+
now.append(row);
|
|
2742
|
+
}
|
|
2743
|
+
body.append(now);
|
|
2744
|
+
}
|
|
2745
|
+
if (reading.byClase.length) body.append(tags(t('Class'), reading.byClase), tags(t('Type'), reading.byTipo));
|
|
2746
|
+
const STATE = { 'en-curso': t('in progress'), abierto: t('open'), investigando: t('investigating'), decision: t('your decision'), arreglado: t('fixed'), publicado: t('published'), verificado: t('verified') };
|
|
2747
|
+
const GROUPS = [
|
|
2748
|
+
[t('Urgent · P0 and P1'), (one) => one.nivel === 'P0' || one.nivel === 'P1', 'lv-urgent'],
|
|
2749
|
+
[t('Minor · P2'), (one) => one.nivel === 'P2', 'lv-minor'],
|
|
2750
|
+
[t('To investigate'), (one) => one.nivel === 'Investigar', 'lv-look'],
|
|
2751
|
+
[t('To watch'), (one) => one.nivel === 'Vigilar', 'lv-watch'],
|
|
2752
|
+
[t('Your decision'), (one) => one.nivel === 'Decisión', 'lv-decide'],
|
|
2753
|
+
// Planned work, not a failure (madre-logs, 2026-11-08): a lot of a plan the author already
|
|
2754
|
+
// asked for. Last, and it never looks urgent.
|
|
2755
|
+
[t('Planned work'), (one) => one.nivel === 'Obra', 'lv-work'],
|
|
2756
|
+
];
|
|
2757
|
+
const card = (one, tone) => {
|
|
2758
|
+
const row = el('article', `sm-logs-item ${tone} is-${one.estado}`);
|
|
2759
|
+
const side = el('div', 'sm-logs-side');
|
|
2760
|
+
side.append(el('code', 'sm-logs-id', one.id), el('span', 'sm-logs-level', one.nivel === 'Investigar' ? t('Investigate') : one.nivel === 'Vigilar' ? t('Watch') : one.nivel === 'Decisión' ? t('Decide') : one.nivel === 'Obra' ? t('Build') : one.nivel));
|
|
2761
|
+
const main = el('div', 'sm-logs-main');
|
|
2762
|
+
const top = el('div', 'sm-logs-top');
|
|
2763
|
+
top.append(el('b', 'sm-logs-title', one.title));
|
|
2764
|
+
if (one.estado === 'en-curso' && (one.agent || one.responsable)) top.append(badge(one.agent, one.responsable));
|
|
2765
|
+
top.append(el('span', 'sm-logs-state', STATE[one.estado] ?? one.estado));
|
|
2766
|
+
const meta = el('div', 'sm-logs-meta');
|
|
2767
|
+
for (const word of [one.clase, one.tipo, one.origen].filter(Boolean)) meta.append(el('span', null, word));
|
|
2768
|
+
if (one.commit) meta.append(el('code', null, one.commit));
|
|
2769
|
+
main.append(top, meta);
|
|
2770
|
+
row.append(side, main);
|
|
2771
|
+
return row;
|
|
2772
|
+
};
|
|
2773
|
+
const left = [...reading.toFix];
|
|
2774
|
+
for (const [title, fits, tone] of GROUPS) {
|
|
2775
|
+
const these = left.filter(fits);
|
|
2776
|
+
if (!these.length) continue;
|
|
2777
|
+
const group = el('section', `sm-logs-group ${tone}`);
|
|
2778
|
+
const head = el('header', 'sm-logs-group-head');
|
|
2779
|
+
head.append(el('span', null, title), el('small', null, String(these.length)));
|
|
2780
|
+
group.append(head);
|
|
2781
|
+
for (const one of these) group.append(card(one, tone));
|
|
2782
|
+
body.append(group);
|
|
2783
|
+
}
|
|
2784
|
+
if (reading.toVerify.length) {
|
|
2785
|
+
const wait = el('details', 'sm-logs-group sm-logs-wait');
|
|
2786
|
+
const head = el('summary', 'sm-logs-group-head');
|
|
2787
|
+
head.append(el('span', null, t('Fixed, to verify')), el('small', null, String(reading.toVerify.length)));
|
|
2788
|
+
wait.append(head);
|
|
2789
|
+
for (const one of reading.toVerify) wait.append(card(one, 'lv-done'));
|
|
2790
|
+
body.append(wait);
|
|
2791
|
+
}
|
|
2792
|
+
if (reading.log.length) {
|
|
2793
|
+
const moves = el('section', 'sm-logs-group sm-logs-moves');
|
|
2794
|
+
const head = el('header', 'sm-logs-group-head');
|
|
2795
|
+
head.append(el('span', null, t('Last changes')));
|
|
2796
|
+
moves.append(head);
|
|
2797
|
+
for (const one of reading.log.slice(0, 5)) {
|
|
2798
|
+
const row = el('div', 'sm-logs-move');
|
|
2799
|
+
row.append(el('span', null, one.said), el('small', null, ago(one.at)));
|
|
2800
|
+
row.title = `${one.hash} · ${one.said}`;
|
|
2801
|
+
moves.append(row);
|
|
2802
|
+
}
|
|
2803
|
+
body.append(moves);
|
|
2804
|
+
}
|
|
2805
|
+
body.append(el('small', 'sm-w-foot', t('From ~/madre-logs · INDICE.md has the whole table')));
|
|
2806
|
+
},
|
|
2506
2807
|
errors(body, reading, { again } = {}) {
|
|
2507
2808
|
if (!reading.available) { body.append(el('p', 'sm-hint', reading.status ? t('madre.run answered {status}.', { status: reading.status }) : t('madre.run could not be reached.'))); return; }
|
|
2508
2809
|
const open = reading.errors.filter((one) => one.status !== 'ignored' && one.status !== 'fixed');
|
|
@@ -2649,7 +2950,7 @@ function makeWidget(id) {
|
|
|
2649
2950
|
// The first time it shows, what it is (homeTour is set up below this, so it is read late).
|
|
2650
2951
|
if (!node.dataset.guided) { node.dataset.guided = '1'; setTimeout(() => { try { guideWidget(node, spec.kind); } catch { /* the tour is not up yet */ } }, 1500); }
|
|
2651
2952
|
};
|
|
2652
|
-
node.start = () => { if (timer) return; void read(); timer = setInterval(() => void read(), 20000); };
|
|
2953
|
+
node.start = () => { if (timer) return; void read(); timer = setInterval(() => void read(), spec.every ?? 20000); };
|
|
2653
2954
|
node.stop = () => { clearInterval(timer); timer = 0; };
|
|
2654
2955
|
// Said again in the language Home settled on: a widget is made once, before the first answer
|
|
2655
2956
|
// tells Home which language MADRE speaks (a new MADRE starts in Spanish and may adopt English),
|
|
@@ -2669,9 +2970,25 @@ const intoAProject = () => {
|
|
|
2669
2970
|
const room = data ? projectsInOrder().open[0] : null;
|
|
2670
2971
|
return room ? () => leaveTo(addressOf(room)) : undefined;
|
|
2671
2972
|
};
|
|
2973
|
+
// The first week's missions (missions.js), from Home: a message is written in the project opened
|
|
2974
|
+
// most recently (or the first one), which opens with it in its box.
|
|
2975
|
+
const missionDraft = (text) => {
|
|
2976
|
+
const order = projectsInOrder();
|
|
2977
|
+
const room = order.open[0] ?? order.all[0];
|
|
2978
|
+
if (!room) { openHomeWelcome?.({}); return; }
|
|
2979
|
+
if (room.open?.port || room.here) leaveTo(`${addressOf(room)}#escribe=${encodeURIComponent(text)}`);
|
|
2980
|
+
else void startRoom(room, { enter: true, draft: text });
|
|
2981
|
+
};
|
|
2672
2982
|
const homeTour = startTour({
|
|
2673
2983
|
page: 'home',
|
|
2674
2984
|
pillSlot: $('sm-tour-pill'),
|
|
2985
|
+
missions: {
|
|
2986
|
+
draft: missionDraft,
|
|
2987
|
+
agents: () => (agentsSeen?.agents ?? []).filter((agent) => agent.id !== 'madre' && agentState(agent, agentsSeen).ok).map((agent) => agent.id),
|
|
2988
|
+
localReady: () => (agentsSeen?.agents ?? []).some((agent) => agent.id === 'madre' && agentState(agent, agentsSeen).ok),
|
|
2989
|
+
settings: (part) => openSettings(part === 'local' ? 'local' : 'agents'),
|
|
2990
|
+
market: (tab) => openHomeMarket(tab),
|
|
2991
|
+
},
|
|
2675
2992
|
hidden: () => (data?.phonePreview ? [] : ['phone']),
|
|
2676
2993
|
ready: () => Boolean(data) && !welcomeOpen() && !sheet,
|
|
2677
2994
|
welcome: { instead: true, needed: () => !projectsInOrder().all.length || !agentsReady(), open: (then) => openHomeWelcome({ then }) },
|
|
@@ -2711,6 +3028,31 @@ homeTour.firstOpen('home-settings', ui.gear, {
|
|
|
2711
3028
|
title: () => t('Home settings'),
|
|
2712
3029
|
text: () => t('How Home looks and what its bar holds, your agents, the Coordinator, which projects use the local AI, your projects and the version. ⌘ , opens it from anywhere.'),
|
|
2713
3030
|
});
|
|
3031
|
+
// The other main keys of Home (1.1, 2026-11-08): what each one is, said once, the first time it is pressed.
|
|
3032
|
+
homeTour.firstOpen('home-activity', $('sm-tb-activity'), {
|
|
3033
|
+
opened: () => document.querySelector('.activity-panel:not([hidden])'),
|
|
3034
|
+
title: () => t('Running now'),
|
|
3035
|
+
text: () => t('Everything MADRE is doing right now in your open projects: an AI answering, a command being run, something installing. If something takes too long, you stop it from here.'),
|
|
3036
|
+
});
|
|
3037
|
+
homeTour.firstOpen('home-market', $('sm-tb-market'), {
|
|
3038
|
+
opened: () => document.querySelector('.mk[role="dialog"]'),
|
|
3039
|
+
title: () => t('Market'),
|
|
3040
|
+
text: () => t('Extra features for MADRE, made by its author and by the community: images, reminders, GitHub and more. Each one tells you what it does and what it touches before you install it.'),
|
|
3041
|
+
after: 700,
|
|
3042
|
+
});
|
|
3043
|
+
homeTour.firstOpen('home-modules', $('sm-tb-modules'), {
|
|
3044
|
+
opened: () => document.querySelector('.mk[role="dialog"]'),
|
|
3045
|
+
title: () => t('Modules'),
|
|
3046
|
+
text: () => t('The modules you already have, and in which projects each one is on. Switch one on only where you need it.'),
|
|
3047
|
+
after: 700,
|
|
3048
|
+
});
|
|
3049
|
+
homeTour.firstOpen('home-agents', ui.bar.agents, {
|
|
3050
|
+
// Beside the list of agents it opened, under its title: Settings here is a window, not a modal sheet.
|
|
3051
|
+
opened: () => topSheet()?.querySelector('.settings-detail .settings-detail-head, .settings-detail') ?? topSheet(),
|
|
3052
|
+
inside: (box) => box.closest('.sm-settings-window') ?? box,
|
|
3053
|
+
title: () => t('Your AIs'),
|
|
3054
|
+
text: () => t('Each circle is one of your AIs, with a light that says whether it is ready. One that looks switched off still needs you to sign in: press it and MADRE takes you there.'),
|
|
3055
|
+
});
|
|
2714
3056
|
// What each widget shows, the first time it is on Home: its own line, and how to change it.
|
|
2715
3057
|
const WIDGET_GUIDE = {
|
|
2716
3058
|
system: () => t('How busy this Mac\'s processor is and how much memory is free. It updates on its own.'),
|
|
@@ -2761,6 +3103,12 @@ function welcomeHome() {
|
|
|
2761
3103
|
title: () => t('Your Coordinator'),
|
|
2762
3104
|
text: () => t('An agent that sees all your projects. Ask it «which project was I on yesterday?», or to pass an instruction from one project to another.'),
|
|
2763
3105
|
},
|
|
3106
|
+
{
|
|
3107
|
+
id: 'home-widgets',
|
|
3108
|
+
anchor: () => document.getElementById('sm-add-widgets'),
|
|
3109
|
+
title: () => t('Your widgets'),
|
|
3110
|
+
text: () => t('Put on Home what you want in sight: your reminders, your projects\' servers, how busy this computer is. Right-click any tile to move it or take it off.'),
|
|
3111
|
+
},
|
|
2764
3112
|
{
|
|
2765
3113
|
id: 'links',
|
|
2766
3114
|
anchor: () => { const tile = $('sm-links-tile'); return tile && !tile.hidden ? tile.querySelector('.sm-tile-head') ?? tile : null; },
|
|
@@ -2785,7 +3133,8 @@ function welcomeHome() {
|
|
|
2785
3133
|
const at = here.findIndex((one) => !seen[one.id]);
|
|
2786
3134
|
if (at < 0) return;
|
|
2787
3135
|
const one = here[at];
|
|
2788
|
-
|
|
3136
|
+
// Not over the Market either (it covers Home without being a dialog).
|
|
3137
|
+
const shown = !document.querySelector('dialog[open]') && !document.documentElement.classList.contains('mk-open') && await homeTour.hint(one.id, one.anchor(), {
|
|
2789
3138
|
title: one.title(),
|
|
2790
3139
|
text: one.text(),
|
|
2791
3140
|
step: at + 1,
|
|
@@ -3304,18 +3653,29 @@ async function homeNews(tries = 0) {
|
|
|
3304
3653
|
const dialog = el('dialog', 'whats-new home-news');
|
|
3305
3654
|
dialog.setAttribute('aria-label', t("What's new in MADRE {version}", { version: news.version }));
|
|
3306
3655
|
const sheet = el('div', 'wn-sheet');
|
|
3656
|
+
// The sheet takes the focus, not «Start»: a key already marked looked chosen for you (2026-11-08).
|
|
3657
|
+
// Tab reaches each thing from here.
|
|
3658
|
+
sheet.tabIndex = -1;
|
|
3307
3659
|
const head = el('header', 'wn-head');
|
|
3308
3660
|
const words = el('div', 'wn-headline');
|
|
3309
3661
|
const logo = document.querySelector('.side-brand .brand-logo, #sm-back .brand-logo')?.cloneNode?.(true);
|
|
3310
3662
|
if (logo) { logo.setAttribute('class', 'brand-logo wn-logo'); words.append(logo); }
|
|
3311
|
-
words
|
|
3663
|
+
// Its own words when the version has them (1.1.3: «Good to see you again»), with no label above.
|
|
3664
|
+
words.append(el('h2', null, pick(notes.title) ?? t('You now have {version}', { version: String(news.version).replace(/\.0$/, '') })));
|
|
3312
3665
|
if (notes.intro) words.append(el('p', 'wn-intro', pick(notes.intro)));
|
|
3313
3666
|
head.append(words, closeKey(() => dialog.close()));
|
|
3314
3667
|
const grid = el('div', 'wn-board');
|
|
3668
|
+
const scenes = [];
|
|
3315
3669
|
for (const item of notes.items ?? []) {
|
|
3316
3670
|
const card = el('div', 'wn-card');
|
|
3317
3671
|
const shot = el('span', 'wn-shot wn-card-shot');
|
|
3318
|
-
|
|
3672
|
+
// A moving picture of what it is (1.1.3, public/news-scenes.js) in place of a screenshot.
|
|
3673
|
+
if (item.scene) {
|
|
3674
|
+
const scene = createNewsScene(item.scene);
|
|
3675
|
+
scenes.push(scene);
|
|
3676
|
+
shot.classList.add('scene');
|
|
3677
|
+
shot.append(scene.node);
|
|
3678
|
+
} else if (item.image) {
|
|
3319
3679
|
const image = el('img');
|
|
3320
3680
|
image.alt = pick(item.title) ?? '';
|
|
3321
3681
|
image.loading = 'lazy';
|
|
@@ -3341,14 +3701,14 @@ async function homeNews(tries = 0) {
|
|
|
3341
3701
|
foot.append(start);
|
|
3342
3702
|
sheet.append(head, body, foot);
|
|
3343
3703
|
dialog.append(sheet);
|
|
3344
|
-
dialog.addEventListener('close', () => dialog.remove());
|
|
3704
|
+
dialog.addEventListener('close', () => { for (const scene of scenes) scene.stop(); dialog.remove(); });
|
|
3345
3705
|
document.body.append(dialog);
|
|
3346
3706
|
dialog.showModal();
|
|
3347
3707
|
// Whoever comes from an older MADRE meets MADRE's opening first (2026-10-30), as a new person does in
|
|
3348
3708
|
// the welcome (loader.js, playOpening), and the board comes after it — unless this page just played it
|
|
3349
3709
|
// (public/terms.js, after the new license was accepted).
|
|
3350
|
-
if (openingPlayed())
|
|
3351
|
-
else void playOpening(dialog, { skipLabel: t('Skip') }).then(() =>
|
|
3710
|
+
if (openingPlayed()) sheet.focus({ preventScroll: true });
|
|
3711
|
+
else void playOpening(dialog, { skipLabel: t('Skip') }).then(() => sheet.focus({ preventScroll: true }));
|
|
3352
3712
|
// Seen once shown, as in a project: a board left open and the page closed is not owed again.
|
|
3353
3713
|
void fetch('/api/whats-new/seen', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' }).catch(() => null);
|
|
3354
3714
|
}
|
|
@@ -3413,7 +3773,7 @@ async function adoptLanguage(code) {
|
|
|
3413
3773
|
sayIn(code);
|
|
3414
3774
|
}
|
|
3415
3775
|
|
|
3416
|
-
async function startRoom(room, { enter = false } = {}) {
|
|
3776
|
+
async function startRoom(room, { enter = false, draft = null } = {}) {
|
|
3417
3777
|
busy.set(room.id, 'starting');
|
|
3418
3778
|
failed.delete(room.id);
|
|
3419
3779
|
draw();
|
|
@@ -3423,7 +3783,9 @@ async function startRoom(room, { enter = false } = {}) {
|
|
|
3423
3783
|
busy.delete(room.id);
|
|
3424
3784
|
if (!answer.ok) failed.set(room.id, answer.body.error ?? t('The project did not open.'));
|
|
3425
3785
|
// Opened from its card, the person goes in: that is what «Open» means.
|
|
3426
|
-
|
|
3786
|
+
// From the welcome, with the first message already written: the project's page finds it in its address
|
|
3787
|
+
// (#escribe=, app.js) and leaves it in the box, for the person to send.
|
|
3788
|
+
else if (enter && answer.body.port) { leaveTo(`http://127.0.0.1:${answer.body.port}/${draft ? `#escribe=${encodeURIComponent(draft)}` : ''}`); return answer; }
|
|
3427
3789
|
await refresh();
|
|
3428
3790
|
return answer;
|
|
3429
3791
|
}
|
|
@@ -3457,6 +3819,43 @@ function waitDone(id) {
|
|
|
3457
3819
|
|
|
3458
3820
|
// Out of MADRE (2026-10-10): Home forgets it (src/salas.mjs, forgetProject); its folder and its
|
|
3459
3821
|
// memory stay where they are, and adding the folder again brings them back.
|
|
3822
|
+
// The card's name, written in place: ↵ keeps it, Esc or leaving the field leaves it as it was.
|
|
3823
|
+
// Emptied, the project takes its folder's name back.
|
|
3824
|
+
function renameField(room) {
|
|
3825
|
+
const field = el('input', 'sm-rename');
|
|
3826
|
+
field.type = 'text';
|
|
3827
|
+
field.value = room.name;
|
|
3828
|
+
field.maxLength = 80;
|
|
3829
|
+
field.spellcheck = false;
|
|
3830
|
+
field.setAttribute('aria-label', t('Name of {name}', { name: room.name }));
|
|
3831
|
+
let done = false;
|
|
3832
|
+
const stop = () => { if (done) return; done = true; renaming.delete(room.id); draw(); };
|
|
3833
|
+
const keep = async () => {
|
|
3834
|
+
if (done) return;
|
|
3835
|
+
const name = field.value.replace(/\s+/g, ' ').trim();
|
|
3836
|
+
if (name === room.name) { stop(); return; }
|
|
3837
|
+
done = true;
|
|
3838
|
+
field.disabled = true;
|
|
3839
|
+
const answer = await post('/api/salas/rename', { room: room.id, name });
|
|
3840
|
+
renaming.delete(room.id);
|
|
3841
|
+
if (!answer.ok) { failed.set(room.id, answer.body.error ?? t('The name could not be changed.')); draw(); return; }
|
|
3842
|
+
failed.delete(room.id);
|
|
3843
|
+
toast(name ? t('It is called {name} now. Its folder keeps its name.', { name: answer.body.name ?? name }) : t('It takes its folder\'s name back.'));
|
|
3844
|
+
await refresh();
|
|
3845
|
+
};
|
|
3846
|
+
field.addEventListener('keydown', (event) => {
|
|
3847
|
+
event.stopPropagation();
|
|
3848
|
+
if (event.key === 'Enter') { event.preventDefault(); void keep(); }
|
|
3849
|
+
else if (event.key === 'Escape') { event.preventDefault(); stop(); }
|
|
3850
|
+
});
|
|
3851
|
+
// Leaving the field keeps the name; a card drawn again (the field gone with it) does not.
|
|
3852
|
+
field.addEventListener('blur', () => { setTimeout(() => { if (field.isConnected) void keep(); }, 0); });
|
|
3853
|
+
field.addEventListener('click', (event) => event.stopPropagation());
|
|
3854
|
+
field.addEventListener('pointerdown', (event) => event.stopPropagation());
|
|
3855
|
+
requestAnimationFrame(() => { field.focus(); field.select(); });
|
|
3856
|
+
return field;
|
|
3857
|
+
}
|
|
3858
|
+
|
|
3460
3859
|
async function forgetRoom(room) {
|
|
3461
3860
|
forgetting.delete(room.id);
|
|
3462
3861
|
busy.set(room.id, 'forgetting');
|
|
@@ -3515,7 +3914,7 @@ function macroWords() {
|
|
|
3515
3914
|
// How to move round it, as keys of this computer; on a phone, where there are none, its line.
|
|
3516
3915
|
hint: homeShellOn() ? mapKeys('projects') : t('Drag the space to move it · wheel to come closer · click a project to look at it · drag it to turn it · carry one onto the Coordinator for the Coordinator to read it, or onto another to connect them · ← → from one to the next · Esc to come back'),
|
|
3517
3916
|
bishop: t('Coordinator'),
|
|
3518
|
-
bishopAbout: t('Your Coordinator
|
|
3917
|
+
bishopAbout: t('Your Coordinator sees all your projects at once. Ask it what is still pending, or have it carry something from one project to another.'),
|
|
3519
3918
|
bishopReads: (n) => (n ? (n === 1 ? t('It reads 1 project by a connection') : t('It reads {n} projects by connections', { n })) : t('It reads no project yet: each one it reads is a connection you sign.')),
|
|
3520
3919
|
notLinked: t('Not connected yet: touch one to connect it'),
|
|
3521
3920
|
talk: t('Talk to the Coordinator'),
|
|
@@ -3569,7 +3968,7 @@ function darkAccent() {
|
|
|
3569
3968
|
}
|
|
3570
3969
|
}
|
|
3571
3970
|
} catch { /* no sheets to read: the house accent */ }
|
|
3572
|
-
return '#
|
|
3971
|
+
return '#34d399';
|
|
3573
3972
|
}
|
|
3574
3973
|
// And the ink that accent wears, read the same way.
|
|
3575
3974
|
function darkAccentInk() {
|
|
@@ -3585,7 +3984,7 @@ function darkAccentInk() {
|
|
|
3585
3984
|
}
|
|
3586
3985
|
}
|
|
3587
3986
|
} catch { /* no sheets to read: the house ink */ }
|
|
3588
|
-
return '#
|
|
3987
|
+
return '#022c22';
|
|
3589
3988
|
}
|
|
3590
3989
|
ui.macro.addEventListener('click', async () => {
|
|
3591
3990
|
if (macro || !data) return;
|
|
@@ -3721,6 +4120,7 @@ const PIN_ICON = trazo('pin');
|
|
|
3721
4120
|
const UNPIN_ICON = trazo('unpin');
|
|
3722
4121
|
const ARRANGE_ICON = trazo('arrange');
|
|
3723
4122
|
const FORGET_ICON = trazo('forget');
|
|
4123
|
+
const RENAME_ICON = trazo('pencil');
|
|
3724
4124
|
const MORE_ICON = trazo('more');
|
|
3725
4125
|
const pins = {
|
|
3726
4126
|
saved: null, // what this page decided, for when storage will not keep it
|
|
@@ -4091,6 +4491,8 @@ function pinsMenu(event, room, at = null) {
|
|
|
4091
4491
|
if (place >= 0 && place < order.length - 1) item(t('Move after'), AFTER_ICON, () => moveProject(room.id, 1));
|
|
4092
4492
|
if (place > 0) item(t('Move to the start'), BEFORE_ICON, () => moveProject(room.id, 'first'));
|
|
4093
4493
|
item(t('Add to Home…'), ADD_ICON, () => openHomeAdd());
|
|
4494
|
+
// A name of the person's own; the folder keeps its name (2026-11-13). Not the Coordinator's.
|
|
4495
|
+
if (room.id !== data?.salas) item(t('Rename…'), RENAME_ICON, () => { renaming.add(room.id); forgetting.delete(room.id); draw(); });
|
|
4094
4496
|
menu.append(el('i', 'sm-menu-sep'));
|
|
4095
4497
|
item(t('Remove from MADRE…'), FORGET_ICON, () => { forgetting.add(room.id); asking.delete(room.id); failed.delete(room.id); draw(); }, { danger: true });
|
|
4096
4498
|
menu.addEventListener('keydown', (key) => {
|
|
@@ -4310,6 +4712,39 @@ function toast(words, tone = 'done', action = null) {
|
|
|
4310
4712
|
const post = (url, payload) => fetch(url, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(payload ?? {}) })
|
|
4311
4713
|
.then(async (response) => ({ ok: response.ok, status: response.status, body: await response.json().catch(() => ({})) }))
|
|
4312
4714
|
.catch(() => ({ ok: false, status: 0, body: {} }));
|
|
4715
|
+
// Home's Settings sheet is as wide as you pull it, as a project's is (app.js, gripSettingsSheet;
|
|
4716
|
+
// 2026-11-07): a grip on its edge, the width kept apart from the projects', twice on it to reset.
|
|
4717
|
+
function gripHomeSettings(sheet) {
|
|
4718
|
+
let kept = null;
|
|
4719
|
+
try { kept = Number(localStorage.getItem('pulse.homeSettingsSheet')) || null; } catch { /* no storage */ }
|
|
4720
|
+
if (kept) sheet.style.setProperty('--sheet-w', `${kept}px`);
|
|
4721
|
+
const grip = el('div', 'settings-grip');
|
|
4722
|
+
grip.setAttribute('aria-hidden', 'true');
|
|
4723
|
+
grip.addEventListener('pointerdown', (event) => {
|
|
4724
|
+
event.preventDefault();
|
|
4725
|
+
const startX = event.clientX;
|
|
4726
|
+
const startWidth = sheet.getBoundingClientRect().width;
|
|
4727
|
+
const room = sheet.parentElement?.getBoundingClientRect().width ?? 980;
|
|
4728
|
+
try { grip.setPointerCapture(event.pointerId); } catch { /* a pointer the page no longer holds */ }
|
|
4729
|
+
sheet.classList.add('dragging');
|
|
4730
|
+
const move = (moving) => {
|
|
4731
|
+
const width = Math.round(Math.max(360, Math.min(room - 120, startWidth + startX - moving.clientX)));
|
|
4732
|
+
sheet.style.setProperty('--sheet-w', `${width}px`);
|
|
4733
|
+
};
|
|
4734
|
+
const done = () => {
|
|
4735
|
+
grip.removeEventListener('pointermove', move);
|
|
4736
|
+
sheet.classList.remove('dragging');
|
|
4737
|
+
try { localStorage.setItem('pulse.homeSettingsSheet', String(Math.round(sheet.getBoundingClientRect().width))); } catch { /* no storage */ }
|
|
4738
|
+
};
|
|
4739
|
+
grip.addEventListener('pointermove', move);
|
|
4740
|
+
grip.addEventListener('pointerup', done, { once: true });
|
|
4741
|
+
grip.addEventListener('pointercancel', done, { once: true });
|
|
4742
|
+
});
|
|
4743
|
+
// Twice on the grip goes back to the width it opens with.
|
|
4744
|
+
grip.addEventListener('dblclick', () => { sheet.style.removeProperty('--sheet-w'); try { localStorage.removeItem('pulse.homeSettingsSheet'); } catch { /* no storage */ } });
|
|
4745
|
+
sheet.prepend(grip);
|
|
4746
|
+
}
|
|
4747
|
+
|
|
4313
4748
|
function mark(id, size = 40) {
|
|
4314
4749
|
const brand = brandOf(id);
|
|
4315
4750
|
const node = el('span', 'sm-mark');
|
|
@@ -4493,11 +4928,13 @@ function foldTile({ name, path, note = null, project = true, known = false, chec
|
|
|
4493
4928
|
return item;
|
|
4494
4929
|
}
|
|
4495
4930
|
|
|
4496
|
-
|
|
4931
|
+
// `sources`: the ways it offers, of found · browse · new. The welcome lists the found folders itself
|
|
4932
|
+
// and opens one way at a time (2026-11-10): a single way shows no tabs.
|
|
4933
|
+
function projectPicker({ onAdded = null, onChange = null, withAdd = true, sources = ['found', 'browse', 'new'] } = {}) {
|
|
4497
4934
|
const chosen = new Map(); // path → name
|
|
4498
4935
|
const node = el('div', 'sm-picker');
|
|
4499
4936
|
const pages = foldPages();
|
|
4500
|
-
let source =
|
|
4937
|
+
let source = sources[0]; // found · browse · new
|
|
4501
4938
|
let found = null; // the suggestions, once read
|
|
4502
4939
|
let here = null; // the folder being walked, as /api/salas/folders answered
|
|
4503
4940
|
let query = '';
|
|
@@ -4578,13 +5015,14 @@ function projectPicker({ onAdded = null, onChange = null, withAdd = true } = {})
|
|
|
4578
5015
|
onToggle: (on) => { if (on) chosen.set(one.path, one.name); else chosen.delete(one.path); sync(); },
|
|
4579
5016
|
});
|
|
4580
5017
|
function draw({ keepPage = false } = {}) {
|
|
4581
|
-
const
|
|
5018
|
+
const ways = [['found', t('Found on this Mac')], ['browse', t('Your folders')], ['new', t('New project')]].filter(([id]) => sources.includes(id) || id === source);
|
|
5019
|
+
const options = ways.length > 1 ? customSeg(ways, source, (value) => {
|
|
4582
5020
|
touched = true;
|
|
4583
5021
|
source = value;
|
|
4584
5022
|
draw();
|
|
4585
5023
|
if (value !== 'found' && !here) void walk();
|
|
4586
5024
|
if (value === 'new') nameInput.focus();
|
|
4587
|
-
});
|
|
5025
|
+
}) : el('span');
|
|
4588
5026
|
seg.replaceWith(options);
|
|
4589
5027
|
seg = options;
|
|
4590
5028
|
const making = source === 'new';
|
|
@@ -4592,6 +5030,8 @@ function projectPicker({ onAdded = null, onChange = null, withAdd = true } = {})
|
|
|
4592
5030
|
pages.grid.hidden = making;
|
|
4593
5031
|
footer.hidden = making;
|
|
4594
5032
|
search.hidden = making;
|
|
5033
|
+
// With one way and nothing to search, the head is empty: it takes no room.
|
|
5034
|
+
head.hidden = ways.length < 2 && making;
|
|
4595
5035
|
if (making) {
|
|
4596
5036
|
line.replaceChildren(el('span', 'sm-picker-note', t('An empty folder, made for you, that becomes a project.')));
|
|
4597
5037
|
sayWhere();
|
|
@@ -4655,7 +5095,8 @@ function projectPicker({ onAdded = null, onChange = null, withAdd = true } = {})
|
|
|
4655
5095
|
return true;
|
|
4656
5096
|
}
|
|
4657
5097
|
draw();
|
|
4658
|
-
void loadFound();
|
|
5098
|
+
if (sources.includes('found')) void loadFound();
|
|
5099
|
+
else if (!here) void walk();
|
|
4659
5100
|
sync();
|
|
4660
5101
|
return { node, add, count: () => chosen.size };
|
|
4661
5102
|
}
|
|
@@ -4727,7 +5168,7 @@ void loadMarket({ toast: (words, action) => toast(words, action ? 'news' : 'done
|
|
|
4727
5168
|
// `compact` is the welcome's first step: there, a connected agent is done, and a button to change
|
|
4728
5169
|
// the account it signs in with is a question nobody asked on their first minute.
|
|
4729
5170
|
// Who makes each agent, said under its name as the project's AJUSTES says it.
|
|
4730
|
-
const VENDOR_WORDS = { codex: 'OpenAI', claude: 'Anthropic', gemini: 'Google', opencode: 'OpenCode', cursor: 'Cursor' };
|
|
5171
|
+
const VENDOR_WORDS = { codex: 'OpenAI', claude: 'Anthropic', gemini: 'Google', opencode: 'OpenCode', cursor: 'Cursor', grok: 'xAI' };
|
|
4731
5172
|
|
|
4732
5173
|
// OpenCode's providers in Home, the same block as the project's AJUSTES › Agents › OpenCode: a line
|
|
4733
5174
|
// per provider with a key or an account and its switch for the chat, one row to add another, and
|
|
@@ -4792,9 +5233,8 @@ const openCodeProviders = (() => {
|
|
|
4792
5233
|
const waiting = providers.filter((one) => !one.via && one.takesKey);
|
|
4793
5234
|
if (waiting.length) {
|
|
4794
5235
|
const form = el('form', 'sm-agent-key-form sm-oc-add');
|
|
4795
|
-
|
|
4796
|
-
which
|
|
4797
|
-
for (const provider of waiting) { const option = el('option', null, provider.label); option.value = provider.id; which.append(option); }
|
|
5236
|
+
// OpenCode knows over two hundred: a list to search, the best known pinned on top (2026-11-10).
|
|
5237
|
+
const which = providerPick({ providers: waiting, onChange: () => sync() });
|
|
4798
5238
|
const input = el('input');
|
|
4799
5239
|
input.type = 'password'; input.autocomplete = 'off'; input.spellcheck = false;
|
|
4800
5240
|
const link = el('a', 'sm-agent-key-link', t('Where do I get one?'));
|
|
@@ -4806,11 +5246,10 @@ const openCodeProviders = (() => {
|
|
|
4806
5246
|
link.hidden = !provider?.keyUrl;
|
|
4807
5247
|
if (provider?.keyUrl) link.href = provider.keyUrl;
|
|
4808
5248
|
};
|
|
4809
|
-
which.addEventListener('change', sync);
|
|
4810
5249
|
sync();
|
|
4811
5250
|
const save = el('button', 'sm-btn primary small', t('Add'));
|
|
4812
5251
|
save.type = 'submit';
|
|
4813
|
-
form.append(which, input, save, link, said);
|
|
5252
|
+
form.append(which.node, input, save, link, said);
|
|
4814
5253
|
form.addEventListener('submit', async (event) => {
|
|
4815
5254
|
event.preventDefault();
|
|
4816
5255
|
if (!input.value.trim()) { input.focus(); return; }
|
|
@@ -4844,6 +5283,10 @@ const TROUBLE_WORDS = {
|
|
|
4844
5283
|
disk: () => t('There is not enough free space on this computer to install it.'),
|
|
4845
5284
|
'npm-missing': () => t('Installing it needs Node and npm, and this computer does not have them. Install Node from nodejs.org, then try again.'),
|
|
4846
5285
|
'zstd-missing': () => t('Installing it needs zstd, which this Linux does not have. In a terminal: sudo apt install -y zstd, then try again.'),
|
|
5286
|
+
dns: () => t('This computer could not find the address it downloads from (DNS). In WSL, close it from Windows and open it again; with a VPN on, try without it.'),
|
|
5287
|
+
'ollama-closed': () => t('Ollama closed the connection while downloading the model. Check that Ollama is still running and try again; what already arrived stays.'),
|
|
5288
|
+
// D-29: the registry's own error, not the person's connection, and not MADRE stopping it.
|
|
5289
|
+
registry: () => t('Ollama\'s model server did not answer (an error on its side). It is not your connection: try again in a few minutes; what already arrived stays.'),
|
|
4847
5290
|
timeout: () => t('It took too long and was stopped. Try again.'),
|
|
4848
5291
|
unknown: () => t('It did not install.'),
|
|
4849
5292
|
},
|
|
@@ -4857,7 +5300,7 @@ const TROUBLE_WORDS = {
|
|
|
4857
5300
|
};
|
|
4858
5301
|
// The card of Diagnostics for each of those (public/troubleshooting.js), opened beside the failure.
|
|
4859
5302
|
const TROUBLE_CARDS = {
|
|
4860
|
-
install: { network: 'install-offline', timeout: 'install-offline', permission: 'install-needs-admin', disk: 'disk-full', 'npm-missing': 'node-missing' },
|
|
5303
|
+
install: { network: 'install-offline', dns: 'name-lookup', timeout: 'install-offline', permission: 'install-needs-admin', disk: 'disk-full', 'npm-missing': 'node-missing', 'ollama-closed': 'model-download', registry: 'model-download' },
|
|
4861
5304
|
login: { network: 'install-offline', timeout: 'sign-in-unfinished', cancelled: 'sign-in-unfinished', unknown: 'sign-in-unfinished' },
|
|
4862
5305
|
};
|
|
4863
5306
|
const troubleCard = (agent, kind, cause) => (kind === 'login' && cause === 'refused-account' ? (agent === 'gemini' ? 'gemini-ineligible-tier' : 'not-signed-in') : TROUBLE_CARDS[kind]?.[cause] ?? null);
|
|
@@ -4879,24 +5322,31 @@ function agentsPanel({ onPaint = null, compact = false, explain = null } = {}) {
|
|
|
4879
5322
|
// back is typed here. Without it the sign-in could only wait until its clock killed it.
|
|
4880
5323
|
const askBlock = (agent) => {
|
|
4881
5324
|
if (!live || live.agent !== agent.id) return null;
|
|
4882
|
-
|
|
4883
|
-
|
|
5325
|
+
// As steps, the same as a project's Settings (2026-11-10): the code to copy, the page to open, a
|
|
5326
|
+
// code to paste back when asked, and one waiting line with the way out (styles.css, .login-steps).
|
|
5327
|
+
const box = el('div', 'sm-agent-ask login-ask');
|
|
5328
|
+
const steps = el('ol', 'login-steps');
|
|
5329
|
+
const step = (title, ...rest) => { const item = el('li', 'login-step'); item.append(el('b', null, title), ...rest); steps.append(item); };
|
|
5330
|
+
const openKey = () => {
|
|
4884
5331
|
const open = el('a', 'sm-btn primary small', t('Open the sign-in page'));
|
|
4885
5332
|
open.href = live.url;
|
|
4886
5333
|
open.target = '_blank';
|
|
4887
5334
|
open.rel = 'noopener';
|
|
4888
|
-
|
|
4889
|
-
|
|
5335
|
+
if (live.deviceCode) { const code = live.deviceCode; open.addEventListener('click', () => { void navigator.clipboard?.writeText(code).catch(() => {}); }); }
|
|
5336
|
+
const row = el('div', 'login-row');
|
|
5337
|
+
row.append(open);
|
|
5338
|
+
return row;
|
|
5339
|
+
};
|
|
4890
5340
|
// A device sign-in (GitHub Copilot through OpenCode) shows its code instead of asking for one.
|
|
4891
5341
|
if (live.deviceCode) {
|
|
4892
|
-
const said = el('div', '
|
|
4893
|
-
said.append(el('span', null, t('Type this code on that page:')), el('code', null, live.deviceCode));
|
|
5342
|
+
const said = el('div', 'login-device');
|
|
4894
5343
|
const copy = button('sm-btn small', t('Copy'), async () => {
|
|
4895
5344
|
try { await navigator.clipboard.writeText(live?.deviceCode ?? ''); copy.textContent = t('Copied'); } catch { copy.textContent = t('Select it'); }
|
|
4896
5345
|
});
|
|
4897
|
-
said.append(copy);
|
|
4898
|
-
|
|
4899
|
-
|
|
5346
|
+
said.append(el('code', null, live.deviceCode), copy);
|
|
5347
|
+
step(t('Copy this code'), said);
|
|
5348
|
+
if (live.url) step(t('Open the page and paste it there'), openKey());
|
|
5349
|
+
} else if (live.url) step(t('Open the page and sign in'), openKey());
|
|
4900
5350
|
if (live.asksForCode || live.awaitingCode) {
|
|
4901
5351
|
const form = el('form', 'sm-agent-code');
|
|
4902
5352
|
const input = el('input');
|
|
@@ -4917,9 +5367,13 @@ function agentsPanel({ onPaint = null, compact = false, explain = null } = {}) {
|
|
|
4917
5367
|
else said.textContent = answer.body.error ?? t('The code was not accepted.');
|
|
4918
5368
|
send.disabled = false;
|
|
4919
5369
|
});
|
|
4920
|
-
|
|
5370
|
+
step(t('Paste here the code the page gives you'), form);
|
|
4921
5371
|
}
|
|
4922
|
-
|
|
5372
|
+
const foot = el('div', 'login-wait');
|
|
5373
|
+
foot.append(el('span', 'login-wait-dot'), el('span', null, live.url || live.deviceCode ? t('Waiting for you to finish on the page…') : t('Getting the sign-in ready…')));
|
|
5374
|
+
foot.append(button('sm-btn ghost small', t('Cancel'), async (event) => { event.currentTarget.disabled = true; await post(`/api/agents/${agent.id}/login/cancel`); void paint(); }));
|
|
5375
|
+
if (steps.children.length) box.append(steps);
|
|
5376
|
+
box.append(foot);
|
|
4923
5377
|
return box;
|
|
4924
5378
|
};
|
|
4925
5379
|
|
|
@@ -5014,6 +5468,8 @@ function agentsPanel({ onPaint = null, compact = false, explain = null } = {}) {
|
|
|
5014
5468
|
if (agent.detected && agent.version) facts.append(el('code', 'sm-agent-line', `${agent.version}${agent.path ? ` · ${agent.path}` : ''}`));
|
|
5015
5469
|
const said = agent.detected ? sessionDetail(answer.sessions?.[agent.id]) : null;
|
|
5016
5470
|
if (said) facts.append(el('small', 'sm-agent-line', said));
|
|
5471
|
+
// Through its API it only answers: said where its connection is, with the way to the rest.
|
|
5472
|
+
if (agent.viaApi) facts.append(el('small', 'sm-agent-note', t('Answers through Google\'s API with your key: it does not read your projects or write in them. Install the Gemini CLI for that.')));
|
|
5017
5473
|
// In the welcome, Gemini's account is already said above its card (welcome.js, explainAgent):
|
|
5018
5474
|
// said twice in two ways, it read as two different requirements (QA 1.1.0, NUE-04).
|
|
5019
5475
|
if (agent.account && !(compact && agent.id === 'gemini' && !state.ok)) facts.append(el('small', 'sm-agent-note', agent.account));
|
|
@@ -5052,7 +5508,7 @@ function agentsPanel({ onPaint = null, compact = false, explain = null } = {}) {
|
|
|
5052
5508
|
const choosing = choosingAccount.has(agent.id);
|
|
5053
5509
|
const doors = !state.ok ? (methods.length ? methods : [{ id: null, label: null, note: agent.login?.note }])
|
|
5054
5510
|
: methods.length > 1 && choosing ? methods
|
|
5055
|
-
: [{ id: methods.length === 1 ? methods[0].id : null, label: null, note: methods.length === 1 ? methods[0].note : agent.login?.note, choose: methods.length > 1 }];
|
|
5511
|
+
: [{ id: methods.length === 1 ? methods[0].id : null, label: methods.length === 1 ? methods[0].label : null, note: methods.length === 1 ? methods[0].note : agent.login?.note, choose: methods.length > 1 }];
|
|
5056
5512
|
return doors.map((door) => {
|
|
5057
5513
|
const name = door.label ? t(door.label) : state.ok ? t('Sign in again') : t('Sign in');
|
|
5058
5514
|
const key = button(`sm-btn ${(state.ok && !choosing) || agent.key?.first ? '' : 'primary'} small`, name, async (event) => {
|
|
@@ -5069,16 +5525,18 @@ function agentsPanel({ onPaint = null, compact = false, explain = null } = {}) {
|
|
|
5069
5525
|
});
|
|
5070
5526
|
};
|
|
5071
5527
|
// Gemini's key is its way in (agent.key.first): the field before the Google door.
|
|
5072
|
-
const keyFirst = Boolean(agent.detected && agent.key?.first);
|
|
5528
|
+
const keyFirst = Boolean((agent.detected || agent.id === 'gemini') && agent.key?.first);
|
|
5073
5529
|
if (keyFirst) body.append(keyForm(agent));
|
|
5074
5530
|
const acts = el('div', 'sm-agent-acts');
|
|
5075
5531
|
if (!state.busyNow) {
|
|
5076
|
-
|
|
5532
|
+
// Gemini answering through its API can still get its CLI, for what the API cannot do.
|
|
5533
|
+
const canInstall = !agent.detected || agent.viaApi;
|
|
5534
|
+
if (canInstall && installing.has(agent.id)) {
|
|
5077
5535
|
const wait = button('sm-btn primary small is-busy', t('Installing…'), () => {});
|
|
5078
5536
|
wait.disabled = true;
|
|
5079
5537
|
wait.setAttribute('aria-busy', 'true');
|
|
5080
5538
|
acts.append(wait);
|
|
5081
|
-
} else if (
|
|
5539
|
+
} else if (canInstall && agent.install?.command) acts.append(button(`sm-btn ${agent.viaApi ? '' : 'primary'} small`, wrongAt(agent.id, 'install') ? t('Try again') : agent.viaApi ? t('Install the Gemini CLI') : t('Install'), async (event) => {
|
|
5082
5540
|
event.currentTarget.disabled = true;
|
|
5083
5541
|
event.currentTarget.textContent = t('Installing…');
|
|
5084
5542
|
trouble.delete(agent.id);
|
|
@@ -5098,10 +5556,10 @@ function agentsPanel({ onPaint = null, compact = false, explain = null } = {}) {
|
|
|
5098
5556
|
const ask = askBlock(agent);
|
|
5099
5557
|
if (ask) body.append(ask);
|
|
5100
5558
|
// A key, pasted here; OpenCode's are its providers', in the block below.
|
|
5101
|
-
if (agent.detected && agent.key && agent.id !== 'opencode' && !keyFirst) body.append(keyForm(agent));
|
|
5559
|
+
if ((agent.detected || agent.id === 'gemini') && agent.key && agent.id !== 'opencode' && !keyFirst) body.append(keyForm(agent));
|
|
5102
5560
|
// The same install or sign-in typed in a terminal, folded for whoever prefers it. Signed in,
|
|
5103
5561
|
// OpenCode's providers are added in the block below; its terminal is for a first sign-in.
|
|
5104
|
-
const way = !agent.detected ? agent.install && [agent.install.display, ...(agent.install.alternatives ?? []).map((line) => `# ${t(line)}`)]
|
|
5562
|
+
const way = !agent.detected || agent.viaApi ? agent.install && [agent.install.display, ...(agent.install.alternatives ?? []).map((line) => `# ${t(line)}`)]
|
|
5105
5563
|
: agent.login?.terminal && !(agent.id === 'opencode' && state.ok) ? [agent.login.terminal.command, ...(agent.login.terminal.note ? [`# ${t(agent.login.terminal.note)}`] : [])] : null;
|
|
5106
5564
|
if (way && !state.busyNow) body.append(terminalWay(way, agent.id));
|
|
5107
5565
|
if (agent.id === 'opencode' && agent.detected) body.append(openCodeProviders.node());
|
|
@@ -5206,7 +5664,10 @@ const welcomeHost = {
|
|
|
5206
5664
|
closeKey: (onClick) => closeKey(onClick),
|
|
5207
5665
|
agentState: (agent, answer) => agentState(agent, answer),
|
|
5208
5666
|
projects: () => (data ? projectsInOrder().all : []),
|
|
5209
|
-
openProject: (room) => startRoom(room, { enter: true }),
|
|
5667
|
+
openProject: (room, { draft = null } = {}) => startRoom(room, { enter: true, draft }),
|
|
5668
|
+
// Started ahead, quietly (1.1): the welcome's last step wakes the project it will open, so «Open» goes
|
|
5669
|
+
// straight in instead of waiting on Home. The promise says when it is up.
|
|
5670
|
+
warmProject: (room) => (room?.open ? Promise.resolve(true) : fetch('/api/salas/start', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ room: room.id }) }).then((response) => response.ok, () => false)),
|
|
5210
5671
|
setLanguage: (code) => adoptLanguage(code),
|
|
5211
5672
|
openLinks: () => openLinkSheet(),
|
|
5212
5673
|
openMarket: () => void openHomeMarket('shop'),
|
|
@@ -5232,22 +5693,26 @@ function openHomeWelcome({ at = null, then = null } = {}) {
|
|
|
5232
5693
|
// in that room. Nothing scrolls inside the window: the screen behind it does.
|
|
5233
5694
|
const SET_SECTIONS = [
|
|
5234
5695
|
['You', 'How Home looks and what its bar holds', ['look', 'bar']],
|
|
5235
|
-
['The agents', '
|
|
5236
|
-
['System', 'The projects of this Mac, the version and the manual', ['projects', 'release', 'manual']],
|
|
5696
|
+
['The agents', 'The AIs that work for you', ['agents', 'bishop', 'memory', 'local']],
|
|
5697
|
+
['System', 'The projects of this Mac, the version and the manual', ['subscription', 'projects', 'release', 'manual']],
|
|
5237
5698
|
];
|
|
5238
5699
|
// The room's own icons where the room has the category (app.js, SETTINGS_CATS); the bar, BISHOP
|
|
5239
5700
|
// and the projects drawn here in the same hand: 20×20, one round stroke.
|
|
5240
5701
|
const SET_CATS = {
|
|
5241
5702
|
look: { name: 'Appearance', icon: trazoDrawing('appearance') },
|
|
5242
5703
|
bar: { name: 'Top bar', icon: trazoDrawing('arrange') },
|
|
5243
|
-
agents: { name: '
|
|
5704
|
+
agents: { name: 'Your AIs', icon: trazoDrawing('agents') },
|
|
5244
5705
|
bishop: { name: 'Coordinator', icon: trazoDrawing('coordinator') },
|
|
5706
|
+
memory: { name: 'Memory', icon: trazoDrawing('chip') },
|
|
5245
5707
|
local: { name: 'Local AI', icon: trazoDrawing('spark') },
|
|
5246
5708
|
projects: { name: 'Projects', icon: trazoDrawing('folder') },
|
|
5709
|
+
subscription: { name: 'Subscription', icon: trazoDrawing('star') },
|
|
5247
5710
|
release: { name: 'Version', icon: trazoDrawing('refresh') },
|
|
5248
5711
|
manual: { name: 'User manual', icon: trazoDrawing('book') },
|
|
5249
5712
|
};
|
|
5250
|
-
const SET_ORDER = ['look', 'bar', 'agents', 'bishop', 'local', 'projects', 'release'];
|
|
5713
|
+
const SET_ORDER = ['look', 'bar', 'agents', 'bishop', 'memory', 'local', 'subscription', 'projects', 'release'];
|
|
5714
|
+
// Subscription stands only where there is one (inside the app, with the author's switch on).
|
|
5715
|
+
const setHas = (id) => id !== 'subscription' || subscriptionShown();
|
|
5251
5716
|
// The words the search knows, each pointing to the category that holds it (app.js, SETTINGS_INDEX).
|
|
5252
5717
|
const SET_INDEX = [
|
|
5253
5718
|
['look', 'Preview'], ['look', 'Theme'], ['look', 'Accent'], ['look', 'Wallpaper'], ['look', 'Intensity'], ['look', 'Blur'], ['look', 'Project cards'], ['look', 'Text'], ['look', 'Project order'], ['look', 'Language'],
|
|
@@ -5312,6 +5777,7 @@ function customSeg(options, current, pick, size = '') {
|
|
|
5312
5777
|
function openManual() { window.open(`/manual?lang=${language}`, '_blank', 'noopener'); }
|
|
5313
5778
|
function setStatus(id) {
|
|
5314
5779
|
if (id === 'manual') return { line: t('With pictures, step by step. Also as a PDF.') };
|
|
5780
|
+
if (id === 'subscription') return { line: subscriptionLine() };
|
|
5315
5781
|
const looks = readLooks();
|
|
5316
5782
|
// The new design shows no wallpaper (salas-mac.css, .sm-sky), so the summary no longer names one
|
|
5317
5783
|
// that is nowhere to be seen (QA 1.1.0, ACT-06).
|
|
@@ -5327,9 +5793,11 @@ function setStatus(id) {
|
|
|
5327
5793
|
if (!agentsSeen) return { line: t('Reading…') };
|
|
5328
5794
|
const here = agentsSeen.agents.filter((agent) => agent.id !== 'madre' && agent.detected);
|
|
5329
5795
|
const off = here.filter((agent) => !agentState(agent, agentsSeen).ok);
|
|
5330
|
-
return { line: t('{n} of {total}
|
|
5796
|
+
return { line: t('{n} of {total} connected', { n: here.length - off.length, total: here.length }), warn: off.length ? t('{agents} not connected', { agents: off.map((agent) => agent.label ?? agent.id).join(', ') }) : null };
|
|
5331
5797
|
}
|
|
5332
5798
|
if (id === 'bishop') { const room = bishopRoom(); return { line: room ? stateOf(room).words : t('Reading…') }; }
|
|
5799
|
+
// Home's own, never the projects' (L-10): /api/settings is asked of Home's room.
|
|
5800
|
+
if (id === 'memory') { const stats = agentsSeen?.settings?.memory?.stats; return { line: stats ? memoriesCount(stats.memories ?? 0) : t('Reading…') }; }
|
|
5333
5801
|
if (id === 'local') {
|
|
5334
5802
|
if (!localSeen) return { line: localFailed ? t('Home did not answer.') : t('Reading…') };
|
|
5335
5803
|
const on = localSeen.projects.filter((one) => one.on).length;
|
|
@@ -5367,14 +5835,19 @@ function setQuick(id) {
|
|
|
5367
5835
|
add(t('Theme'), seg);
|
|
5368
5836
|
}
|
|
5369
5837
|
if (id === 'bar' && !homeShellOn()) add(t('Arrange the bar'), sxButton(t('Arrange'), (event) => { event.stopPropagation(); settingsSheet?.close(); pinsEdit(true); }));
|
|
5838
|
+
// The agents as a quick way in (2026-11-07): each one's mark and its session, three to a row; a tile
|
|
5839
|
+
// opens that agent in the panel (the card itself wires the click, openSettings › card).
|
|
5370
5840
|
if (id === 'agents' && agentsSeen) {
|
|
5841
|
+
rows.classList.add('agents-grid');
|
|
5371
5842
|
for (const agent of agentsSeen.agents.filter((one) => one.id !== 'madre' && one.detected)) {
|
|
5372
5843
|
const state = agentState(agent, agentsSeen);
|
|
5373
|
-
const
|
|
5374
|
-
const
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5844
|
+
const label = agent.label ?? agent.id;
|
|
5845
|
+
const tile = el('button', 'settings-quick-tile agent');
|
|
5846
|
+
tile.type = 'button';
|
|
5847
|
+
tile.dataset.agent = label;
|
|
5848
|
+
tile.setAttribute('aria-label', `${label} · ${state.ok ? t('signed in') : state.key === 'bad' ? t('no session') : t('unknown')}`);
|
|
5849
|
+
tile.append(mark(agent.id, 26), el('span', `state session-lamp ${state.ok ? 'on ok' : state.key === 'bad' ? 'off bad' : 'wait'}`, state.ok ? t('signed in') : state.key === 'bad' ? t('no session') : t('unknown')));
|
|
5850
|
+
rows.append(tile);
|
|
5378
5851
|
}
|
|
5379
5852
|
}
|
|
5380
5853
|
return rows.children.length ? rows : null;
|
|
@@ -5615,6 +6088,28 @@ function fillBishop(host) {
|
|
|
5615
6088
|
sxRow(block, t('Talk to the Coordinator'), room ? stateOf(room).words : null, sxButton(t('Open'), () => { settingsSheet?.close(); openBishop(); }, { tone: 'primary' }));
|
|
5616
6089
|
sxRow(block, t('Open the Coordinator in a new tab'), null, sxButton(t('Open'), () => openBishop({ newTab: true })));
|
|
5617
6090
|
}
|
|
6091
|
+
// MEMORY (L-10, 2026-11-05): what Home itself remembers — the Coordinator and what is said here —
|
|
6092
|
+
// and nothing of the projects. The Memory tile on Home adds up the open projects, and that was read
|
|
6093
|
+
// as Home's; each project keeps its own in its own Settings. Asked of Home's room, the routes a
|
|
6094
|
+
// project's Settings › What it remembers asks of its own; the rest of the settings stay there.
|
|
6095
|
+
async function fillMemory(host) {
|
|
6096
|
+
const block = sxBlock(host, t('Home\'s memory'), t('What Home remembers: the Coordinator and what is said here. Each project keeps its own memory, in its own Settings.'));
|
|
6097
|
+
sxRow(block, t('Reading…'), null);
|
|
6098
|
+
const ask = (path) => fetch(path, { cache: 'no-store' }).then((answer) => (answer.ok ? answer.json() : null)).catch(() => null);
|
|
6099
|
+
const [dash, settings] = await Promise.all([ask('/api/memory/dashboard').then((one) => one?.dashboard ?? null), ask('/api/settings').then((one) => one?.settings?.memory ?? null)]);
|
|
6100
|
+
if (!block.isConnected) return;
|
|
6101
|
+
block.rows.replaceChildren();
|
|
6102
|
+
if (!dash && !settings) sxRow(block, t('Home did not answer.'), null);
|
|
6103
|
+
else {
|
|
6104
|
+
const totals = dash?.totals ?? settings?.stats ?? {};
|
|
6105
|
+
sxRow(block, t('Memories'), totals.pending ? t('{n} exchanges still to sort', { n: totals.pending }) : null, el('b', null, memoriesCount(totals.memories ?? 0)));
|
|
6106
|
+
const kinds = KINDS.filter((kind) => dash?.kinds?.[kind]).map((kind) => `${kindWord(kind)} · ${dash.kinds[kind]}`);
|
|
6107
|
+
if (kinds.length) sxRow(block, t('By kind'), kinds.join(' · '));
|
|
6108
|
+
if (settings) sxRow(block, t('Who takes notes'), settings.enabled === false ? t('Off') : settings.archivist === 'ollama' ? t('Local AI') : settings.archivist && settings.archivist !== 'auto' ? `@${settings.archivist}` : t('Automatic · the cheapest one'));
|
|
6109
|
+
}
|
|
6110
|
+
const more = sxBlock(host, t('The rest'), t('Who may take notes, how often and how it searches are set in the Coordinator, in its Settings › What it remembers.'));
|
|
6111
|
+
sxRow(more, t('Talk to the Coordinator'), null, sxButton(t('Open'), () => { settingsSheet?.close(); openBishop(); }, { tone: 'primary' }));
|
|
6112
|
+
}
|
|
5618
6113
|
// LOCAL AI (src/local-ai.mjs): whether every project uses Ollama, the ones picked here, or each
|
|
5619
6114
|
// one as it decides in its own Settings. The switch of each project is the same one its Settings
|
|
5620
6115
|
// show. Since 2026-10-20 Ollama itself is governed here too, as the agents are: the server, the
|
|
@@ -5856,6 +6351,16 @@ function watchPull(model) {
|
|
|
5856
6351
|
const look = async () => {
|
|
5857
6352
|
await loadLocal({ probe: true });
|
|
5858
6353
|
if ((localOllama?.ollama?.models ?? []).some((one) => one.name.replace(/:latest$/, '') === model)) { pulling.delete(model); toast(t('{model} is ready. Choose it in Settings › Local AI.', { model })); return; }
|
|
6354
|
+
if (localOllama?.lastPull?.model === model && !localOllama.lastPull.ok && !localOllama.pulling) {
|
|
6355
|
+
pulling.delete(model);
|
|
6356
|
+
// Said in Home's words for why (the same ones as an install), not Go's error as it came: a
|
|
6357
|
+
// download cut by DNS or the network read as «pull model manifest: … i/o timeout».
|
|
6358
|
+
const said = localOllama.lastPull;
|
|
6359
|
+
if (said.cancelled) return;
|
|
6360
|
+
toast(TROUBLE_WORDS.install[said.trouble]?.() ?? (said.detail || t('The download stopped: {error}', { error: model })));
|
|
6361
|
+
settingsSheet?.sync({ detail: true, only: 'local' });
|
|
6362
|
+
return;
|
|
6363
|
+
}
|
|
5859
6364
|
if (Date.now() - started > 60 * 60 * 1000) { pulling.delete(model); return; }
|
|
5860
6365
|
setTimeout(look, 8000);
|
|
5861
6366
|
};
|
|
@@ -5867,6 +6372,30 @@ function fillProjects(host) {
|
|
|
5867
6372
|
sxRow(block, t('See the welcome again'), t('Agents, AI on your computer, memory and a project, step by step.'), sxButton(t('Open'), () => { settingsSheet?.close(); openHomeWelcome({ at: 'hello' }); }));
|
|
5868
6373
|
const back = homeTour.path() === 'back';
|
|
5869
6374
|
sxRow(block, back ? t('The tour of MADRE 1.0') : t('Getting to know MADRE'), back ? t('Everything new, chapter by chapter. ? opens the gestures anywhere.') : t('The essentials, chapter by chapter. ? opens the gestures anywhere.'), sxButton(t('See the tour'), () => { settingsSheet?.close(); homeTour.openChapters(); }));
|
|
6375
|
+
void drawService(host);
|
|
6376
|
+
}
|
|
6377
|
+
// MADRE as a service of this Linux (src/service.mjs, L-3, Carlos's server): Home starts with the
|
|
6378
|
+
// computer and again if it falls, with the projects that were open. Only where it can be: a Mac,
|
|
6379
|
+
// or a Linux without systemd for the user, shows nothing.
|
|
6380
|
+
async function drawService(host) {
|
|
6381
|
+
const state = await fetch('/api/madre/service', { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null)).catch(() => null);
|
|
6382
|
+
if (!state?.supported || !host.isConnected) return;
|
|
6383
|
+
const block = sxBlock(host, t('When this computer starts'), t('For a server: Home opens with it, and again if it falls, with the projects that were open. A project you close stays closed.'));
|
|
6384
|
+
const said = el('p', 'sx-hint');
|
|
6385
|
+
const paint = (now) => {
|
|
6386
|
+
block.rows.replaceChildren();
|
|
6387
|
+
const key = sxButton(now.enabled ? t('Turn off') : t('Turn on'), async () => {
|
|
6388
|
+
key.disabled = true;
|
|
6389
|
+
said.textContent = '';
|
|
6390
|
+
const answer = await post('/api/madre/service', { on: !now.enabled });
|
|
6391
|
+
if (!answer.ok) { key.disabled = false; said.textContent = answer.body?.error ?? t('It did not change.'); return; }
|
|
6392
|
+
paint(answer.body);
|
|
6393
|
+
}, { tone: now.enabled ? null : 'primary' });
|
|
6394
|
+
sxRow(block, now.enabled ? t('Starts with the computer') : t('Does not start on its own'), now.enabled ? t('Home starts with this computer.') : t('MADRE starts only when you open it.'), key);
|
|
6395
|
+
if (now.enabled && !now.linger) sxRow(block, t('One more step, once'), t('For it to start before anyone signs in, this computer asks for its password. Run this in its terminal: {command}', { command: now.lingerCommand }), null, { stack: true });
|
|
6396
|
+
block.rows.append(said);
|
|
6397
|
+
};
|
|
6398
|
+
paint(state);
|
|
5870
6399
|
}
|
|
5871
6400
|
function fillRelease(host) {
|
|
5872
6401
|
const info = versionSeen;
|
|
@@ -5889,7 +6418,18 @@ function fillRelease(host) {
|
|
|
5889
6418
|
const row = sxRow(block, t('This copy\'s identifier'), t('Random and unique: this copy made it for itself. It lets the author tell one copy\'s errors from another\'s and find the fix for yours, without knowing who you are: no name, no projects.'), copy);
|
|
5890
6419
|
row.querySelector('.sx-words')?.append(el('code', 'sm-install-id', info.copyId));
|
|
5891
6420
|
}
|
|
5892
|
-
|
|
6421
|
+
// What MADRE may hand to the system, kind by kind (2026-11-10, public/notifications.js).
|
|
6422
|
+
const told = sxBlock(host, t('Notifications'), t('What MADRE tells you when you are not looking at it. You choose which.'));
|
|
6423
|
+
const sxSwitch = (on, change, { disabled = false, label = null } = {}) => {
|
|
6424
|
+
const wrap = el('label', 'settings-switch');
|
|
6425
|
+
const box = el('input');
|
|
6426
|
+
box.type = 'checkbox'; box.checked = Boolean(on); box.disabled = disabled;
|
|
6427
|
+
if (label) box.setAttribute('aria-label', label);
|
|
6428
|
+
box.addEventListener('change', () => void change(box.checked, box));
|
|
6429
|
+
wrap.append(box, el('i'));
|
|
6430
|
+
return wrap;
|
|
6431
|
+
};
|
|
6432
|
+
void drawNotifications(told, { sxRow, sxSwitch, sxButton }, { onChange: () => settingsSheet?.sync?.() });
|
|
5893
6433
|
if (info?.available) {
|
|
5894
6434
|
const notes = el('a', 'sx-btn', t('What it brings'));
|
|
5895
6435
|
notes.href = info.release ?? 'https://madre.run';
|
|
@@ -5898,7 +6438,9 @@ function fillRelease(host) {
|
|
|
5898
6438
|
sxRow(block, `MADRE ${info.latest}`, t('MADRE {version} is out.', { version: info.latest }), notes);
|
|
5899
6439
|
// Home restarts with it, as a project does (app.js, drawRelease): the whole page waits on the
|
|
5900
6440
|
// curtain with MADRE's loader through the version arriving, Home closed, and Home back.
|
|
5901
|
-
if (info.install
|
|
6441
|
+
if (info.install === 'app') {
|
|
6442
|
+
// MADRE.app updates itself (its menu bar › Buscar actualizaciones): nothing to run here.
|
|
6443
|
+
} else if (info.install !== 'source') {
|
|
5902
6444
|
const fresh = sxBlock(host, t('Restart Home with {version}', { version: info.latest }), t('Home closes, installs it and comes back on this same address in a few seconds. The open projects keep their version until you restart them.'));
|
|
5903
6445
|
const said = el('p', 'sx-hint');
|
|
5904
6446
|
const restart = sxButton(t('Restart with {version}', { version: info.latest }), () => void updateHome(info, restart, said), { tone: 'primary' });
|
|
@@ -5918,17 +6460,7 @@ function fillRelease(host) {
|
|
|
5918
6460
|
// (public/power.js, askUninstall).
|
|
5919
6461
|
const leave = sxBlock(host, t('Uninstall MADRE'), t('Takes away what MADRE put on this computer: its conversations, memory and settings, and its folder inside your projects. Your projects and your AIs stay.'));
|
|
5920
6462
|
sxRow(leave, t('Remove MADRE from this computer'), t('You will see the whole list before anything is removed.'), sxButton(t('Uninstall…'), () => void askUninstall(), { tone: 'danger' }));
|
|
5921
|
-
drawLegal(host);
|
|
5922
|
-
}
|
|
5923
|
-
// Supporting MADRE (2026-10-30): a donation on GitHub Sponsors, in the person's browser, under the
|
|
5924
|
-
// version and this copy's identifier, as a project's Settings › Version has it (app.js).
|
|
5925
|
-
function drawDonate(host) {
|
|
5926
|
-
const give = sxBlock(host, t('Support MADRE'), t('MADRE is free and made by one person. A donation helps keep it going and growing.'));
|
|
5927
|
-
const go = el('a', 'sx-btn primary', t('Donate'));
|
|
5928
|
-
go.href = SPONSORS_URL;
|
|
5929
|
-
go.target = '_blank';
|
|
5930
|
-
go.rel = 'noopener';
|
|
5931
|
-
sxRow(give, t('Donate on GitHub'), t('Once or every month, the amount you choose. GitHub keeps no commission.'), go);
|
|
6463
|
+
drawLegal(host, { app: info?.install === 'app' });
|
|
5932
6464
|
}
|
|
5933
6465
|
async function updateHome(info, key, said) {
|
|
5934
6466
|
key.disabled = true;
|
|
@@ -5957,7 +6489,7 @@ async function updateHome(info, key, said) {
|
|
|
5957
6489
|
}
|
|
5958
6490
|
drop(t('Home did not come back on its own. Start MADRE again from your terminal.'));
|
|
5959
6491
|
}
|
|
5960
|
-
const SET_FILL = { look: fillLook, bar: fillBar, agents: fillAgents, bishop: fillBishop, local: fillLocal, projects: fillProjects, release: fillRelease };
|
|
6492
|
+
const SET_FILL = { subscription: (host) => drawSubscription(host), look: fillLook, bar: fillBar, agents: fillAgents, bishop: fillBishop, memory: (host) => void fillMemory(host), local: fillLocal, projects: fillProjects, release: fillRelease };
|
|
5961
6493
|
|
|
5962
6494
|
let settingsSheet = null;
|
|
5963
6495
|
function openSettings(section = null) {
|
|
@@ -6012,6 +6544,10 @@ function openSettings(section = null) {
|
|
|
6012
6544
|
if (status.warn) node.append(el('p', 'settings-warn', status.warn));
|
|
6013
6545
|
const quick = setQuick(id);
|
|
6014
6546
|
if (quick) node.append(quick);
|
|
6547
|
+
// An agent's tile goes straight to that agent, not to the list.
|
|
6548
|
+
for (const tile of quick?.querySelectorAll('.settings-quick-tile.agent') ?? []) {
|
|
6549
|
+
tile.addEventListener('click', (event) => { event.stopPropagation(); openCategory('agents', tile.dataset.agent); });
|
|
6550
|
+
}
|
|
6015
6551
|
// The manual is a page of its own, not a panel.
|
|
6016
6552
|
const go = () => (id === 'manual' ? openManual() : openCategory(id));
|
|
6017
6553
|
node.addEventListener('click', go);
|
|
@@ -6025,7 +6561,7 @@ function openSettings(section = null) {
|
|
|
6025
6561
|
const top = el('header');
|
|
6026
6562
|
top.append(el('b', null, t(name)), el('span', null, t(homeShellOn() && sub === 'How Home looks and what its bar holds' ? 'How Home looks and what its sidebar holds' : sub)));
|
|
6027
6563
|
const cards = el('div', 'settings-cards');
|
|
6028
|
-
for (const id of ids) cards.append(card(id));
|
|
6564
|
+
for (const id of ids) if (setHas(id)) cards.append(card(id));
|
|
6029
6565
|
section.append(top, cards);
|
|
6030
6566
|
node.append(section);
|
|
6031
6567
|
}
|
|
@@ -6052,7 +6588,7 @@ function openSettings(section = null) {
|
|
|
6052
6588
|
const wanted = fold(state.query.trim());
|
|
6053
6589
|
const list = el('div', 'settings-results');
|
|
6054
6590
|
const hits = [];
|
|
6055
|
-
for (const id of SET_ORDER) if (fold(catName(id)).includes(wanted)) hits.push([id, null]);
|
|
6591
|
+
for (const id of SET_ORDER.filter(setHas)) if (fold(catName(id)).includes(wanted)) hits.push([id, null]);
|
|
6056
6592
|
for (const [id, key] of SET_INDEX) if (fold(t(key)).includes(wanted)) hits.push([id, t(key)]);
|
|
6057
6593
|
for (const agent of agentsSeen?.agents ?? []) if (agent.id !== 'madre' && fold(agent.label ?? agent.id).includes(wanted)) hits.push(['agents', agent.label ?? agent.id]);
|
|
6058
6594
|
if (!hits.length) { list.append(el('p', 'settings-reading', t('Nothing called «{query}».', { query: state.query.trim() }))); return list; }
|
|
@@ -6077,6 +6613,7 @@ function openSettings(section = null) {
|
|
|
6077
6613
|
scroll.append(detail(state.open));
|
|
6078
6614
|
sheet.append(scroll);
|
|
6079
6615
|
if (full) { body.replaceChildren(sheet); return; }
|
|
6616
|
+
gripHomeSettings(sheet);
|
|
6080
6617
|
const scrim = el('div', 'settings-scrim');
|
|
6081
6618
|
scrim.addEventListener('click', () => closeCategory());
|
|
6082
6619
|
body.replaceChildren(board(), scrim, sheet);
|
|
@@ -6124,7 +6661,17 @@ function openSettings(section = null) {
|
|
|
6124
6661
|
if (line && state.open) line.textContent = setStatus(state.open).line;
|
|
6125
6662
|
// The sheet stays where it is (it slid in once); only what is inside it is drawn again.
|
|
6126
6663
|
const scroll = body.querySelector('.settings-scroll');
|
|
6127
|
-
|
|
6664
|
+
// Drawn again where the person was reading (2026-11-12, the author: «See every model» sent the
|
|
6665
|
+
// sheet back to the top): the same scroll, and the folds that were open stay open.
|
|
6666
|
+
if (again && state.open && scroll) {
|
|
6667
|
+
const top = scroll.scrollTop;
|
|
6668
|
+
const opened = new Set([...scroll.querySelectorAll('details[open] > summary')].map((summary) => summary.textContent));
|
|
6669
|
+
stop();
|
|
6670
|
+
scroll.replaceChildren(detail(state.open));
|
|
6671
|
+
for (const summary of scroll.querySelectorAll('details > summary')) if (opened.has(summary.textContent)) summary.parentElement.open = true;
|
|
6672
|
+
scroll.scrollTop = top;
|
|
6673
|
+
requestAnimationFrame(() => { if (scroll.scrollTop !== top) scroll.scrollTop = top; });
|
|
6674
|
+
}
|
|
6128
6675
|
};
|
|
6129
6676
|
// A look changed (here, in a room's PERSONALIZE at this address, or in another tab): the cards
|
|
6130
6677
|
// say so, and Appearance is drawn again with it.
|
|
@@ -6178,7 +6725,7 @@ function translateStatic() {
|
|
|
6178
6725
|
ui.bishop.go.textContent = t('Talk to the Coordinator');
|
|
6179
6726
|
ui.bishop.tab.title = t('Open the Coordinator in a new tab');
|
|
6180
6727
|
ui.bishop.tab.setAttribute('aria-label', t('Open the Coordinator in a new tab'));
|
|
6181
|
-
ui.bishop.about.textContent = t('Your Coordinator
|
|
6728
|
+
ui.bishop.about.textContent = t('Your Coordinator sees all your projects at once. Ask it what is still pending, or have it carry something from one project to another.');
|
|
6182
6729
|
ui.work.title.textContent = t('Recent summary');
|
|
6183
6730
|
ui.work.again.textContent = t('Summarize again');
|
|
6184
6731
|
ui.waiting.title.textContent = t('Waiting on you');
|
|
@@ -6188,7 +6735,7 @@ function translateStatic() {
|
|
|
6188
6735
|
ui.linksTitle.textContent = t('Connections');
|
|
6189
6736
|
ui.linksClose.setAttribute('aria-label', t('Close'));
|
|
6190
6737
|
ui.linkMore.textContent = t('Connect projects');
|
|
6191
|
-
ui.memory.title.textContent = t('
|
|
6738
|
+
ui.memory.title.textContent = t('What MADRE remembers');
|
|
6192
6739
|
ui.decisions.title.textContent = t('Recent decisions');
|
|
6193
6740
|
ui.attention.title.textContent = t('Needs you');
|
|
6194
6741
|
// A claim the room found false is said as everywhere else: a doubtful memory, not «aberration».
|
|
@@ -6230,9 +6777,58 @@ function sideRow(icon, label, run, { here = false } = {}) {
|
|
|
6230
6777
|
if (here) row.setAttribute('aria-current', 'page');
|
|
6231
6778
|
return row;
|
|
6232
6779
|
}
|
|
6780
|
+
// What makes way for the sidebar glides by its left edge, as a project's room does (app.js,
|
|
6781
|
+
// layoutPanels): the page takes its new width at once and each part of it comes from where it was,
|
|
6782
|
+
// in the sidebar's time and curve. Its margin animated instead, and the page shrank and grew
|
|
6783
|
+
// line by line under the sliding sidebar (2026-11-09).
|
|
6784
|
+
const SIDE_GLIDE = 420;
|
|
6785
|
+
function glideAside(change) {
|
|
6786
|
+
const still = window.matchMedia('(prefers-reduced-motion: reduce)').matches || window.matchMedia(SHELL_NARROW).matches;
|
|
6787
|
+
const parts = still ? [] : [...document.body.children].filter((node) => node !== homeShell.side && node !== homeShell.scrim && node.getClientRects().length && !/fixed|absolute/.test(getComputedStyle(node).position));
|
|
6788
|
+
const before = parts.map((node) => node.getBoundingClientRect().left);
|
|
6789
|
+
change();
|
|
6790
|
+
parts.forEach((node, i) => {
|
|
6791
|
+
const dx = before[i] - node.getBoundingClientRect().left;
|
|
6792
|
+
if (Math.abs(dx) < 1) return;
|
|
6793
|
+
node.animate([{ transform: `translateX(${dx}px)` }, { transform: 'none' }], { duration: SIDE_GLIDE * (Number(getComputedStyle(root).getPropertyValue('--motion-scale')) || 1), easing: 'cubic-bezier(.22, 1, .36, 1)' });
|
|
6794
|
+
});
|
|
6795
|
+
}
|
|
6796
|
+
// Its inner edge is its handle, as a project's sidebar has (app.js, sideGrip; 2026-11-09): pulled
|
|
6797
|
+
// toward the window's edge, past a third of its width, it puts the sidebar away when let go. It
|
|
6798
|
+
// neither grows nor shrinks: one width, as in a project.
|
|
6799
|
+
function gripHomeSide(side) {
|
|
6800
|
+
// A width pulled wider before this is not kept.
|
|
6801
|
+
try { localStorage.removeItem('pulse.homeSideWidth'); } catch { /* no storage */ }
|
|
6802
|
+
const grip = el('div', 'sm-side-grip');
|
|
6803
|
+
grip.setAttribute('role', 'separator');
|
|
6804
|
+
grip.setAttribute('aria-orientation', 'vertical');
|
|
6805
|
+
grip.setAttribute('aria-label', t('Hide the sidebar'));
|
|
6806
|
+
grip.addEventListener('pointerdown', (event) => {
|
|
6807
|
+
if (event.button !== 0 || window.matchMedia(SHELL_NARROW).matches) return;
|
|
6808
|
+
event.preventDefault();
|
|
6809
|
+
try { grip.setPointerCapture(event.pointerId); } catch { /* a pointer the page no longer holds */ }
|
|
6810
|
+
root.classList.add('side-resizing');
|
|
6811
|
+
const width = side.getBoundingClientRect().width;
|
|
6812
|
+
let closing = false;
|
|
6813
|
+
const move = (moving) => {
|
|
6814
|
+
closing = moving.clientX < width * 2 / 3;
|
|
6815
|
+
side.classList.toggle('closing-by-edge', closing);
|
|
6816
|
+
};
|
|
6817
|
+
const done = () => {
|
|
6818
|
+
grip.removeEventListener('pointermove', move);
|
|
6819
|
+
root.classList.remove('side-resizing');
|
|
6820
|
+
side.classList.remove('closing-by-edge');
|
|
6821
|
+
if (closing) setSide(false);
|
|
6822
|
+
};
|
|
6823
|
+
grip.addEventListener('pointermove', move);
|
|
6824
|
+
grip.addEventListener('pointerup', done, { once: true });
|
|
6825
|
+
grip.addEventListener('pointercancel', done, { once: true });
|
|
6826
|
+
});
|
|
6827
|
+
side.append(grip);
|
|
6828
|
+
}
|
|
6233
6829
|
function setSide(open, { keep = true } = {}) {
|
|
6234
6830
|
homeShell.open = open;
|
|
6235
|
-
root.classList.toggle('home-side', open);
|
|
6831
|
+
if (root.classList.contains('home-side') !== open) glideAside(() => root.classList.toggle('home-side', open));
|
|
6236
6832
|
homeShell.side?.toggleAttribute('inert', !open);
|
|
6237
6833
|
if (keep && !window.matchMedia(SHELL_NARROW).matches) { try { localStorage.setItem(SIDE_KEY, open ? 'open' : 'shut'); } catch { /* as long as the page lasts */ } }
|
|
6238
6834
|
}
|
|
@@ -6289,6 +6885,7 @@ function buildHomeShell() {
|
|
|
6289
6885
|
homeShell.power.setAttribute('aria-haspopup', 'menu');
|
|
6290
6886
|
foot.append(who, homeShell.settings, homeShell.power);
|
|
6291
6887
|
side.append(head, nav, scroll, foot);
|
|
6888
|
+
gripHomeSide(side);
|
|
6292
6889
|
document.body.prepend(side);
|
|
6293
6890
|
homeShell.side = side;
|
|
6294
6891
|
arrangeHomeBar();
|
|
@@ -6408,7 +7005,8 @@ function homeWindow({ root, bar, close, key, minW = 360, minH = 360, keys = true
|
|
|
6408
7005
|
const fresh = () => {
|
|
6409
7006
|
const w = Math.min(size.w, window.innerWidth - 32);
|
|
6410
7007
|
const h = Math.min(size.h, window.innerHeight - 90);
|
|
6411
|
-
|
|
7008
|
+
// 68 px from the top, where a project's windows open (app.js, settingsBoxFor; 2026-11-17: it was 56).
|
|
7009
|
+
return { x: Math.max(16, Math.round((window.innerWidth - w) / 2)), y: 68, w, h };
|
|
6412
7010
|
};
|
|
6413
7011
|
let want = kept?.w && kept?.h ? kept : fresh();
|
|
6414
7012
|
let box = null;
|
|
@@ -6565,7 +7163,8 @@ if (location.hash === '#macroverso' && data && !ui.macro.hidden) { history.repla
|
|
|
6565
7163
|
// The Market's addresses: #mercado, #mercado=<module>, #modulos.
|
|
6566
7164
|
if (/^#mercado(=|$)/.test(location.hash)) openHomeMarket('shop', decodeURIComponent(location.hash.split('=')[1] ?? '') || null);
|
|
6567
7165
|
else if (location.hash === '#modulos') openHomeMarket('mine');
|
|
6568
|
-
|
|
7166
|
+
// Not while a name is being written in a card: the card would be drawn again under the person.
|
|
7167
|
+
timer = setInterval(() => { if (!document.hidden && !busy.size && !renaming.size && !pins.dropping && !pins.drag) void refresh({ polled: true }); }, 4000);
|
|
6569
7168
|
document.addEventListener('visibilitychange', () => { if (!document.hidden) { void refresh(); void loadAgents(); void loadWork(); void loadDecisions(); } });
|
|
6570
7169
|
// The decisions are asked again every few minutes (the route itself asks the rooms no oftener).
|
|
6571
7170
|
setInterval(() => { if (!document.hidden) void loadDecisions(); }, 5 * 60 * 1000);
|
|
@@ -6575,3 +7174,100 @@ setInterval(() => { if (!document.hidden) void loadReminders(); }, 60 * 1000);
|
|
|
6575
7174
|
// Asking for a star or a review (review-ask.js), when Home is quiet: nothing waking or closing,
|
|
6576
7175
|
// the bar not being arranged.
|
|
6577
7176
|
startReviewAsk({ busy: () => busy.size > 0 || pins.editing || Boolean(pins.drag) || Boolean(pins.dropping) });
|
|
7177
|
+
// The author's notices (Q-11): every one for this copy, above the board, until «Got it».
|
|
7178
|
+
const noticesHost = el('div', 'sm-notices');
|
|
7179
|
+
noticesHost.hidden = true;
|
|
7180
|
+
document.querySelector('.sm-hero')?.append(noticesHost);
|
|
7181
|
+
// In the Mac app, Home also hands each notice to macOS once (notices.js, `system`); asked again as soon as
|
|
7182
|
+
// the app knows macOS lets it.
|
|
7183
|
+
const askNoticesAgain = mountNotices(noticesHost, { system: true });
|
|
7184
|
+
mountSubscription({ openSettings: () => openSettings('subscription') });
|
|
7185
|
+
globalThis.addEventListener?.('madre-notifications', () => askNoticesAgain());
|
|
7186
|
+
// THE CHOICE OF THE APP (2026-11-10, src/app-invite.mjs, asked by the author): whoever updated MADRE and
|
|
7187
|
+
// uses it in the browser is asked once per version, in a window of its own, whether to stay in the
|
|
7188
|
+
// browser or to download the app for their computer — once there is one for it. The server decides
|
|
7189
|
+
// whether it is due and for which desktop; the page draws it, never over the welcome, the news or
|
|
7190
|
+
// another window. It speaks to the person: their computer by name (Mac, PC, Linux) and their own
|
|
7191
|
+
// projects, the ones they opened last. `?vista-app=mac|windows|linux` on Home shows it for that
|
|
7192
|
+
// desktop, to look at it: nothing is answered or counted.
|
|
7193
|
+
const tellApp = (answer) => fetch('/api/invite/app', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ answer }) }).catch(() => null);
|
|
7194
|
+
const APP_WORDS = {
|
|
7195
|
+
mac: { name: () => 'Mac', title: () => t('MADRE can live on your Mac now'), take: () => t('Download it for my Mac'), open: () => t('You open it from the Dock, without opening the terminal.') },
|
|
7196
|
+
windows: { name: () => 'PC', title: () => t('MADRE can live on your PC now'), take: () => t('Download it for my PC'), open: () => t('You open it from the Start menu, without opening the terminal.') },
|
|
7197
|
+
linux: { name: () => 'Linux', title: () => t('MADRE can live on your Linux now'), take: () => t('Download it for my Linux'), open: () => t('You open it from your applications, without opening the terminal.') },
|
|
7198
|
+
};
|
|
7199
|
+
// «mi-tienda», «mi-tienda and recetas», «mi-tienda, recetas and 3 more».
|
|
7200
|
+
function namesOf(names, count) {
|
|
7201
|
+
if (!names.length) return '';
|
|
7202
|
+
if (names.length === 1 && count <= 1) return names[0];
|
|
7203
|
+
const shown = names.slice(0, 2);
|
|
7204
|
+
const more = count - shown.length;
|
|
7205
|
+
if (more <= 0) return t('{a} and {b}', { a: shown[0], b: shown[1] });
|
|
7206
|
+
return t('{list} and {n} more', { list: shown.join(', '), n: more });
|
|
7207
|
+
}
|
|
7208
|
+
async function offerApp(said, { preview = false } = {}, tries = 0) {
|
|
7209
|
+
if (welcomeOpen() || document.querySelector('dialog[open]')) { if (tries < 120) setTimeout(() => void offerApp(said, { preview }, tries + 1), 2500); return; }
|
|
7210
|
+
const desktop = APP_WORDS[said.desktop] ? said.desktop : 'mac';
|
|
7211
|
+
const words = APP_WORDS[desktop];
|
|
7212
|
+
const dialog = el('dialog', 'sm-sheet sm-app-choice');
|
|
7213
|
+
dialog.setAttribute('aria-labelledby', 'sm-app-choice-title');
|
|
7214
|
+
const inner = el('div', 'sm-sheet-body');
|
|
7215
|
+
let answered = preview;
|
|
7216
|
+
const answer = (word) => { if (answered) return; answered = true; void tellApp(word); };
|
|
7217
|
+
// The moving picture the news use (news-scenes.js, «desktopapp»): MADRE leaves the browser and
|
|
7218
|
+
// becomes an app of this very computer — its keys, its place among the apps, an AI's notice.
|
|
7219
|
+
const hero = el('div', 'sm-app-hero');
|
|
7220
|
+
const scene = createNewsScene('desktopapp', { os: desktop });
|
|
7221
|
+
hero.append(scene.node);
|
|
7222
|
+
const title = el('h3', null, words.title());
|
|
7223
|
+
title.id = 'sm-app-choice-title';
|
|
7224
|
+
const names = namesOf(said.projects ?? [], said.count ?? 0);
|
|
7225
|
+
const one = (said.count ?? 0) === 1;
|
|
7226
|
+
// What the app is for, said to the person (1.1.4, the author): getting more out of MADRE on their own
|
|
7227
|
+
// computer, named — and what comes with them.
|
|
7228
|
+
const computer = words.name();
|
|
7229
|
+
const lead = el('p', 'sm-app-lead', !names
|
|
7230
|
+
? t('You are on the new version. From today you can open MADRE like any other app and get more out of what it can do on your {computer}. Everything it remembers comes with you.', { computer })
|
|
7231
|
+
: one
|
|
7232
|
+
? t('You are on the new version. From today you can open MADRE like any other app and get more out of what it can do on your {computer}: {project} comes with you as it is, with its chats and everything MADRE remembers.', { computer, project: names })
|
|
7233
|
+
: t('You are on the new version. From today you can open MADRE like any other app and get more out of what it can do on your {computer}: {projects} come with you as they are, with their chats and everything MADRE remembers.', { computer, projects: names }));
|
|
7234
|
+
const options = el('div', 'sm-app-options');
|
|
7235
|
+
const option = (kind, drawing, head, lines, act) => {
|
|
7236
|
+
const card = el('button', `sm-app-option ${kind}`);
|
|
7237
|
+
card.type = 'button';
|
|
7238
|
+
const mark = el('span', 'sm-app-option-icon');
|
|
7239
|
+
mark.innerHTML = trazo(drawing); // trusted: our own SVG string
|
|
7240
|
+
const box = el('span', 'sm-app-option-words');
|
|
7241
|
+
box.append(el('b', null, head));
|
|
7242
|
+
const list = el('span', 'sm-app-option-lines');
|
|
7243
|
+
for (const line of lines) list.append(el('span', null, line));
|
|
7244
|
+
box.append(list);
|
|
7245
|
+
card.append(mark, box);
|
|
7246
|
+
card.addEventListener('click', act);
|
|
7247
|
+
return card;
|
|
7248
|
+
};
|
|
7249
|
+
const stay = option('stay', 'globe', t('I will stay here'), [t('Nothing changes for you.'), t('If you want it some other day, it is at madre.run.')], () => { answer('later'); dialog.close(); });
|
|
7250
|
+
const take = option('take', 'download', words.take(), [words.open(), t('It tells you when an AI finishes.')], () => {
|
|
7251
|
+
answer('open');
|
|
7252
|
+
if (!preview) window.open(said.url, '_blank', 'noopener');
|
|
7253
|
+
dialog.close();
|
|
7254
|
+
});
|
|
7255
|
+
options.append(stay, take);
|
|
7256
|
+
inner.append(hero, title, lead, options);
|
|
7257
|
+
dialog.append(inner);
|
|
7258
|
+
dialog.addEventListener('close', () => { answer('later'); scene.stop(); dialog.remove(); });
|
|
7259
|
+
document.body.append(dialog);
|
|
7260
|
+
dialog.showModal();
|
|
7261
|
+
// Neither card is chosen for the person: the window holds the focus, and Tab reaches the cards.
|
|
7262
|
+
dialog.tabIndex = -1;
|
|
7263
|
+
dialog.focus({ preventScroll: true });
|
|
7264
|
+
if (!preview) void tellApp('shown');
|
|
7265
|
+
}
|
|
7266
|
+
{
|
|
7267
|
+
let look = null;
|
|
7268
|
+
try { look = new URLSearchParams(location.search).get('vista-app'); } catch { /* no address to read */ }
|
|
7269
|
+
void fetch('/api/invite/app', { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null)).then((said) => {
|
|
7270
|
+
if (APP_WORDS[look]) setTimeout(() => void offerApp({ ...(said ?? {}), desktop: look }, { preview: true }), 900);
|
|
7271
|
+
else if (said?.show && said.url) setTimeout(() => void offerApp(said), 900);
|
|
7272
|
+
}).catch(() => null);
|
|
7273
|
+
}
|