@jossuealcala/madre 1.0.3 → 1.0.5

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.
Files changed (106) hide show
  1. package/CHANGELOG.en.md +113 -1
  2. package/CHANGELOG.md +113 -1
  3. package/NOTICE +30 -0
  4. package/README.en.md +59 -156
  5. package/README.md +60 -161
  6. package/TRADEMARKS.md +18 -0
  7. package/bin/madre.mjs +2 -2
  8. package/docs/REFERENCE.md +1 -1
  9. package/docs/SDK.md +25 -4
  10. package/docs/en/REFERENCE.md +1 -1
  11. package/docs/en/SDK.md +22 -2
  12. package/docs/madre-banner.png +0 -0
  13. package/package.json +1 -1
  14. package/public/app.js +1087 -247
  15. package/public/assets/manual/madre-manual-en.pdf +0 -0
  16. package/public/assets/manual/madre-manual-es.pdf +0 -0
  17. package/public/assets/manual/shots/en-agents.webp +0 -0
  18. package/public/assets/manual/shots/en-code.webp +0 -0
  19. package/public/assets/manual/shots/en-composer.webp +0 -0
  20. package/public/assets/manual/shots/en-connectors.webp +0 -0
  21. package/public/assets/manual/shots/en-continuity.webp +0 -0
  22. package/public/assets/manual/shots/en-coordinator.webp +0 -0
  23. package/public/assets/manual/shots/en-copilot.webp +0 -0
  24. package/public/assets/manual/shots/en-diagnostics.webp +0 -0
  25. package/public/assets/manual/shots/en-home.webp +0 -0
  26. package/public/assets/manual/shots/en-local.webp +0 -0
  27. package/public/assets/manual/shots/en-memory.webp +0 -0
  28. package/public/assets/manual/shots/en-modes.webp +0 -0
  29. package/public/assets/manual/shots/en-modules.webp +0 -0
  30. package/public/assets/manual/shots/en-notes.webp +0 -0
  31. package/public/assets/manual/shots/en-settings.webp +0 -0
  32. package/public/assets/manual/shots/en-windows.webp +0 -0
  33. package/public/assets/manual/shots/es-agents.webp +0 -0
  34. package/public/assets/manual/shots/es-code.webp +0 -0
  35. package/public/assets/manual/shots/es-composer.webp +0 -0
  36. package/public/assets/manual/shots/es-connectors.webp +0 -0
  37. package/public/assets/manual/shots/es-continuity.webp +0 -0
  38. package/public/assets/manual/shots/es-coordinator.webp +0 -0
  39. package/public/assets/manual/shots/es-copilot.webp +0 -0
  40. package/public/assets/manual/shots/es-diagnostics.webp +0 -0
  41. package/public/assets/manual/shots/es-home.webp +0 -0
  42. package/public/assets/manual/shots/es-local.webp +0 -0
  43. package/public/assets/manual/shots/es-memory.webp +0 -0
  44. package/public/assets/manual/shots/es-modes.webp +0 -0
  45. package/public/assets/manual/shots/es-modules.webp +0 -0
  46. package/public/assets/manual/shots/es-notes.webp +0 -0
  47. package/public/assets/manual/shots/es-settings.webp +0 -0
  48. package/public/assets/manual/shots/es-windows.webp +0 -0
  49. package/public/en.js +74 -0
  50. package/public/es.js +495 -137
  51. package/public/i18n.js +45 -7
  52. package/public/index.html +2 -3
  53. package/public/manual-content.js +657 -0
  54. package/public/manual-shots.js +43 -0
  55. package/public/manual.css +228 -0
  56. package/public/manual.html +15 -0
  57. package/public/manual.js +398 -0
  58. package/public/market-art.js +56 -0
  59. package/public/market-view.js +140 -22
  60. package/public/market.js +25 -14
  61. package/public/mcp-catalog.js +62 -0
  62. package/public/resay.js +1 -0
  63. package/public/salas-mac.css +185 -30
  64. package/public/salas-mac.html +5 -5
  65. package/public/salas-mac.js +475 -68
  66. package/public/styles.css +306 -42
  67. package/public/tour-chapters.js +98 -90
  68. package/public/tour.js +63 -21
  69. package/public/troubleshooting.js +145 -10
  70. package/src/adapters/cursor.mjs +56 -7
  71. package/src/adapters/gemini.mjs +12 -1
  72. package/src/adapters/madre.mjs +27 -6
  73. package/src/adapters/process.mjs +5 -2
  74. package/src/auth-probe.mjs +22 -3
  75. package/src/bridge/policy.mjs +1 -1
  76. package/src/bridge/server.mjs +1 -1
  77. package/src/capabilities.mjs +3 -3
  78. package/src/credentials.mjs +24 -2
  79. package/src/history.mjs +76 -0
  80. package/src/i18n.mjs +23 -1
  81. package/src/local-ai.mjs +10 -2
  82. package/src/looks.mjs +17 -5
  83. package/src/market-license.mjs +104 -0
  84. package/src/market-remote.mjs +17 -1
  85. package/src/mcp/notes-server.mjs +120 -0
  86. package/src/mcp/proxy.mjs +14 -3
  87. package/src/models.mjs +82 -9
  88. package/src/modules/index.mjs +3 -1
  89. package/src/modules/local-models.mjs +28 -0
  90. package/src/modules/notes.mjs +142 -0
  91. package/src/modules/ollama.mjs +39 -10
  92. package/src/modules/playwright.mjs +14 -3
  93. package/src/modules/reminders.mjs +345 -0
  94. package/src/modules/sdk.mjs +21 -5
  95. package/src/mother.mjs +11 -1
  96. package/src/ollama.mjs +2 -2
  97. package/src/opencode-health.mjs +63 -0
  98. package/src/outbound.mjs +25 -1
  99. package/src/ports.mjs +4 -6
  100. package/src/reminder-time.mjs +127 -0
  101. package/src/room.mjs +19 -7
  102. package/src/runtime-detection.mjs +6 -2
  103. package/src/sentinel-errors.mjs +4 -3
  104. package/src/server-sentinel.mjs +7 -3
  105. package/src/server.mjs +302 -70
  106. package/src/tour.mjs +24 -5
package/public/app.js CHANGED
@@ -3,9 +3,9 @@
3
3
  import { archiveQuestion, modeAskedWithTime, MODE_WINDOWS, windowFor } from './routing.js';
4
4
  import { calledByName, abduct } from './abduction.js';
5
5
  import { brandOf, monogram } from './brands.js';
6
- import { allConditions, detectPlatform, diagnose, fixesFor, PLATFORMS, searchConditions } from './troubleshooting.js';
6
+ import { allConditions, detectPlatform, diagnose, findConditions, fixesFor, PLATFORMS } from './troubleshooting.js';
7
7
  import { answerFor, INQUIRIES, STRIKES } from './inquiry.js';
8
- import { DEFAULT_LANGUAGE, LANGUAGES, browserLanguage, isLanguage, language, pick, setLanguage, t, fill } from './i18n.js';
8
+ import { DEFAULT_LANGUAGE, LANGUAGES, browserLanguage, isLanguage, language, pick, sessionDetail, setLanguage, t, fill } from './i18n.js';
9
9
  import { createEditor } from './editor.js';
10
10
  import { labelPowerKey, powerKey } from './power.js';
11
11
  import { drawHardware, hardwareLine } from './hardware.js';
@@ -18,6 +18,7 @@ import { dropStickyHover } from './touch.js';
18
18
  import { drawAttribution, drawColophonKeys, drawLegal } from './attribution.js';
19
19
  import { MODULE_FACES, appIcon, loadMarket, marketEntry, marketOffer, moduleFace } from './market.js';
20
20
  import { openMarket } from './market-view.js';
21
+ import { CATALOG_CHECKED, MCP_CATALOG, MCP_GROUPS, initials as mcpInitials } from './mcp-catalog.js';
21
22
  // Where nothing can hover (a phone), a tapped key does not stay lit (public/touch.js).
22
23
  dropStickyHover();
23
24
  // Made the first time the room asks for it (roomTour, below), which can be while this file is
@@ -187,7 +188,17 @@ const CLIENT_COMMANDS = [
187
188
  { name: 'module', title: 'MODULE', usage: `/module ${t('<what it should do>')}`, summary: t('Build one MADRE module with the guided SDK flow: the agent writes it, then you review and install it.'), available: true, client: true },
188
189
  { name: 'image', title: t('Image'), usage: `/image ${t('<what to draw>')}`, summary: t('Ask for an image: arms CREATE with the image scope and routes to an agent that can generate images.'), available: true, client: true },
189
190
  { name: 'stopall', title: t('STOP ALL'), usage: '/stopall', summary: t('Master brake: halt every plan and turn in flight. Never reaches an agent.'), available: true, client: true },
191
+ // Notes and Reminders through an agent (2026-10-20): the message goes to the agent chosen, and
192
+ // that turn gets the tool to make it (src/mcp/notes-server.mjs). Named in the room's language;
193
+ // the other language's name works too (ASKING_FOR).
194
+ ...(language() === 'en'
195
+ ? [{ name: 'notes', module: 'notes', title: t('Notes'), usage: `/notes ${t('<what to note>')}`, summary: t('Ask the agent for a note: it writes it and it opens as a colored note.'), available: true, client: true },
196
+ { name: 'reminders', module: 'reminders', title: t('Reminders'), usage: `/reminders ${t('<what and when>')}`, summary: t('Ask the agent for a reminder: MADRE tells you when it is due.'), available: true, client: true }]
197
+ : [{ name: 'notas', module: 'notes', title: t('Notes'), usage: `/notas ${t('<what to note>')}`, summary: t('Ask the agent for a note: it writes it and it opens as a colored note.'), available: true, client: true },
198
+ { name: 'recordatorios', module: 'reminders', title: t('Reminders'), usage: `/recordatorios ${t('<what and when>')}`, summary: t('Ask the agent for a reminder: MADRE tells you when it is due.'), available: true, client: true }]),
190
199
  ];
200
+ // Every name a note or a reminder may be asked for by, in either language.
201
+ const ASKING_FOR = { notas: 'notes', nota: 'notes', notes: 'notes', note: 'notes', recordatorios: 'reminders', recordatorio: 'reminders', reminders: 'reminders', reminder: 'reminders' };
191
202
 
192
203
  const PLACEHOLDERS = {
193
204
  plain: t('Type here, human. Ask the project…'),
@@ -584,6 +595,9 @@ document.addEventListener('focusin', takeTitle, true);
584
595
  // person reads and the room runs on under them; everywhere else the thread is its own scroller.
585
596
  // Everything that reads or moves the conversation's scroll asks here.
586
597
  const pageScrolls = () => Boolean(state.device);
598
+ // On the computer the project is a desktop that never scrolls as a page (styles.css): a
599
+ // scrollIntoView() that reached past its edge used to move it all, wallpaper too (2026-10-20).
600
+ globalThis.addEventListener?.('scroll', () => { if (!pageScrolls() && (globalThis.scrollX || globalThis.scrollY)) globalThis.scrollTo(0, 0); }, { passive: true });
587
601
  const scroller = {
588
602
  get node() { return pageScrolls() ? (document.scrollingElement ?? document.documentElement) : els.thread; },
589
603
  get top() { return this.node?.scrollTop ?? 0; },
@@ -835,7 +849,6 @@ const viewerUI = {
835
849
  review: document.querySelector('#viewer-review'),
836
850
  lang: document.querySelector('#viewer-lang'),
837
851
  hintSelect: document.querySelector('#viewer-hint-select'),
838
- menu: document.querySelector('#viewer-menu'),
839
852
  path: null, // project-relative path of the open text file, if any
840
853
  from: null, to: null,
841
854
  // The lines picked, which need not touch: a click picks one, Shift a run from the last one
@@ -902,73 +915,21 @@ function pickLine(n, event) {
902
915
  } else if (viewerUI.picked.size === 1 && viewerUI.picked.has(n)) setSelection(null, null);
903
916
  else setSelection(n, n);
904
917
  }
905
- function referenceForSelection() {
906
- return pickedRuns().map(([lo, hi]) => `!${viewerUI.path}:${lo}${hi !== lo ? `-${hi}` : ''}`).join(' ');
907
- }
908
- // "Review with @agent": the selection becomes a !file:lines reference in the
909
- // composer and that agent becomes the target; the human finishes the sentence.
910
- function reviewWith(agentId) {
911
- const reference = referenceForSelection();
912
- const current = els.input.value.trim();
913
- // The reference and the cursor, nothing else. This used to seed "review this: " — an English
914
- // phrase in a Spanish room, and worse, a sentence MADRE put in the human's mouth: whatever they
915
- // typed next landed after it and read like somebody else's words. They just chose an agent and
916
- // a range; they know what they want to ask.
917
- els.input.value = current ? `${reference} ${current}` : `${reference} `;
918
- if (agentId && state.agents.get(agentId)?.ready) { els.target.value = agentId; renderPicker(); }
919
- hideViewerMenu();
920
- // Over the room it closes so the composer can be reached; split or floating, it stays.
921
- if (viewer.dialog.matches?.(':modal')) viewer.dialog.close();
922
- autosize();
923
- els.input.focus();
924
- els.input.setSelectionRange(els.input.value.length, els.input.value.length);
925
- }
926
- function showViewerMenu(x, y) {
927
- const menuNode = viewerUI.menu;
928
- // Two lines: what is being sent, and the question. One line put the verb at one end and its
929
- // preposition at the other, and in Spanish the sentence ended on a dangling «CON» that the
930
- // menu then cut off.
931
- const head = el('div', 'hint');
932
- head.append(el('b', null, referenceForSelection()));
933
- head.append(el('span', null, t('review it with')));
934
- menuNode.replaceChildren(head);
935
- for (const agent of state.agents.values()) {
936
- const item = paint(el('button', `item${agent.ready ? '' : ' off'}`), agent.id);
937
- item.type = 'button';
938
- // `@codex Codex` says one thing twice. The handle is the name; beside it goes only what the
939
- // handle does not already tell you — the vendor, or why it cannot take this.
940
- const aside = agent.ready ? vendorWord(agent.id) : t('no session');
941
- item.append(el('b', null, `@${agent.id}`), el('span', null, aside));
942
- item.disabled = !agent.ready;
943
- item.addEventListener('click', () => reviewWith(agent.id));
944
- menuNode.append(item);
945
- }
946
- menuNode.hidden = false;
947
- // In the page's top layer, like the ask card: the viewer's window clipped it at its own edge.
948
- if (!menuNode.hasAttribute('popover')) { menuNode.setAttribute('popover', 'manual'); document.body.append(menuNode); }
949
- try { menuNode.showPopover?.(); } catch { /* without popovers it stays fixed in the page */ }
950
- // Placed by its real size: under the button, or over it when there is no room below.
951
- const width = menuNode.offsetWidth || 260;
952
- const height = menuNode.offsetHeight || 62 + 36 * state.agents.size;
953
- const top = y + height <= window.innerHeight - 12 ? y : Math.max(12, y - height - 44);
954
- menuNode.style.left = `${Math.max(12, Math.min(x, window.innerWidth - width - 12))}px`;
955
- menuNode.style.top = `${Math.round(top)}px`;
956
- }
957
- function hideViewerMenu() { try { viewerUI.menu.hidePopover?.(); } catch { /* not open */ } viewerUI.menu.hidden = true; }
958
- viewerUI.review?.addEventListener('click', (event) => {
959
- const rect = event.currentTarget.getBoundingClientRect();
960
- // One run of lines picked in a file of the project: the same card the editor opens, with its
961
- // verbs. Several runs, or a file from elsewhere, keep the list of agents.
918
+ // ASK: the lines picked become the room's card — who should look, the verbs, the questions they
919
+ // suggest, one's own. One road for every way of asking about code: the bar's ASK, the editor's, a
920
+ // right-click on a line. There were two until 2026-10-20: «REVIEW WITH» also opened a list of
921
+ // agents that only cited the lines — what the card's «Ask my own question» already does — and the
922
+ // two read as one thing with two names.
923
+ function askAboutPicked(anchor) {
962
924
  const runs = pickedRuns();
963
- if (runs.length === 1 && viewerUI.path && viewerMode.editable) {
964
- const [from, to] = runs[0];
965
- askAboutCode({ from, to, text: String(viewerMode.text).split('\n').slice(from - 1, to).join('\n'), anchor: rect, dirty: false });
966
- return;
967
- }
968
- if (viewerUI.menu.hidden) showViewerMenu(rect.left, rect.bottom + 6); else hideViewerMenu();
969
- });
970
- document.addEventListener('click', (event) => { if (viewerUI.menu && !viewerUI.menu.hidden && !viewerUI.menu.contains(event.target) && !viewerUI.review?.contains(event.target)) hideViewerMenu(); });
971
- viewer.dialog.addEventListener('close', () => { hideViewerMenu(); setSelection(null, null); ripley.frame = null; ripley.history = []; ripleyClearErrors(); if (ripley.nav) ripley.nav.hidden = true; });
925
+ if (!runs.length || !viewerUI.path) return;
926
+ const lines = String(viewerMode.text).split('\n');
927
+ const text = runs.map(([lo, hi]) => lines.slice(lo - 1, hi).join('\n')).join('\n');
928
+ askAboutCode({ runs, text, anchor, dirty: false });
929
+ }
930
+ const pointAt = (event) => ({ left: event.clientX, right: event.clientX, top: event.clientY, bottom: event.clientY });
931
+ viewerUI.review?.addEventListener('click', (event) => askAboutPicked(event.currentTarget.getBoundingClientRect()));
932
+ viewer.dialog.addEventListener('close', () => { setSelection(null, null); ripley.frame = null; ripley.history = []; ripleyClearErrors(); if (ripley.nav) ripley.nav.hidden = true; });
972
933
 
973
934
  // How much of a file the viewer draws (WEB-09): every line is two nodes and four listeners, and a
974
935
  // log of hundreds of thousands of lines froze the tab — the phone's first. Past the limit the
@@ -1028,9 +989,9 @@ function codeView(text, { line = null, lines = null, name = null } = {}) {
1028
989
  tx.addEventListener('contextmenu', (event) => {
1029
990
  event.preventDefault();
1030
991
  if (!viewerUI.picked.has(n)) setSelection(n, n);
1031
- showViewerMenu(event.clientX, event.clientY);
992
+ askAboutPicked(pointAt(event));
1032
993
  });
1033
- ln.addEventListener('contextmenu', (event) => { event.preventDefault(); if (!viewerUI.picked.size) setSelection(n, n); showViewerMenu(event.clientX, event.clientY); });
994
+ ln.addEventListener('contextmenu', (event) => { event.preventDefault(); if (!viewerUI.picked.size) setSelection(n, n); askAboutPicked(pointAt(event)); });
1034
995
  viewerUI.lineNodes.push({ n, ln, tx });
1035
996
  pre.append(ln, tx);
1036
997
  });
@@ -1412,8 +1373,8 @@ async function saveEdited(content, { said = null } = {}) {
1412
1373
  if (viewerUI.path) void loadCodeChanges(viewerUI.path);
1413
1374
  return true;
1414
1375
  }
1415
- function askAboutLines({ from, to, prompt, dirty, agentId = null }) {
1416
- const reference = `!${viewerUI.path}:${from}${to !== from ? `-${to}` : ''}`;
1376
+ function askAboutLines({ from, to, runs = [[from, to]], prompt, dirty, agentId = null }) {
1377
+ const reference = runs.map(([lo, hi]) => `!${viewerUI.path}:${lo}${hi !== lo ? `-${hi}` : ''}`).join(' ');
1417
1378
  // Asking again about the same file replaces the last question about it instead of piling
1418
1379
  // references and questions up in the box; anything else the human wrote stays.
1419
1380
  let current = els.input.value;
@@ -1432,14 +1393,16 @@ function askAboutLines({ from, to, prompt, dirty, agentId = null }) {
1432
1393
  els.input.setSelectionRange(els.input.value.length, els.input.value.length);
1433
1394
  }
1434
1395
  // The editor asks the room to ask: the room's own card, with questions read from the lines.
1435
- function askAboutCode({ from, to, text, anchor, dirty }) {
1396
+ // Several runs of lines picked apart are one question about all of them.
1397
+ function askAboutCode({ from, to, runs = [[from, to]], text, anchor, dirty }) {
1398
+ const [[lo, hi]] = runs;
1436
1399
  openAskCard({
1437
1400
  anchor,
1438
- head: from === to ? t('Line {n}', { n: from }) : t('Lines {from}–{to}', { from, to }),
1401
+ head: runs.length > 1 ? t('Lines {list}', { list: runs.map(([a, b]) => (a === b ? a : `${a}–${b}`)).join(', ') }) : lo === hi ? t('Line {n}', { n: lo }) : t('Lines {from}–{to}', { from: lo, to: hi }),
1439
1402
  suggestions: codeSuggestions(text, familyOf(viewerUI.path ?? '')?.id ?? null, viewerUI.path ?? ''),
1440
1403
  about: `${viewerUI.path ?? ''} ${text}`,
1441
1404
  actions: CODE_ACTIONS,
1442
- onAsk: (agentId, prompt) => askAboutLines({ from, to, prompt, dirty, agentId }),
1405
+ onAsk: (agentId, prompt) => askAboutLines({ runs, prompt, dirty, agentId }),
1443
1406
  });
1444
1407
  }
1445
1408
  function openEditor(line = null) {
@@ -2513,7 +2476,8 @@ function paintPorts(read) {
2513
2476
  row.type = 'button';
2514
2477
  // A server that sends no Content-Type used to leave the separator hanging: «:5173 node · 200 · ».
2515
2478
  const kind = found.html ? '' : (found.contentType ?? '').trim();
2516
- const what = `${found.command} · ${found.status}${kind ? ` · ${kind}` : ''}`;
2479
+ // Open to the whole network too: it opens here on 127.0.0.1, and the row says the rest.
2480
+ const what = `${found.command} · ${found.status}${kind ? ` · ${kind}` : ''}${found.network ? ` · ${t('your network can reach it too')}` : ''}`;
2517
2481
  row.append(el('i', 'ports-lamp'), el('b', null, `:${found.port}`), el('span', null, found.framable === false ? t('{what} · cannot be shown in here', { what }) : what));
2518
2482
  row.addEventListener('click', () => openPort(found));
2519
2483
  menu.append(row);
@@ -3230,9 +3194,13 @@ agentsCompact?.addEventListener('click', () => {
3230
3194
  if (!pop.hidden && pop.dataset.from === 'crew') closeAgentPop(); else openCrewPop(agentsCompact);
3231
3195
  });
3232
3196
 
3197
+ // Drawn again whenever the agents' state arrives, which is often and mostly the same: only a sphere
3198
+ // that changed is replaced. Emptying the row every time restarted every sphere's animation and, for
3199
+ // the instant it was empty, let the bar fit itself again — the «More» key came and went, and the
3200
+ // room blinked every so often for no reason (2026-10-21).
3233
3201
  function renderAgents() {
3234
3202
  renderAgentsCompact();
3235
- els.agents.replaceChildren();
3203
+ const fresh = [];
3236
3204
  for (const agent of state.agents.values()) {
3237
3205
  const percent = ringPercent(agent);
3238
3206
  const official = liveOfficial(agent);
@@ -3255,8 +3223,11 @@ function renderAgents() {
3255
3223
  : t('Usage: provider limit · {pct}% used', { pct: Math.round(official) }) + (agent.officialResetAt ? t(' · resets {when}', { when: fmtReset(agent.officialResetAt) }) : ''),
3256
3224
  agent.tokens ? t('{n} budget tokens in the local window', { n: agent.tokens.toLocaleString() }) : null,
3257
3225
  ].filter(Boolean).join('\n');
3258
- els.agents.append(node);
3226
+ fresh.push(node);
3259
3227
  }
3228
+ const now = [...els.agents.children];
3229
+ if (now.length !== fresh.length || typeof now[0]?.isEqualNode !== 'function') { els.agents.replaceChildren(...fresh); return; }
3230
+ fresh.forEach((node, index) => { if (!now[index].isEqualNode(node)) now[index].replaceWith(node); });
3260
3231
  }
3261
3232
 
3262
3233
  /* ---------- what the room may do, said once ---------- */
@@ -3393,7 +3364,8 @@ let modelMenuFor = null;
3393
3364
  async function ensureModels(id) {
3394
3365
  if (state.models[id]) return state.models[id];
3395
3366
  try {
3396
- const data = await fetch(`/api/models${id === 'opencode' ? '?opencode=1' : ''}`).then((response) => response.json());
3367
+ // OpenCode, Cursor and Gemini are asked for their own lists only when their chooser opens: each asks its CLI or its maker.
3368
+ const data = await fetch(`/api/models${['opencode', 'cursor', 'gemini'].includes(id) ? `?${id}=1` : ''}`).then((response) => response.json());
3397
3369
  state.models = { ...state.models, ...(data.models ?? {}) };
3398
3370
  takeEfforts(data.models);
3399
3371
  } catch { /* offline: fall back to whatever we know */ }
@@ -3435,7 +3407,7 @@ async function toggleModelMenu(id, anchor) {
3435
3407
  if (Array.isArray(info.groups) && info.groups.length) {
3436
3408
  for (const group of info.groups) {
3437
3409
  const head = el('div', `model-group${group.own ? ' own' : ''}`);
3438
- head.append(el('b', null, group.label), el('span', null, group.own ? t('OpenCode\'s own') : t('{n} models', { n: group.models.length })));
3410
+ head.append(el('b', null, group.label), el('span', null, group.own && id === 'opencode' ? t('OpenCode\'s own') : t('{n} models', { n: group.models.length })));
3439
3411
  list.append(head);
3440
3412
  for (const name of group.models) list.append(option(name, name.slice(name.indexOf('/') + 1)));
3441
3413
  }
@@ -3453,7 +3425,7 @@ async function toggleModelMenu(id, anchor) {
3453
3425
  manage.type = 'button';
3454
3426
  manage.addEventListener('click', () => { closeModelMenu(); openSettingsOn('agents', { anchor: 'sx-opencode' }); });
3455
3427
  modelMenu.append(manage);
3456
- } else if (info.note) modelMenu.append(el('div', 'model-note', info.note));
3428
+ } else if (info.note) modelMenu.append(el('div', 'model-note', t(info.note)));
3457
3429
  placeModelMenu(anchor);
3458
3430
  }
3459
3431
  function placeModelMenu(anchor) {
@@ -4343,7 +4315,7 @@ function bridgeCard(agent) {
4343
4315
  const detail = el('div', 'detail');
4344
4316
  if (agent.id === 'madre') detail.append(ollamaDetail(agent));
4345
4317
  else if (stage === 'missing') detail.append(t('Not on this computer.'));
4346
- else detail.append(`${agent.version ?? t('version unknown')}${session?.detail ? ` · ${session.detail}` : ''}${agent.route?.destination ? ` · ${t('route: {destination}', { destination: agent.route.destination })}` : ''}`);
4318
+ else detail.append(`${agent.version ?? t('version unknown')}${sessionDetail(session) ? ` · ${sessionDetail(session)}` : ''}${agent.route?.destination ? ` · ${t('route: {destination}', { destination: agent.route.destination })}` : ''}`);
4347
4319
  card.append(detail);
4348
4320
  // What is behind this door: the account it needs, and whether there is a way in without paying.
4349
4321
  if (agent.account) {
@@ -4354,7 +4326,7 @@ function bridgeCard(agent) {
4354
4326
  }
4355
4327
  const actions = el('div', 'actions');
4356
4328
  if (agent.id === 'madre') for (const button of ollamaActions()) actions.append(button);
4357
- else if (stage === 'missing' && agent.install) actions.append(bridgeInstallButton(agent));
4329
+ else if (stage === 'missing' && agent.install?.command) actions.append(bridgeInstallButton(agent));
4358
4330
  let reveal = null;
4359
4331
  if (stage === 'signed-out' || (stage === 'ready' && agent.login?.headless)) {
4360
4332
  // Every door the CLI has, not just the first one. Claude sells two accounts and MADRE used
@@ -5586,7 +5558,7 @@ function renderHandoff(event) {
5586
5558
  node.append(' → ');
5587
5559
  node.append(el('b', 'to', `@${toAgent}`));
5588
5560
  node.append(messageCount > 0
5589
- ? t(' · {n} messages carried', { n: messageCount }) + (omittedMessages ? t(' · {n} older stay in the record', { n: omittedMessages }) : '')
5561
+ ? (messageCount === 1 ? t(' · {n} message carried', { n: messageCount }) : t(' · {n} messages carried', { n: messageCount })) + (omittedMessages ? (omittedMessages === 1 ? t(' · {n} older stays in the record', { n: omittedMessages }) : t(' · {n} older stay in the record', { n: omittedMessages })) : '')
5590
5562
  : t(' · no prior context'));
5591
5563
  // A step of a plan says so; the kind is a word of the record, never shown as it is written.
5592
5564
  if (kind === 'delegated') node.append(t(' · delegated'));
@@ -6205,6 +6177,7 @@ function renderChoice(event) {
6205
6177
  const lead = index === pick;
6206
6178
  const button = el('button', `choice-option${lead ? ' recommended' : ''}`);
6207
6179
  button.type = 'button';
6180
+ button.dataset.option = option;
6208
6181
  button.append(el('span', 'choice-key', String(position + 1)), el('span', 'choice-text', option));
6209
6182
  // The permission this option needs, said before it is pressed. Pressing it arms that mode the
6210
6183
  // way the mode chip does: #1 and #2 at once, #3 and #4 through their own ceremony.
@@ -6249,6 +6222,23 @@ function renderChoice(event) {
6249
6222
  return node;
6250
6223
  }
6251
6224
 
6225
+ // What the human answered a decision with, kept in the history (2026-10-19): the next thing they
6226
+ // say after the card answers it. An option sent as it was is marked as theirs; anything else
6227
+ // they wrote still closes the card, with no option marked. Read from the ledger as it is
6228
+ // replayed, so the mark is there again after a reload or in another tab.
6229
+ function markChoiceAnswered(text) {
6230
+ const card = [...els.column.querySelectorAll('.choice:not(.run-request):not(.answered)')].at(-1);
6231
+ if (!card) return;
6232
+ card.classList.add('answered');
6233
+ const said = String(text ?? '').trim();
6234
+ const chosen = [...card.querySelectorAll('.choice-option')].find((button) => button.dataset.option?.trim() === said);
6235
+ if (!chosen) return;
6236
+ for (const other of card.querySelectorAll('.choice-option.picked')) other.classList.remove('picked');
6237
+ chosen.classList.add('chosen');
6238
+ const tags = chosen.querySelector('.choice-tags') ?? chosen.appendChild(el('span', 'choice-tags'));
6239
+ tags.prepend(el('span', 'choice-tag chosen-tag', t('YOUR CHOICE')));
6240
+ }
6241
+
6252
6242
  // An agent asked the human to run commands it cannot run in its mode. One button per line; the
6253
6243
  // press sends only which request and which line, and the server runs what it recorded the agent
6254
6244
  // asked for. A line the parser refused is shown with its reason and no button.
@@ -6383,15 +6373,15 @@ function markRun({ responseMessageId, index }, status, where = null, startedAt =
6383
6373
  updateRunClock(button);
6384
6374
  }
6385
6375
  if (status === 'serving' && where?.port) {
6376
+ // A server open to the whole network opens here too, on 127.0.0.1 (2026-10-18); the line says
6377
+ // that the network can reach it as well.
6386
6378
  live.append(el('span', 'where', where.network
6387
- ? t('serving on :{port} · open to your whole network, so the project will not open it', { port: where.port })
6379
+ ? t('serving on :{port} · your network can reach it too', { port: where.port })
6388
6380
  : t('serving on :{port}', { port: where.port })));
6389
- if (!where.network) {
6390
- const open = el('button', 'run-open', t('OPEN IN YOUR SERVERS'));
6391
- open.type = 'button';
6392
- open.addEventListener('click', () => { browserShow(); void browserOpen(`http://127.0.0.1:${where.port}/`); });
6393
- live.append(open);
6394
- }
6381
+ const open = el('button', 'run-open', t('OPEN IN YOUR SERVERS'));
6382
+ open.type = 'button';
6383
+ open.addEventListener('click', () => { browserShow(); void browserOpen(`http://127.0.0.1:${where.port}/`); });
6384
+ live.append(open);
6395
6385
  }
6396
6386
  const stop = el('button', 'run-stop', t('STOP'));
6397
6387
  stop.type = 'button';
@@ -6722,8 +6712,18 @@ function renderBishopAsk(event) {
6722
6712
  return node;
6723
6713
  }
6724
6714
 
6715
+ // What the room says to inform, not to alarm (2026-10-19): a plan still running, or EDIT held by
6716
+ // another agent, is how the room works, not a runaway. Said as a plain notice of Diagnostics: no
6717
+ // red, no capitals, and the brake is not armed for it (a plan has its own stop on its card).
6718
+ const CALM_ALERTS = new Set(['plan-active', 'control-busy']);
6725
6719
  function renderAlert(event) {
6726
- const { message } = event.payload;
6720
+ const { message, code } = event.payload;
6721
+ if (CALM_ALERTS.has(code)) {
6722
+ const node = el('div', 'system');
6723
+ node.append(el('b', null, t('Diagnostics › ')), resay(message.replace(/\s*Type STOPALL[^.]*\.?$/i, '').replace(/\s*STOPALL (halts|if)[^.]*\.?$/i, '')));
6724
+ state.lastSender = null;
6725
+ return node;
6726
+ }
6727
6727
  if (!replaying) { state.brakeArmed = true; updateStopAll(); }
6728
6728
  const node = el('div', 'system alert');
6729
6729
  node.append(el('b', null, t('Diagnostics › ')));
@@ -6864,6 +6864,13 @@ function renderFailure(event) {
6864
6864
  const node = el('div', `system fail${recovered ? ' recovered' : ''}`);
6865
6865
  node.append(el('span', 'label', recovered ? t('{label} · turn recovered after restart', { label: label(target) }) : t('{label} could not answer', { label: label(target) })));
6866
6866
  node.append(resay(error));
6867
+ // What the CLI printed stays as it printed it (resay.js), and when MADRE knows that failure the
6868
+ // card says, in the room's language, what it is and what to do (troubleshooting.js): a provider's
6869
+ // English sentence alone left the person guessing whether MADRE was broken (2026-10-19).
6870
+ const known = recovered ? null : diagnose(error, target).find((condition) => condition.severity === 'blocking');
6871
+ if (known) node.append(el('div', 'fail-known', `${known.title}. ${known.remedy}`));
6872
+ // OpenCode's provider refused (no credit, a dead key): the way out in one press, not in Settings.
6873
+ if (known && target === 'opencode' && OPENCODE_WAY_OUT.has(known.id) && state.agents.has('opencode')) node.append(openCodeWayOut({ messageId, failed: event.payload.ranOn ?? null }));
6867
6874
  // What the turn left before it was cut short, listed like any turn's and with its way back.
6868
6875
  if (partial) node.append(partialWork(partial));
6869
6876
  // Cut by the clock: one press raises this agent's limit and puts the request back in the box,
@@ -6902,6 +6909,58 @@ function partialWork(partial) {
6902
6909
  return wrap;
6903
6910
  }
6904
6911
 
6912
+ // THE WAY OUT OF A PROVIDER THAT REFUSED (2026-10-19). OpenCode sends a turn to the provider of
6913
+ // its model; when that provider has no credit left or the key is dead, the card offers a model
6914
+ // that works on this computer (src/opencode-health.mjs: the one that answered last, or one of
6915
+ // OpenCode's own free models) with two keys: send the same request again on it, or keep it as
6916
+ // OpenCode's default. Nothing changes on its own: the person sees which model and presses.
6917
+ const OPENCODE_WAY_OUT = new Set(['provider-credit-exhausted', 'opencode-default-provider']);
6918
+ let openCodeSuggest = null;
6919
+ function openCodeWayOut({ messageId, failed }) {
6920
+ const box = el('div', 'fail-actions');
6921
+ openCodeSuggest ??= fetch(`/api/agents/opencode/suggest${failed ? `?failed=${encodeURIComponent(failed)}` : ''}`).then((response) => (response.ok ? response.json() : null)).catch(() => null);
6922
+ void openCodeSuggest.then((answer) => {
6923
+ openCodeSuggest = null;
6924
+ const offer = answer?.suggestion;
6925
+ if (!offer?.model) return;
6926
+ const retry = el('button', 'retry-longer', t('RETRY ON {model}', { model: offer.model }));
6927
+ retry.type = 'button';
6928
+ retry.addEventListener('click', () => {
6929
+ retry.disabled = true;
6930
+ const asked = state.userMessages.get(messageId);
6931
+ rememberModel('opencode', offer.model);
6932
+ if (els.target.value !== 'opencode') els.target.value = 'opencode';
6933
+ renderPicker();
6934
+ els.input.value = asked?.text ?? '';
6935
+ autosize();
6936
+ // CHAT and CREATE go at once; EDIT and FULL ACCESS ask for their keys again, from the chip.
6937
+ if ((asked?.mode ?? 1) >= 3) {
6938
+ toast(t('Diagnostics › #{n} needs you to confirm again: choose it in the mode selector before sending.', { n: asked.mode }));
6939
+ els.input.focus();
6940
+ retry.textContent = t('IN THE BOX · SEND IT WHEN READY');
6941
+ return;
6942
+ }
6943
+ if ((asked?.mode ?? 1) === 2) setMode(2);
6944
+ if (els.input.value.trim()) els.composer.requestSubmit(); else els.input.focus();
6945
+ retry.textContent = t('SENT ON {model}', { model: offer.model });
6946
+ });
6947
+ const always = el('button', 'retry-longer quiet', t('USE IT ALWAYS'));
6948
+ always.type = 'button';
6949
+ always.title = t('OpenCode\'s default model becomes {model}, in every project.', { model: offer.model });
6950
+ always.addEventListener('click', async () => {
6951
+ always.disabled = true;
6952
+ try { await saveSettingNow({ opencode: { model: offer.model } }, t('OpenCode answers on {model} from now on.', { model: offer.model })); }
6953
+ catch (error) { toast(t('The setting was not saved: {error}', { error: error.message })); always.disabled = false; return; }
6954
+ // A model picked on the chip would still win over the default: the chip follows it.
6955
+ rememberModel('opencode', null);
6956
+ renderPicker();
6957
+ always.textContent = t('DEFAULT · {model}', { model: offer.model });
6958
+ });
6959
+ box.append(retry, always, el('span', 'fail-why', offer.why === 'worked' ? t('It answered on this computer last time.') : t('One of OpenCode\'s own free models: no account needed.')));
6960
+ });
6961
+ return box;
6962
+ }
6963
+
6905
6964
  function retryLonger({ messageId, target, timeout, partial }) {
6906
6965
  const seconds = nextTimeoutSeconds(timeout.ms);
6907
6966
  const retry = el('button', 'retry-longer', t('RETRY WITH MORE TIME · {n}s', { n: seconds }));
@@ -7063,6 +7122,7 @@ function renderEventNode(event) {
7063
7122
  return;
7064
7123
  case 'message.created':
7065
7124
  node = event.payload.role === 'user' ? renderUserMessage(event) : renderAssistantMessage(event);
7125
+ if (event.payload.role === 'user' && event.payload.sender === 'you') markChoiceAnswered(event.payload.text);
7066
7126
  if (event.payload.role !== 'user') attachCrossReads(event.payload.messageId, node);
7067
7127
  if (event.payload.role !== 'user') removeThinking(event.payload.parentMessageId);
7068
7128
  // The first thing said names a conversation; the tab and the list learn the name from the room.
@@ -7090,7 +7150,7 @@ function renderEventNode(event) {
7090
7150
  if (open && !replaying) void paintAshEconomy(open);
7091
7151
  return;
7092
7152
  }
7093
- case 'agent.completed': state.running.delete(event.payload.messageId); updateStopAll(); removeThinking(event.payload.messageId); if (!replaying) treeFollowWrites(); return;
7153
+ case 'agent.completed': state.running.delete(event.payload.messageId); updateStopAll(); removeThinking(event.payload.messageId); if (!replaying) { treeFollowWrites(); void notesAfterTurn(); } return;
7094
7154
  case 'files.touched': markTouched(event.payload.agent, event.payload.files, event.timestamp); if (!replaying) treeFollowWrites(); return;
7095
7155
  case 'message.failed': state.running.delete(event.payload.messageId); updateStopAll(); node = renderFailure(event); break;
7096
7156
  case 'handoff.created': node = renderHandoff(event); break;
@@ -7137,6 +7197,8 @@ function renderEventNode(event) {
7137
7197
  break;
7138
7198
  }
7139
7199
  case 'mother.alert': node = renderMotherAlert(event); break;
7200
+ case 'reminder.offered': node = renderReminderOffer(event.payload); break;
7201
+ case 'reminder.answered': settleReminderOffer(event.payload); if (!replaying) void loadReminders(); return;
7140
7202
  case 'sentinel.report': state.reports.set(event.payload.id, { ...event.payload }); if (!replaying) { renderMotherSentinel(); toast(t('Diagnostics › {what} was recorded by the failure monitor. Open Diagnostics to report it.', { what: event.payload.kind === 'crash' ? t('a crash') : t('an unexpected problem') })); } return;
7141
7203
  case 'servers.changed': paintPorts(event.payload); return;
7142
7204
  case 'server.stopped': if (!replaying) serverStopped(event.payload); return;
@@ -7475,7 +7537,7 @@ async function switchLanguage() {
7475
7537
  // Each choice is a data attribute on the root that styles.css reads under #messages only. The
7476
7538
  // first value of each list is the room as it always was, and is written as no attribute at all.
7477
7539
  const LOOKS = {
7478
- accent: { key: 'pulse.accent', values: ['madre', 'mountain', 'caribbean', 'phantom', 'malbec', 'dijon', 'pacific', 'love', 'sierra', 'pitahaya', 'papaya', 'agave', 'dinamo', 'marina', 'pulso', 'leal', 'dulce'] },
7540
+ accent: { key: 'pulse.accent', values: ['madre', 'mountain', 'caribbean', 'phantom', 'malbec', 'dijon', 'pacific', 'love', 'sierra', 'pitahaya', 'papaya', 'agave', 'dinamo', 'marina', 'pulso', 'leal', 'dulce', 'marmol', 'durazno', 'pistache', 'petalo'] },
7479
7541
  bubbles: { key: 'pulse.bubbles', values: ['comfortable', 'large', 'compact', 'fitted'] },
7480
7542
  text: { key: 'pulse.text', values: ['comfortable', 'larger', 'smaller', 'visual'] },
7481
7543
  // Last, the person's own picture (public/wallpaper.js): a choice only once there is one.
@@ -7509,7 +7571,7 @@ function saveTune(name, value) {
7509
7571
  applyTune(name, value); pushLooks();
7510
7572
  }
7511
7573
  const LOOK_WORDS = {
7512
- accent: { madre: () => t('Madre green'), mountain: () => t('Mountain green'), caribbean: () => t('Caribbean blue'), phantom: () => t('Phantom purple'), malbec: () => t('Malbec red'), dijon: () => t('Dijon yellow'), pacific: () => t('Pacific blue'), love: () => t('Love pink'), sierra: () => t('Sierra blue'), pitahaya: () => 'Pitahaya', papaya: () => 'Papaya', agave: () => 'Agave', dinamo: () => t('Dynamo black'), marina: () => t('Marina blue'), pulso: () => t('Pulse green'), leal: () => t('Loyal orange'), dulce: () => t('Sweet yellow') },
7574
+ accent: { madre: () => t('Madre green'), mountain: () => t('Mountain green'), caribbean: () => t('Caribbean blue'), phantom: () => t('Phantom purple'), malbec: () => t('Malbec red'), dijon: () => t('Dijon yellow'), pacific: () => t('Pacific blue'), love: () => t('Love pink'), sierra: () => t('Sierra blue'), pitahaya: () => 'Pitahaya', papaya: () => 'Papaya', agave: () => 'Agave', dinamo: () => t('Dynamo black'), marina: () => t('Marina blue'), pulso: () => t('Pulse green'), leal: () => t('Loyal orange'), dulce: () => t('Sweet yellow'), marmol: () => t('Marble gray'), durazno: () => t('Peach orange'), pistache: () => t('Pistachio green'), petalo: () => t('Petal pink') },
7513
7575
  bubbles: { comfortable: () => t('Comfortable'), large: () => t('Large'), compact: () => t('Compact'), fitted: () => t('Fitted') },
7514
7576
  text: { comfortable: () => t('Comfortable'), larger: () => t('Larger'), smaller: () => t('Smaller'), visual: () => t('Visual') },
7515
7577
  wallpaper: { default: () => t('Default'), jarrito: () => 'Jarrito', canela: () => 'Canela', paradise: () => t('Paradise'), ventura: () => 'Ventura', magna: () => 'Magna', biznaga: () => 'Biznaga', oceano: () => 'Oceano', quila: () => 'Quila', xico: () => 'Xico', tropical: () => 'Tropical', tradicion: () => 'Tradicion', urbania: () => 'Urbania', custom: () => t('Your picture') },
@@ -7550,13 +7612,19 @@ window.addEventListener?.('storage', (event) => {
7550
7612
  // phone's bridge.
7551
7613
  // The wallpaper is each page's own (2026-10-13): this project keeps the one chosen here, Home the
7552
7614
  // one chosen in Home (src/looks.mjs, `rooms`). The rest of the looks are shared.
7553
- const SHARED_LOOKS = ['pulse.theme', 'pulse.accent', 'pulse.wallpaper.style', 'pulse.wallpaper.veil', 'pulse.wallpaper.blur', 'pulse.bubbles', 'pulse.text', 'pulse.neural'];
7615
+ // The accent too, since 1.0.5: chosen here it is this project's, and Home's is the one a project
7616
+ // wears until it has its own.
7617
+ const SHARED_LOOKS = ['pulse.theme', 'pulse.wallpaper.style', 'pulse.wallpaper.veil', 'pulse.wallpaper.blur', 'pulse.bubbles', 'pulse.text', 'pulse.neural'];
7554
7618
  let booted = false;
7555
7619
  let looksPush = 0;
7556
7620
  // Saved for this project alone, on the server, so it outlives the port the page is served on.
7557
7621
  function saveOwnWallpaper(value) {
7558
7622
  void fetch('/api/looks/room', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ wallpaper: value }) }).catch(() => null);
7559
7623
  }
7624
+ // Kept as chosen, the default included: «Madre green» here is a choice, Home's may be another.
7625
+ function saveOwnAccent(value) {
7626
+ void fetch('/api/looks/room', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ accent: value ?? LOOKS.accent.values[0] }) }).catch(() => null);
7627
+ }
7560
7628
  function pushLooks() {
7561
7629
  if (SPLIT_CHAT) return;
7562
7630
  clearTimeout(looksPush);
@@ -7576,12 +7644,14 @@ async function pullLooks() {
7576
7644
  // Before a project had its own, it wore the shared one: that is where it starts.
7577
7645
  let wall = answer.own?.wallpaper ?? answer.looks['pulse.wallpaper'] ?? null;
7578
7646
  if (wall === CUSTOM_WALL && !answer.custom) wall = null;
7647
+ // Its own accent, or Home's while it has none.
7648
+ const accent = answer.own?.accent ?? answer.looks['pulse.accent'] ?? null;
7579
7649
  try {
7580
7650
  // Nothing kept yet: the first page that has a choice of its own hands it to the others.
7581
7651
  if (!answer.saved) { if (SHARED_LOOKS.some((key) => localStorage.getItem(key) !== null)) pushLooks(); return; }
7582
7652
  let changed = false;
7583
- for (const key of [...SHARED_LOOKS, 'pulse.wallpaper']) {
7584
- const value = key === 'pulse.wallpaper' ? (wall === 'default' ? null : wall) : answer.looks[key] ?? null;
7653
+ for (const key of [...SHARED_LOOKS, 'pulse.wallpaper', 'pulse.accent']) {
7654
+ const value = key === 'pulse.wallpaper' ? (wall === 'default' ? null : wall) : key === 'pulse.accent' ? (accent === LOOKS.accent.values[0] ? null : accent) : answer.looks[key] ?? null;
7585
7655
  if (localStorage.getItem(key) === value) continue;
7586
7656
  if (value === null) localStorage.removeItem(key); else localStorage.setItem(key, value);
7587
7657
  changed = true;
@@ -7613,6 +7683,7 @@ function saveLook(name, value) {
7613
7683
  } catch { /* the choice lasts as long as the page */ }
7614
7684
  applyLook(name, value);
7615
7685
  if (name === 'wallpaper') saveOwnWallpaper(value);
7686
+ if (name === 'accent') saveOwnAccent(value);
7616
7687
  pushLooks();
7617
7688
  }
7618
7689
  // What is picked on the sheet is a draft: the preview wears it, the room does not, until ACCEPT.
@@ -7660,6 +7731,66 @@ function acceptCustom() {
7660
7731
  if (draft.language !== language()) { void switchLanguage(); return; }
7661
7732
  openCustom(false);
7662
7733
  }
7734
+ // The preview of the looks is the conversation itself, small: the markup the room draws — a line of
7735
+ // the room, an answer with its chips, your message and its delivery — in a frame that loads the
7736
+ // room's own stylesheet and wears the draft on its root. Its ground, its planes and its bubbles are
7737
+ // the ones the conversation has today. A copy of its own, with its own rules, kept drawing the
7738
+ // canvas of before (2026-10-20).
7739
+ const LOOK_FRAME_CSS = 'html,body{margin:0;height:100%;overflow:hidden;background:transparent}.shell{position:relative;height:100%;min-height:0;pointer-events:none}#messages{height:100%;overflow:hidden;padding:12px 14px}#messages .thread-inner{max-width:none;display:flex;flex-direction:column;gap:12px;padding:6px 0 0}#messages .thread-inner>*{margin-top:0!important;margin-bottom:0!important}#messages .system{align-self:center}#messages .empty{display:none}html{zoom:.9}';
7740
+ const quoted = (value) => String(value).replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;');
7741
+ function lookPreview(draft) {
7742
+ const root = document.documentElement;
7743
+ const attributes = new Map([...root.attributes].filter((one) => one.name !== 'class').map((one) => [one.name, one.value]));
7744
+ for (const name of Object.keys(LOOKS)) {
7745
+ const key = `data-${name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}`;
7746
+ if (draft[name] === LOOKS[name].values[0]) attributes.delete(key); else attributes.set(key, draft[name]);
7747
+ }
7748
+ // The draft's ground too: light, dark, or the system's when automatic.
7749
+ if (draft.theme) {
7750
+ attributes.set('data-theme', draft.theme);
7751
+ attributes.set('data-scheme', draft.theme === 'auto' ? (window.matchMedia?.('(prefers-color-scheme: light)').matches ? 'light' : 'dark') : draft.theme);
7752
+ }
7753
+ const holder = el('div');
7754
+ holder.setAttribute('style', root.getAttribute('style') ?? '');
7755
+ for (const name of Object.keys(TUNES)) TUNES[name].apply(holder, draft[name]);
7756
+ attributes.set('style', holder.getAttribute('style') ?? '');
7757
+
7758
+ const inner = el('div', 'thread-inner');
7759
+ const line = el('div', 'system');
7760
+ line.append(el('b', null, t('MEMORY')), ' ', t('Read 8 exchanges and kept 5 memories.'));
7761
+ const agent = paint(el('article', 'row assistant'), 'codex');
7762
+ const col = el('div', 'col');
7763
+ const who = el('div', 'who');
7764
+ who.append(el('span', null, 'CODEX'), el('span', 'badge mode m2', `#2 ${MODES[2].label}`), el('span', 'badge ash', t('TOKEN SAVER')));
7765
+ const bubble = el('div', 'bubble');
7766
+ const words = el('p');
7767
+ words.append(t('The project keeps what you decide. '), el('b', null, t('Bold reads like this')), ' · ', el('code', null, 'npm test'));
7768
+ const foot = el('div', 'bubble-foot');
7769
+ const stamp = el('div', 'stamp');
7770
+ stamp.append(el('span', null, '08:46 PM'));
7771
+ foot.append(stamp);
7772
+ bubble.append(words, foot);
7773
+ col.append(who, bubble);
7774
+ agent.append(avatar('codex', { size: 28 }), col);
7775
+ const you = el('article', 'row user');
7776
+ const yours = el('div', 'col');
7777
+ const yourWho = el('div', 'who');
7778
+ yourWho.append(el('b', null, t('YOU · AGENTS')));
7779
+ const delivered = paint(el('div', 'stamp'), 'codex');
7780
+ delivered.append(el('span', 'to', '→ @codex'), el('span', null, '08:46 PM'));
7781
+ yours.append(yourWho, el('div', 'bubble', t('Show me how my messages look.')), delivered);
7782
+ you.append(yours);
7783
+ inner.append(line, agent, you);
7784
+
7785
+ const frame = el('iframe', 'look-frame');
7786
+ frame.setAttribute('aria-hidden', 'true');
7787
+ frame.tabIndex = -1;
7788
+ const opening = [...attributes].map(([name, value]) => `${name}="${quoted(value)}"`).join(' ');
7789
+ frame.srcdoc = `<!doctype html><html ${opening}><head><meta charset="utf-8"><link rel="stylesheet" href="/styles.css"><style>${LOOK_FRAME_CSS}</style></head><body><div class="shell"><main id="messages" class="thread">${inner.outerHTML}</main></div></body></html>`;
7790
+ // Shown once it is painted, never as an empty box between two choices.
7791
+ frame.addEventListener('load', () => frame.classList.add('ready'));
7792
+ return frame;
7793
+ }
7663
7794
  // The sheet is a window and only a window: a preview of the conversation on one side, the choices
7664
7795
  // on the other, and below a narrow width one above the other.
7665
7796
  function drawCustom() {
@@ -7689,24 +7820,8 @@ function drawCustom() {
7689
7820
  return row;
7690
7821
  };
7691
7822
 
7692
- // What the choices do, before they are accepted: one line from the crew, one from you, in the
7693
- // same bubbles the conversation draws, wearing the draft.
7694
- const preview = el('div', 'look-preview');
7695
- preview.setAttribute('aria-hidden', 'true');
7696
- for (const name of Object.keys(LOOKS)) preview.dataset[name] = draft[name];
7697
- for (const name of Object.keys(TUNES)) TUNES[name].apply(preview, draft[name]);
7698
- // The preview stands on the draft's ground too: light, dark, or the system's when automatic.
7699
- preview.dataset.scheme = draft.theme === 'auto' ? (window.matchMedia?.('(prefers-color-scheme: light)').matches ? 'light' : 'dark') : draft.theme;
7700
- // The small print too: a line of the room, who answered with its chips, and the delivery line,
7701
- // because those are the words a wallpaper tests first.
7702
- const line = el('div', 'system');
7703
- line.append(el('b', null, t('MEMORY')), t('Read 8 exchanges and kept 5 memories.'));
7704
- const agent = el('div', 'row assistant');
7705
- agent.append(el('span', 'avatar'), (() => { const col = el('div', 'col'); const who = el('div', 'who'); who.append(el('span', null, 'CODEX'), el('span', 'badge mode m2', `#2 ${MODES[2].label}`), el('span', 'badge ash', t('TOKEN SAVER'))); col.append(who); const bubble = el('div', 'bubble'); bubble.append(t('The project keeps what you decide. '), el('b', null, t('Bold reads like this')), ' · ', el('code', null, 'npm test')); col.append(bubble); return col; })());
7706
- const you = el('div', 'row user');
7707
- you.append((() => { const col = el('div', 'col'); col.append(el('div', 'bubble', t('Show me how my messages look.'))); const stamp = el('div', 'stamp'); stamp.append(el('span', 'to', '→ @codex'), el('span', null, '08:46 PM')); col.append(stamp); return col; })());
7708
- const button = el('span', 'look-button', t('A BUTTON'));
7709
- preview.append(line, agent, you, button);
7823
+ // What the choices do, before they are accepted: the conversation itself, small (lookPreview).
7824
+ const preview = lookPreview(draft);
7710
7825
  const look = el('div', 'custom-look');
7711
7826
  look.append(el('b', 'custom-kicker', t('PREVIEW')), preview);
7712
7827
 
@@ -7768,7 +7883,9 @@ function drawCustom() {
7768
7883
  input.addEventListener('input', () => {
7769
7884
  const v = Number(input.value);
7770
7885
  customWindow.draft = { ...(customWindow.draft ?? currentLooks()), [name]: v };
7771
- tune.apply(preview, v);
7886
+ // The preview is a frame: the dial moves its own root while it is dragged.
7887
+ const frameRoot = preview.contentDocument?.documentElement;
7888
+ if (frameRoot) tune.apply(frameRoot, v);
7772
7889
  if (customWindow.instant) applyTune(name, v);
7773
7890
  value.textContent = shown(v);
7774
7891
  input.style.setProperty('--fill', `${((v - tune.min) / (tune.max - tune.min)) * 100}%`);
@@ -7946,28 +8063,31 @@ customWindow.node?.addEventListener('close', () => { customButton?.setAttribute(
7946
8063
  const SETTINGS_SECTIONS = [
7947
8064
  ['You', 'How it looks, how it works and your files', ['look', 'room', 'files']],
7948
8065
  ['The agents', 'Who works, what they remember and which outside tools they use', ['agents', 'memory', 'local', 'mcp']],
7949
- ['System', 'What agents may do, privacy and updates', ['permissions', 'privacy', 'release']],
8066
+ ['System', 'What agents may do, privacy, updates and the manual', ['permissions', 'privacy', 'release', 'manual']],
7950
8067
  ];
7951
8068
  const SETTINGS_CATS = {
7952
8069
  look: { name: 'Appearance', color: '#8e75e8', icon: '<circle cx="10" cy="10" r="6.5" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M10 3.5a6.5 6.5 0 0 1 0 13z" fill="currentColor"/>' },
7953
8070
  room: { name: 'Work and limits', color: '#d97757', icon: '<rect x="3.5" y="3.5" width="5.5" height="5.5" rx="1.4" fill="none" stroke="currentColor" stroke-width="1.6"/><rect x="11" y="3.5" width="5.5" height="5.5" rx="1.4" fill="none" stroke="currentColor" stroke-width="1.6"/><rect x="3.5" y="11" width="5.5" height="5.5" rx="1.4" fill="none" stroke="currentColor" stroke-width="1.6"/><rect x="11" y="11" width="5.5" height="5.5" rx="1.4" fill="none" stroke="currentColor" stroke-width="1.6"/>' },
7954
8071
  agents: { name: 'Agents', color: '#10a37f', icon: '<circle cx="7" cy="8" r="2.6" fill="none" stroke="currentColor" stroke-width="1.6"/><circle cx="13.6" cy="8" r="2.6" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M2.8 16c.6-2.3 2.2-3.6 4.2-3.6s3.6 1.3 4.2 3.6M9.6 13c.9-.4 2.4-.6 4-.6 2 0 3.6 1.3 4.2 3.6" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>' },
7955
- memory: { name: 'What it remembers', color: '#3fb6d9', icon: '<rect x="5" y="5" width="10" height="10" rx="1.8" fill="none" stroke="currentColor" stroke-width="1.6"/><rect x="8.1" y="8.1" width="3.8" height="3.8" rx=".6" fill="none" stroke="currentColor" stroke-width="1.4"/><path d="M8 2.5V5M12 2.5V5M8 15v2.5M12 15v2.5M2.5 8H5M2.5 12H5M15 8h2.5M15 12h2.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>' },
8072
+ memory: { name: 'What it remembers', color: '#3fb6d9', icon: '<rect x="5" y="5" width="10" height="10" rx="1.8" fill="none" stroke="currentColor" stroke-width="1.6"/><rect x="8.1" y="8.1" width="3.8" height="3.8" rx=".6" fill="none" stroke="currentColor" stroke-width="1.4"/><path class="ic-pins" d="M8 2.5V5M12 2.5V5M8 15v2.5M12 15v2.5M2.5 8H5M2.5 12H5M15 8h2.5M15 12h2.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>' },
7956
8073
  // Local AI, also here and not only in Modules (2026-10-16): the same card, and what this
7957
8074
  // computer can run and train with it.
7958
- local: { name: 'Local AI', color: '#7f77dd', icon: '<rect x="5" y="5" width="10" height="10" rx="2.4" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M8 2.6v2.4M12 2.6v2.4M8 15v2.4M12 15v2.4M2.6 8h2.4M2.6 12h2.4M15 8h2.4M15 12h2.4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="10" cy="10" r="1.8" fill="currentColor"/>' },
8075
+ local: { name: 'Local AI', color: '#7f77dd', icon: '<g class="ic-net" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round"><path stroke-width=".8" d="M6.47 5.59L9.13 4.31M6.33 7.43L8.97 9.21M5.70 8.01L9.60 14.99M9.88 5.11L5.62 12.59M11.92 4.97L14.98 9.03M11.90 10.21L14.25 10.37M10.35 11.70L10.44 14.75M6.41 14.91L8.79 15.89M14.85 11.86L11.75 15.24"/><circle cx="4.8" cy="6.4" r="1.25"/><circle cx="10.8" cy="3.5" r="1.25"/><circle cx="10.3" cy="10.1" r="1.0"/><circle cx="16.1" cy="10.5" r="1.25"/><circle cx="4.7" cy="14.2" r="1.25"/><circle cx="10.5" cy="16.6" r="1.25"/></g>' },
7959
8076
  mcp: { name: 'Outside tools (MCP)', color: '#5b8def', icon: '<path d="M7.2 3.2v3.3M12.8 3.2v3.3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><path d="M5.2 6.5h9.6v2.4a4.8 4.8 0 0 1-9.6 0z" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/><path d="M10 13.7v3.1" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>' },
7960
8077
  files: { name: 'Files and local sites', color: '#c8955a', icon: '<path d="M3.5 6.2c0-.9.7-1.6 1.6-1.6h3l1.6 1.8h5.2c.9 0 1.6.7 1.6 1.6v6.4c0 .9-.7 1.6-1.6 1.6H5.1c-.9 0-1.6-.7-1.6-1.6z" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/>' },
7961
8078
  permissions: { name: 'Permissions', color: '#e5484d', icon: '<path d="M10 2.8 4.2 5v4.6c0 3.6 2.4 6.4 5.8 7.6 3.4-1.2 5.8-4 5.8-7.6V5z" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/><circle cx="10" cy="9" r="1.7" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M10 10.7v2.6" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>' },
7962
8079
  privacy: { name: 'Privacy', color: '#d4a72c', icon: '<rect x="4.5" y="8.5" width="11" height="8" rx="2" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M7 8.5V6.6a3 3 0 0 1 6 0v1.9" fill="none" stroke="currentColor" stroke-width="1.6"/>' },
7963
8080
  release: { name: 'Updates and errors', color: '#4caf3a', icon: '<path d="M15.6 10a5.6 5.6 0 1 1-1.64-3.96" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><path d="M15.7 3.6v3.2h-3.2" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>' },
8081
+ // The user manual (1.0.5): it opens on its own page, read here or in PDF (public/manual.js).
8082
+ manual: { name: 'User manual', color: '#2f9e6a', icon: '<path d="M4 4.5h4.5a1.5 1.5 0 0 1 1.5 1.5v10a1.5 1.5 0 0 0-1.5-1.5H4zM16 4.5h-4.5A1.5 1.5 0 0 0 10 6v10a1.5 1.5 0 0 1 1.5-1.5H16z" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/>' },
7964
8083
  };
7965
- const SETTINGS_ORDER = ['look', 'room', 'files', 'agents', 'memory', 'local', 'mcp', 'permissions', 'privacy', 'release'];
8084
+ const SETTINGS_ORDER = ['look', 'room', 'files', 'agents', 'memory', 'local', 'mcp', 'permissions', 'privacy', 'release', 'manual'];
7966
8085
  // The words the search knows, each pointing to the category that holds it and to the words on the
7967
8086
  // screen that carry it there, so a result opens the category and lands on the setting.
7968
8087
  const SETTINGS_INDEX = [
7969
8088
  ['look', 'Preview'], ['look', 'Language'], ['look', 'Theme'], ['look', 'Wallpaper'], ['look', 'Accent'], ['look', 'Bubbles'], ['look', 'Text'],
7970
8089
  ['room', 'Several at once'], ['room', 'Notifications'], ['room', 'Conversations at once'], ['room', 'Answers per conversation'], ['room', 'Agents may make plans'], ['room', 'Steps per plan'],
8090
+ ['manual', 'User manual'], ['manual', 'PDF'],
7971
8091
  ['files', 'Files'], ['files', 'Your servers'], ['files', 'File viewer'], ['files', 'Preview'], ['files', "Test browser"],
7972
8092
  ['room', 'Usage limit per agent'], ['room', 'Default time limit'], ['room', 'Silence limit'], ['room', 'Retries'], ['room', 'Model'],
7973
8093
  ['agents', 'Max mode'], ['agents', 'Starting mode'], ['agents', 'Web access'], ['agents', 'Generate images'], ['agents', 'Time limit'], ['agents', 'Sign in'],
@@ -7985,7 +8105,11 @@ const settingsIcon = (id) => { const span = el('span', 'settings-icon'); span.in
7985
8105
 
7986
8106
  // How each category stands, in a line, from what the room already knows. Nothing is guessed: a
7987
8107
  // figure that has not been read yet says so.
8108
+ // The user manual: its own page in the room's language, and the same manual in PDF.
8109
+ function openManual() { window.open(`/manual?lang=${language()}`, '_blank', 'noopener'); }
8110
+ const manualPdf = () => `/assets/manual/madre-manual-${language()}.pdf`;
7988
8111
  function settingsStatus(id) {
8112
+ if (id === 'manual') return { line: t('Every part of MADRE, with pictures and each step marked. Also as a PDF.') };
7989
8113
  const data = settingsUI.data;
7990
8114
  if (id === 'look') {
7991
8115
  const theme = { auto: t('Automatic'), light: t('Light'), dark: t('Dark') }[themeMode] ?? themeMode;
@@ -8053,6 +8177,13 @@ function settingsQuick(id) {
8053
8177
  wrap.append(box, el('i'));
8054
8178
  return wrap;
8055
8179
  };
8180
+ if (id === 'manual') {
8181
+ const pdf = el('a', 'sx-btn settings-manual-pdf', t('PDF'));
8182
+ pdf.href = manualPdf();
8183
+ pdf.setAttribute('download', '');
8184
+ pdf.addEventListener('click', (event) => event.stopPropagation());
8185
+ add(t('Download it to print or share'), pdf);
8186
+ }
8056
8187
  if (id === 'look') {
8057
8188
  const seg = el('div', 'settings-seg');
8058
8189
  for (const [value, word] of [['auto', t('Auto')], ['light', t('Light')], ['dark', t('Dark')]]) {
@@ -8316,7 +8447,7 @@ function settingsCard(id) {
8316
8447
  if (status.warn) card.append(el('p', 'settings-warn', status.warn));
8317
8448
  const quick = settingsQuick(id);
8318
8449
  if (quick) card.append(quick);
8319
- const go = () => openSettingsCategory(id);
8450
+ const go = () => (id === 'manual' ? openManual() : openSettingsCategory(id));
8320
8451
  card.addEventListener('click', go);
8321
8452
  card.addEventListener('keydown', (event) => { if (event.key === 'Enter' || event.key === ' ') { event.preventDefault(); go(); } });
8322
8453
  return card;
@@ -8507,8 +8638,11 @@ function syncSettingsCards() {
8507
8638
  }
8508
8639
 
8509
8640
  function openSettingsCategory(id, landOn = null) {
8641
+ // The manual is a page of its own, not a panel: found by the search, it opens there.
8642
+ if (id === 'manual') { openManual(); return; }
8510
8643
  settingsWindow.open = id;
8511
8644
  drawSettings();
8645
+ if (id === 'mcp') firstTouch('mcp');
8512
8646
  if (!landOn) return;
8513
8647
  // Land on the setting the search found, once its panel has drawn.
8514
8648
  let tries = 0;
@@ -9335,7 +9469,6 @@ function sideGrip(surface) {
9335
9469
  event.stopPropagation();
9336
9470
  try { grip.setPointerCapture(event.pointerId); } catch { /* a pointer the page no longer holds */ }
9337
9471
  shellBox.classList.add('resizing-panel');
9338
- holdingWindow('sizing-window', true);
9339
9472
  let frame = 0;
9340
9473
  const move = (moving) => {
9341
9474
  cancelAnimationFrame(frame);
@@ -9345,16 +9478,20 @@ function sideGrip(surface) {
9345
9478
  });
9346
9479
  };
9347
9480
  const done = () => {
9481
+ cancelAnimationFrame(frame);
9348
9482
  grip.removeEventListener('pointermove', move);
9349
9483
  grip.removeEventListener('pointerup', done);
9350
9484
  grip.removeEventListener('pointercancel', done);
9485
+ grip.removeEventListener('lostpointercapture', done);
9351
9486
  shellBox.classList.remove('resizing-panel');
9352
9487
  holdingWindow('sizing-window', false);
9353
9488
  rememberSides();
9354
9489
  };
9490
+ holdingWindow('sizing-window', true, 'col-resize', done);
9355
9491
  grip.addEventListener('pointermove', move);
9356
9492
  grip.addEventListener('pointerup', done);
9357
9493
  grip.addEventListener('pointercancel', done);
9494
+ grip.addEventListener('lostpointercapture', done);
9358
9495
  });
9359
9496
  grip.addEventListener('dblclick', () => { delete sideWidths[surface.key]; rememberSides(); layoutPanels(); });
9360
9497
  }
@@ -9541,8 +9678,11 @@ function paintDepth() {
9541
9678
  one.classList.toggle('behind', depth > 0);
9542
9679
  });
9543
9680
  const desk = deskFocus || !open.length ? 0 : Math.min(3, open.length);
9681
+ // How deep is the veil's own: a variable on the root is inherited by every element of the page,
9682
+ // and changing it restyled all of them — a long file in Code included — each time a window
9683
+ // opened, closed or stopped overlapping another.
9544
9684
  const root = document.documentElement;
9545
- if (desk) root.style.setProperty('--desk-depth', String(desk)); else root.style.removeProperty('--desk-depth');
9685
+ if (desk) deskVeil.style.setProperty('--desk-depth', String(desk)); else deskVeil.style.removeProperty('--desk-depth');
9546
9686
  root.classList.toggle('desk-behind', desk > 0);
9547
9687
  }
9548
9688
  // Read once a frame, however many things changed in it.
@@ -9574,11 +9714,17 @@ function dropWindow(node) {
9574
9714
  windowStack.at(-1)?.classList.add('front');
9575
9715
  paintDepth();
9576
9716
  }
9577
- // The desktop is clear while it is being used: while you write in the box, or while the windows
9578
- // stand aside at the edges for it. The moment neither is true — you press somewhere else, the
9579
- // windows come back over it — it goes back to its layer. Pressing it once never left it clear for
9580
- // good: that was a desktop that stayed sharp under windows that had come back.
9581
- const writing = () => Boolean(document.activeElement?.closest?.('#composer'));
9717
+ // Where you work: the conversation, and whatever is docked beside it — Code in its half, the files,
9718
+ // the conversations, the browser. A window over one of them is in the way of it (2026-10-20).
9719
+ const DOCKED = '.tree:not(.window), dialog.viewer.split, .browser-dock:not(.window)';
9720
+ const WORK_AREAS = `.shell > .thread, ${DOCKED}`;
9721
+ function workAreas() { return [...document.querySelectorAll(WORK_AREAS)].filter((node) => !node.hidden && node.getClientRects().length); }
9722
+ // The desktop is clear while it is being used: while you write in the box or work in what is docked
9723
+ // beside it — the code you edit is never read through the veil — or while the windows stand aside
9724
+ // at the edges for it. The moment neither is true — you press somewhere else, the windows come back
9725
+ // over it — it goes back to its layer. Pressing it once never left it clear for good: that was a
9726
+ // desktop that stayed sharp under windows that had come back.
9727
+ const writing = () => Boolean(document.activeElement?.closest?.(`#composer, ${DOCKED}`));
9582
9728
  function deskInUse() { focusDesk(writing() || (windowsAside && !windowsUp().length)); }
9583
9729
  if (!SPLIT_CHAT) {
9584
9730
  document.addEventListener?.('focusin', deskInUse);
@@ -9594,7 +9740,8 @@ document.addEventListener?.('pointerdown', (event) => {
9594
9740
  }, true);
9595
9741
  /* ---------- the room shown: windows to the edges ---------- */
9596
9742
 
9597
- // A press in the conversation's own box says «this, now». Every window lying over the conversation
9743
+ // A press in the conversation's own box says «this, now», and so does a press or the first key typed in
9744
+ // what is docked beside it (Code, the files, the browser). Every window lying over that place
9598
9745
  // slides to its nearer edge, one just after another, the way a desktop is shown, and leaves a strip
9599
9746
  // of itself in view so it is plain where it went. Pressing a strip, opening a window or the keyboard
9600
9747
  // reaching into one brings back that window only — opening the Finder from the bar is not asking for
@@ -9603,19 +9750,24 @@ document.addEventListener?.('pointerdown', (event) => {
9603
9750
  const ASIDE_PEEK = 30;
9604
9751
  let windowsAside = false;
9605
9752
  let asideSettle = 0;
9606
- function overTheRoom(node) {
9753
+ // Over the conversation or over what is docked beside it: Code, the files, the browser.
9754
+ function overTheRoom(node, areas = workAreas()) {
9607
9755
  const box = node.getBoundingClientRect();
9608
- const room = threadBox?.getBoundingClientRect();
9609
- if (!room?.width || !box.width) return false;
9610
- return box.right > room.left + 8 && box.left < room.right - 8;
9756
+ if (!box.width) return false;
9757
+ return areas.some((area) => {
9758
+ const room = area.getBoundingClientRect();
9759
+ return room.width > 0 && box.right > room.left + 8 && box.left < room.right - 8 && box.bottom > room.top + 8 && box.top < room.bottom - 8;
9760
+ });
9611
9761
  }
9612
- function windowsUp() {
9613
- return [...document.querySelectorAll(WINDOW_SELECTOR)].filter((node) => !node.hidden && node.getClientRects().length && !node.classList.contains('aside') && overTheRoom(node));
9762
+ function windowsUp(areas = workAreas()) {
9763
+ return [...document.querySelectorAll(WINDOW_SELECTOR)].filter((node) => !node.hidden && node.getClientRects().length && !node.classList.contains('aside') && overTheRoom(node, areas));
9614
9764
  }
9615
- function setWindowsAside(on, { always = false, only = null } = {}) {
9765
+ // `over`: only the windows lying over these places move — the box moves what covers the
9766
+ // conversation, the code what covers the code; the desktop pressed, what covers any of them.
9767
+ function setWindowsAside(on, { always = false, only = null, over = null } = {}) {
9616
9768
  if (!on && !windowsAside) return;
9617
9769
  if (on) {
9618
- const moving = windowsUp();
9770
+ const moving = over ? windowsUp(over.filter(Boolean)) : windowsUp();
9619
9771
  // Shown on purpose, the desktop clears even when no window lay over the conversation.
9620
9772
  if (!moving.length && (!always || windowsAside)) return;
9621
9773
  clearTimeout(asideSettle);
@@ -9663,12 +9815,33 @@ const NOT_DESK = '.bar, .bar-home, #bar, header, nav, .avatar, .picker, .openq,
9663
9815
  function deskPress(event) {
9664
9816
  const target = event.target;
9665
9817
  // Inside a dialog — MODULES, MU/TH/UR, a guide — a press is that dialog's, never the desktop's.
9666
- if (!target?.closest?.('.shell') || target.closest(WINDOW_SELECTOR) || target.closest('dialog') || target.closest('#composer') || target.closest(DESK_ACTIVE) || target.closest(NOT_DESK)) return false;
9818
+ // What is docked beside the conversation is work, not desktop: a press there sets aside what
9819
+ // covers it and never brings the windows back.
9820
+ if (!target?.closest?.('.shell') || target.closest(WINDOW_SELECTOR) || target.closest('dialog') || target.closest('#composer') || target.closest(DOCKED) || target.closest(DESK_ACTIVE) || target.closest(NOT_DESK)) return false;
9667
9821
  if (!globalThis.getSelection?.()?.isCollapsed) return false;
9668
9822
  return floatingWindows().length > 0;
9669
9823
  }
9670
9824
  if (!SPLIT_CHAT) {
9671
- document.querySelector('#composer .field')?.addEventListener('pointerdown', () => setWindowsAside(true));
9825
+ document.querySelector('#composer .field')?.addEventListener('pointerdown', () => setWindowsAside(true, { over: [threadBox] }));
9826
+ // The same «this, now» in what is docked beside the conversation: a press in Code, the files or
9827
+ // the browser sends aside the windows lying over it, and only those.
9828
+ document.addEventListener?.('pointerdown', (event) => {
9829
+ const area = event.button === 0 && !event.target?.closest?.(WINDOW_SELECTOR) && event.target?.closest?.(DOCKED);
9830
+ if (area) setWindowsAside(true, { over: [area] });
9831
+ });
9832
+ // And starting to write, whichever way the keyboard got there (Tab, a shortcut, after sending):
9833
+ // the first key typed in the box or in the code sends aside what covers it. Once per arrival —
9834
+ // reading every key would measure the windows on each one.
9835
+ let typedIn = null;
9836
+ document.addEventListener?.('focusin', () => { typedIn = null; }, true);
9837
+ document.addEventListener?.('input', (event) => {
9838
+ const target = event.target;
9839
+ if (!event.isTrusted || !target?.closest || target.closest(WINDOW_SELECTOR)) return;
9840
+ const area = target.closest('#composer') ? threadBox : target.closest(DOCKED);
9841
+ if (!area || typedIn === area) return;
9842
+ typedIn = area;
9843
+ setWindowsAside(true, { over: [area] });
9844
+ }, true);
9672
9845
  // A press on a strip brings that window back (bringWindowForward, above); a press that does
9673
9846
  // something else — the bar, a button — leaves the windows where they are.
9674
9847
  // The desktop pressed: windows still over the conversation go aside; with none left, all come back.
@@ -9805,8 +9978,35 @@ function arrangeOnHover(button, { owner, float = () => {} }) {
9805
9978
  }
9806
9979
 
9807
9980
  // A window held by the pointer: the frames under it stop taking the pointer while it lasts, or
9808
- // the first one it crosses swallows the drag.
9809
- const holdingWindow = (kind, on) => document.documentElement.classList.toggle(kind, on);
9981
+ // the first one it crosses swallows the drag. One sheet over the whole page holds the cursor and
9982
+ // keeps text from being picked while it lasts. It was a rule on every element, and with a long
9983
+ // file open in Code each press and each release restyled tens of thousands of lines: the window
9984
+ // stuck for a fifth of a second as it was taken and again as it was let go (2026-10-20).
9985
+ const holdShield = el('div', 'hold-shield');
9986
+ holdShield.setAttribute('aria-hidden', 'true');
9987
+ document.body?.append(holdShield);
9988
+ // Lit by its own style, never by a class: a class that comes and goes inside the page is read
9989
+ // again by every `:has()` of the stylesheet, which cost as much as the rule it replaced.
9990
+ // `release` ends the hold the way a release of the pointer would.
9991
+ let holdRelease = null;
9992
+ function holdingWindow(kind, on, cursor = null, release = null) {
9993
+ document.documentElement.classList.toggle(kind, on);
9994
+ if (on) { holdShield.style.pointerEvents = 'auto'; holdShield.style.cursor = cursor ?? 'grabbing'; }
9995
+ else { holdShield.style.removeProperty('pointer-events'); holdShield.style.removeProperty('cursor'); }
9996
+ holdRelease = on ? release : null;
9997
+ }
9998
+ // The pointer reaching the sheet itself means what was held lost it on the way — its capture let
9999
+ // go without a release, the page lost the focus mid-drag — and the hold ends there. Left on, the
10000
+ // sheet kept the page out of reach and the window stuck where it was (2026-10-20).
10001
+ function letGoOfWindow() {
10002
+ const release = holdRelease;
10003
+ if (release) { release(); return; }
10004
+ if (holdShield.style.pointerEvents) for (const kind of ['carrying-window', 'sizing-window']) holdingWindow(kind, false);
10005
+ }
10006
+ holdShield.addEventListener('pointerdown', letGoOfWindow);
10007
+ holdShield.addEventListener('pointerup', letGoOfWindow);
10008
+ holdShield.addEventListener('pointermove', (event) => { if (!event.buttons) letGoOfWindow(); });
10009
+ window.addEventListener?.('blur', () => { if (holdShield.style.pointerEvents) letGoOfWindow(); });
9810
10010
 
9811
10011
  function windowEdgesFor(node, { active = () => true, box, place, done, minW = WINDOW_MIN_W, minH = WINDOW_MIN_H }) {
9812
10012
  for (const side of ['n', 's', 'e', 'w', 'ne', 'nw', 'se', 'sw']) {
@@ -9819,7 +10019,6 @@ function windowEdgesFor(node, { active = () => true, box, place, done, minW = WI
9819
10019
  event.stopPropagation();
9820
10020
  try { edge.setPointerCapture(event.pointerId); } catch { /* a pointer the page no longer holds */ }
9821
10021
  bringWindowForward(node);
9822
- holdingWindow('sizing-window', true);
9823
10022
  const start = { ...box() };
9824
10023
  const fromX = event.clientX;
9825
10024
  const fromY = event.clientY;
@@ -9841,13 +10040,16 @@ function windowEdgesFor(node, { active = () => true, box, place, done, minW = WI
9841
10040
  edge.removeEventListener('pointermove', move);
9842
10041
  edge.removeEventListener('pointerup', finish);
9843
10042
  edge.removeEventListener('pointercancel', finish);
10043
+ edge.removeEventListener('lostpointercapture', finish);
9844
10044
  holdingWindow('sizing-window', false);
9845
10045
  done?.();
9846
10046
  scheduleDepth();
9847
10047
  };
10048
+ holdingWindow('sizing-window', true, getComputedStyle(edge).cursor, finish);
9848
10049
  edge.addEventListener('pointermove', move);
9849
10050
  edge.addEventListener('pointerup', finish);
9850
10051
  edge.addEventListener('pointercancel', finish);
10052
+ edge.addEventListener('lostpointercapture', finish);
9851
10053
  });
9852
10054
  }
9853
10055
  }
@@ -10879,7 +11081,7 @@ function carryWindowBy(head, node, { active = () => true, box, place, done }) {
10879
11081
  if (Math.hypot(moving.clientX - startX, moving.clientY - startY) < 4) return;
10880
11082
  carrying = true;
10881
11083
  veil = veilFor(node);
10882
- holdingWindow('carrying-window', true);
11084
+ holdingWindow('carrying-window', true, null, drop);
10883
11085
  node.classList.add('lifted');
10884
11086
  }
10885
11087
  to = toward(moving);
@@ -10899,6 +11101,7 @@ function carryWindowBy(head, node, { active = () => true, box, place, done }) {
10899
11101
  head.removeEventListener('pointermove', move);
10900
11102
  head.removeEventListener('pointerup', drop);
10901
11103
  head.removeEventListener('pointercancel', drop);
11104
+ head.removeEventListener('lostpointercapture', drop);
10902
11105
  holdingWindow('carrying-window', false);
10903
11106
  node.classList.remove('lifted');
10904
11107
  if (veil) veil.dataset.snap = '';
@@ -10911,6 +11114,7 @@ function carryWindowBy(head, node, { active = () => true, box, place, done }) {
10911
11114
  head.addEventListener('pointermove', move);
10912
11115
  head.addEventListener('pointerup', drop);
10913
11116
  head.addEventListener('pointercancel', drop);
11117
+ head.addEventListener('lostpointercapture', drop);
10914
11118
  });
10915
11119
  }
10916
11120
 
@@ -11300,7 +11504,12 @@ if (SPLIT_CHAT && !Array.isArray(initial.events)) {
11300
11504
  if (initial.version) { drawAttribution(document.querySelector('#colophon'), initial.version); void drawColophonKeys(document.querySelector('#colophon')); }
11301
11505
  void adoptLanguage(initial.language, initial.languageChosen);
11302
11506
  // Whether the copilot is on for this project, so the robot and the mode say so from the start.
11303
- void loadCopilot().then(() => showNewHints());
11507
+ // The cards of what 1.0.2 brought are news only to whoever used MADRE before it: someone new met all
11508
+ // of it at once in the welcome, and five «New:» cards in a row were noise to them (2026-10-19).
11509
+ void Promise.all([loadCopilot(), roomTour().loaded]).then(async () => {
11510
+ if (!state.device) await keptHints();
11511
+ showNewHints();
11512
+ });
11304
11513
  // Behind the bridge this page is on a phone (docs/MOBILE.md): it says so, offers the way back to
11305
11514
  // the list of rooms, and leaves the Mac's keys to the Mac.
11306
11515
  state.device = initial.device ?? null;
@@ -12237,6 +12446,14 @@ async function runSlashCommand(text) {
12237
12446
  }
12238
12447
  return { handled: false, text: rest, target };
12239
12448
  }
12449
+ if (ASKING_FOR[name]) {
12450
+ const id = ASKING_FOR[name];
12451
+ const item = modules.items.find((one) => one.id === id);
12452
+ if (!item?.status?.installed) { toast(t('Turn on {name} in Modules first: then any agent can make them for you.', { name: t(id === 'notes' ? 'Notes' : 'Reminders') })); return { handled: true }; }
12453
+ if (!rest) { toast(id === 'notes' ? t('Write the note after /{name}, or what the agent should note.', { name }) : t('Write what and when after /{name}.', { name })); return { handled: true }; }
12454
+ // Sent as written: the slash tells the room to hand the agent its tool, and the agent what to do.
12455
+ return { handled: false, text, target: els.target.value };
12456
+ }
12240
12457
  const known = allCommands().find((item) => item.name === name);
12241
12458
  if (!known) { toast(t('Diagnostics › unknown command /{name}. Type "/" to see what this project offers.', { name })); return { handled: true }; }
12242
12459
  if (!known.available) { toast(t('Diagnostics › /{name} is not available in this project: {title} (see MODULES).', { name, title: known.title })); return { handled: true }; }
@@ -12761,27 +12978,6 @@ function roomRecords() {
12761
12978
  return openFailures().map((failure) => ({ failure, key: failureKey(failure), matches: diagnose(failure.error, failure.agent) })).reverse();
12762
12979
  }
12763
12980
 
12764
- // A symptom is said in the words a person has, not the catalogue's. When no condition holds every
12765
- // word, the ones sharing the most of them come first: «codex no responde timeout» still finds the
12766
- // timeout. An agent's name keeps to that agent and the general ones; little words do not count.
12767
- const LOOSE_SKIP = new Set(['the', 'and', 'not', 'for', 'with', 'que', 'los', 'las', 'del', 'por', 'una', 'uno', 'con', 'sin', 'esta', 'este', 'muy', 'mas', 'pero']);
12768
- const LOOSE_AGENTS = new Set(['codex', 'claude', 'gemini', 'opencode', 'cursor', 'madre', 'ollama']);
12769
- function looseConditions(text) {
12770
- const words = settingsFold(text).split(/[^a-z0-9#.@_-]+/).map((word) => word.replace(/^@/, '')).filter((word) => word.length >= 3 && !LOOSE_SKIP.has(word));
12771
- const agent = words.find((word) => LOOSE_AGENTS.has(word)) ?? null;
12772
- const rest = words.filter((word) => !LOOSE_AGENTS.has(word));
12773
- if (!rest.length) return [];
12774
- return allConditions()
12775
- .filter((condition) => !agent || !condition.agent || condition.agent === agent)
12776
- .map((condition) => {
12777
- const haystack = settingsFold([condition.id, condition.code, condition.title, condition.diagnosis, condition.remedy].join(' '));
12778
- return { condition, score: rest.filter((word) => haystack.includes(word)).length + (agent && condition.agent === agent ? 0.5 : 0) };
12779
- })
12780
- .filter((entry) => entry.score >= 1)
12781
- .sort((a, b) => b.score - a.score)
12782
- .map((entry) => entry.condition);
12783
- }
12784
-
12785
12981
  // Under the title, one quiet line: how serious it is (the only word in colour), who, and its code.
12786
12982
  function remedyTags(condition, agent = null) {
12787
12983
  const tags = el('div', 'remedy-meta');
@@ -12817,7 +13013,7 @@ function remedyDetail(host, condition, { agent = null, hintAgent = null } = {})
12817
13013
  sxRow(block, who ? t('Open @{agent} in Settings', { agent: who }) : t('Open Agents in Settings'), t('Sign it in, install it or change what it may do, from there.'), sxButton(t('Open'), () => openSettingsOn('agents', { agent: who }), { tone: 'primary' }));
12818
13014
  }
12819
13015
  if (condition.solvedIn === 'ollama') {
12820
- sxRow(block, t('Open Ollama'), t('Start it, download its models and choose what it does in this project.'), sxButton(t('Open'), () => floatModule('ollama'), { tone: 'primary' }));
13016
+ sxRow(block, t('Open Ollama'), t('Start it, download its models and choose what it does in this project.'), sxButton(t('Open'), () => openSettingsOn('local'), { tone: 'primary' }));
12821
13017
  }
12822
13018
  // The other way: the terminal, for another machine, another shell, or whoever prefers typing.
12823
13019
  const terminal = sxBlock(host, t('In your terminal'), `${PLATFORMS[mother.platform].label} · ${PLATFORMS[mother.platform].shell}`, { className: 'remedy-terminal' });
@@ -12875,9 +13071,7 @@ function paintRemedies() {
12875
13071
  if (/special order|937|expendable/i.test(text)) { remedies.hint = t('NO SPECIAL ORDERS ON THIS SHIP. THE AGENTS ARE NOT EXPENDABLE. RESTATE INQUIRY.'); matches = []; }
12876
13072
  else if (/^(help|\?)$/i.test(text)) remedies.hint = t('INQUIRY ACCEPTS: AN AGENT NAME · A SYMPTOM · A KEYWORD SUCH AS TIMEOUT, LOGIN, PORT, BUDGET.');
12877
13073
  else {
12878
- const byError = diagnose(text);
12879
- matches = [...new Set([...byError, ...searchConditions(text)])];
12880
- if (!matches.length) matches = looseConditions(text);
13074
+ matches = findConditions(text);
12881
13075
  if (!matches.length) remedies.hint = t('Nothing matches that. Try a symptom, an agent, or a word like timeout, login, port or budget.');
12882
13076
  }
12883
13077
  }
@@ -13138,7 +13332,14 @@ function renderTerminalCard(event) {
13138
13332
  const id = String(event.id ?? event.sequence ?? Math.random());
13139
13333
  const outId = `term-${id.replace(/[^\w-]/g, '')}`;
13140
13334
  head.setAttribute('aria-controls', outId);
13141
- head.append(el('b', 'term-tag', `/${name}`));
13335
+ // A module's answer (/informe, /remind…) is not a terminal: it reads as the module's own card —
13336
+ // its icon, its title in words, the key it offers in the room's accent (1.0.5).
13337
+ const owner = run?.line ? null : (modules.items ?? []).find((item) => (item.commands ?? []).some((line) => String(line).split(/\s/)[0] === `/${name}`)) ?? null;
13338
+ const fromModule = !run?.line && name !== 'run';
13339
+ if (fromModule) {
13340
+ node.classList.add('module-result');
13341
+ head.append(appIcon(owner ?? { id: name }, 22));
13342
+ } else head.append(el('b', 'term-tag', `/${name}`));
13142
13343
  if (run?.line) {
13143
13344
  head.title = runTitle(run);
13144
13345
  head.append(el('code', 'term-line', `$ ${run.line}`));
@@ -13148,11 +13349,20 @@ function renderTerminalCard(event) {
13148
13349
  head.append(el('span', `term-status ${status}`, `${status === 'ok' ? '✓' : status === 'failed' ? '✕' : '■'} ${word} · ${((Number(run.durationMs) || 0) / 1000).toFixed(1)}s`));
13149
13350
  if (run.agent) head.append(paint(el('span', 'term-who', run.auto ? `@${run.agent} · ${t('copilot')}` : `@${run.agent}`), run.agent));
13150
13351
  } else {
13151
- head.title = title ?? name;
13152
- head.append(el('span', 'term-line', title ?? name));
13352
+ // «WORK REPORT · TIENDA-DEMO» reads «Informe de trabajo · tienda-demo»: the module's part in the
13353
+ // room's language and in sentence case, the rest (a project's name) as it is.
13354
+ const [lead, ...rest] = String(title ?? owner?.name ?? name).split(' · ');
13355
+ const said = fromModule ? [t(sentenceCase(lead)), ...rest.map((part) => (part === part.toUpperCase() ? part.toLowerCase() : part))].join(' · ') : title ?? name;
13356
+ head.title = said;
13357
+ head.append(el('span', 'term-line', said));
13153
13358
  if (args.length) head.append(el('span', 'term-who', args.join(' ')));
13154
13359
  }
13155
13360
  head.append(el('span', 'term-count', t('{n} lines', { n: lines.length })), chevron());
13361
+ // A module's own page for this result (a report to print), offered as a key beside the line. The
13362
+ // server keeps it to the module's own routes (/api/x/<id>/); the page checks the same before drawing.
13363
+ const link = event.payload.link;
13364
+ const page = typeof link?.href === 'string' && /^\/api\/x\/[a-z][a-z0-9-]*\//.test(link.href) ? el('a', 'term-link', t(link.label || title || name)) : null;
13365
+ if (page) { page.href = link.href; page.target = '_blank'; page.rel = 'noopener'; }
13156
13366
  // The line a person looks for first: the last thing it printed.
13157
13367
  const last = [...lines].reverse().find((line) => line.trim() && !/^Files changed:|^Archivos cambiados:/.test(line));
13158
13368
  const peek = last ? el('div', 'term-peek', last.trim().slice(0, 240)) : null;
@@ -13175,7 +13385,14 @@ function renderTerminalCard(event) {
13175
13385
  };
13176
13386
  open(termOpen.has(id));
13177
13387
  head.addEventListener('click', () => open(!node.classList.contains('open')));
13178
- node.append(head, ...(peek ? [peek] : []), out);
13388
+ // A module's page (a report to print) sits on the same row as its title, a small key at its end:
13389
+ // under it, it turned the pill into a bulging oval (2026-10-20).
13390
+ if (page && fromModule) {
13391
+ const row = el('div', 'term-row');
13392
+ page.classList.add('in-row');
13393
+ row.append(head, page);
13394
+ node.append(row, ...(peek ? [peek] : []), out);
13395
+ } else node.append(head, ...(page ? [page] : []), ...(peek ? [peek] : []), out);
13179
13396
  if (run) {
13180
13397
  markRun(run, ok === false ? 'failed' : 'ran');
13181
13398
  // A command the human ran by hand was photographed first: the same UNDO as a CONTROL turn.
@@ -13271,7 +13488,7 @@ function appendModuleOutput(event) {
13271
13488
  modules.logs.set(id, log.slice(-400));
13272
13489
  const box = document.getElementById(`module-log-${id}`);
13273
13490
  if (box) {
13274
- for (const line of lines) box.append(el('div', /error|failed|ERR/i.test(line) ? 'err' : null, line));
13491
+ for (const line of lines) box.append(el('div', /error|failed|ERR/i.test(line) ? 'err' : null, saidLine(line)));
13275
13492
  box.scrollTop = box.scrollHeight;
13276
13493
  }
13277
13494
  }
@@ -13307,7 +13524,7 @@ function drawFilesTarget() {
13307
13524
  // already uses, each one started and checked by MADRE before an agent gets it (src/modules/
13308
13525
  // mcp-connect.mjs). A row says what it is, whether it answered and with how many tools, from which
13309
13526
  // mode its tools that act are handed, and the one thing to do when it needs something.
13310
- const mcpUI = { servers: null, adding: null, found: null, picked: new Set(), open: new Set(), said: null, asked: false };
13527
+ const mcpUI = { servers: null, adding: null, found: null, picked: new Set(), open: new Set(), said: null, asked: false, tokenFor: null };
13311
13528
  function mcpStatus() {
13312
13529
  const servers = mcpUI.servers;
13313
13530
  // The board shows this card before anyone opens it: it reads its list once, by itself.
@@ -13349,6 +13566,100 @@ function drawMcpSettings(host) {
13349
13566
  sxFoot(list, t('Tools that only look things up work from #1 CHAT ONLY. Tools that do things — send, write, publish — only from the mode you choose: #4 FULL ACCESS unless you lower it. Keys stay locked in MADRE, never in your files.'));
13350
13567
  if (mcpUI.adding) drawMcpForm(host);
13351
13568
  if (mcpUI.found) drawMcpImport(host);
13569
+ drawMcpCatalog(host);
13570
+ }
13571
+ // CONNECTORS (public/mcp-catalog.js, 2026-10-20): the best known servers, checked against MADRE,
13572
+ // one press each. Connecting one is what «Add a tool» does by hand, with the address filled in:
13573
+ // MADRE saves it, signs in when it asks, and reads its tools before any agent gets them.
13574
+ function drawMcpCatalog(host) {
13575
+ const norm = (address) => { try { return new URL(address).toString(); } catch { return address; } };
13576
+ const have = new Map((mcpUI.servers ?? []).filter((one) => one.url).map((one) => [norm(one.url), one]));
13577
+ const block = sxBlock(host, t('Connectors'), t('The best known services, checked against MADRE on {date}. One press connects one to this project; any other MCP server goes in with «Add a tool».', { date: new Date(`${CATALOG_CHECKED}T12:00:00`).toLocaleDateString(document.documentElement.lang === 'en' ? 'en-US' : 'es-MX', { day: 'numeric', month: 'long', year: 'numeric' }) }), { className: 'mcp-block mcp-catalog-block' });
13578
+ for (const group of MCP_GROUPS) {
13579
+ const items = MCP_CATALOG.filter((one) => one.group === group.id);
13580
+ if (!items.length) continue;
13581
+ const head = el('div', 'mcp-cat-head');
13582
+ head.append(el('b', null, t(group.title)), el('span', null, t(group.about)));
13583
+ const grid = el('div', 'mcp-catalog');
13584
+ for (const item of items) grid.append(mcpConnectorCard(item, have.get(norm(item.url)) ?? null));
13585
+ block.rows.append(head, grid);
13586
+ }
13587
+ // A server that is not on the list: by hand, as it always was.
13588
+ const other = el('div', 'mcp-cat-other');
13589
+ other.append(el('span', null, t('Another MCP server, yours or a third party\'s?')), sxButton(t('Add a tool'), () => { mcpUI.adding = { transport: 'http', auth: 'none', env: [] }; drawMcpTarget(); state.settingsTargets.mcp?.querySelector('.mcp-form')?.scrollIntoView?.({ block: 'start', behavior: 'smooth' }); }));
13590
+ block.rows.append(other);
13591
+ }
13592
+ const MCP_CHECKED_WORDS = { tools: () => t('Checked'), signin: () => t('With your account'), token: () => t('With a token') };
13593
+ function mcpConnectorCard(item, connected) {
13594
+ const card = el('div', `mcp-card${connected ? ' is-connected' : ''}`);
13595
+ // Its mark on its own color (public/mcp-catalog.js: Simple Icons, CC0), or its initials when there
13596
+ // is none; the ink is white or near black, whichever reads on that color.
13597
+ const drawn = Boolean(item.logo || item.logoMarkup);
13598
+ const mark = el('span', `mcp-mark${drawn ? ' has-logo' : ''}`, drawn ? null : mcpInitials(item.label));
13599
+ const color = item.brand ?? item.hue;
13600
+ mark.style.setProperty('--mcp-hue', color);
13601
+ const [r, g, b] = [1, 3, 5].map((at) => Number.parseInt(color.slice(at, at + 2), 16) / 255);
13602
+ mark.style.setProperty('--mcp-ink', 0.2126 * r + 0.7152 * g + 0.0722 * b > 0.62 ? '#111111' : '#ffffff');
13603
+ // One color on the brand's (most), or the mark's own colors when it has several (monday.com).
13604
+ if (drawn) mark.innerHTML = `<svg viewBox="${item.logoBox ?? '0 0 24 24'}" aria-hidden="true">${item.logoMarkup ?? `<path fill="currentColor" d="${item.logo}"/>`}</svg>`; // trusted: our own catalog
13605
+ mark.setAttribute('aria-hidden', 'true');
13606
+ const words = el('div', 'mcp-card-words');
13607
+ const name = el('b', null, item.label);
13608
+ const chip = el('span', `sx-chip${item.checked === 'tools' ? ' on' : ''}`, MCP_CHECKED_WORDS[item.checked]());
13609
+ chip.title = item.checked === 'tools' ? t('MADRE connected to it and read its tools.') : item.checked === 'signin' ? t('MADRE found its sign-in. Its tools are read the moment you sign in.') : t('MADRE checks it as soon as you paste the token.');
13610
+ const top = el('div', 'mcp-card-top');
13611
+ top.append(name, chip);
13612
+ words.append(top, el('span', 'mcp-card-about', t(item.about)), el('small', null, item.maker));
13613
+ card.append(mark, words);
13614
+ const keys = el('div', 'mcp-card-keys');
13615
+ if (connected) {
13616
+ const ready = connected.enabled && !connected.problem && connected.tools?.length;
13617
+ keys.append(el('span', `mcp-card-state${ready ? ' ok' : ''}`, ready ? t('Connected · {n} tools', { n: connected.tools.length }) : connected.auth === 'oauth' && (!connected.signedIn || connected.needsAuth) ? t('Sign-in needed') : t('Connected')));
13618
+ keys.append(sxButton(t('Check the connection'), (event) => void mcpCheck(connected, event.currentTarget)));
13619
+ } else if (item.auth === 'token' && mcpUI.tokenFor === item.id) {
13620
+ const field = el('input', 'sx-input mono');
13621
+ field.type = 'password'; field.placeholder = t('paste it here'); field.autocomplete = 'off'; field.spellcheck = false;
13622
+ const make = el('a', 'sx-link', t('Make a token ↗'));
13623
+ make.href = item.tokenAt; make.target = '_blank'; make.rel = 'noopener noreferrer';
13624
+ const go = sxButton(t('Connect'), () => void mcpConnect(item, go, field.value), { tone: 'primary' });
13625
+ keys.append(field, go, make);
13626
+ setTimeout(() => field.focus(), 0);
13627
+ } else {
13628
+ const go = sxButton(t('Connect'), () => { if (item.auth === 'token') { mcpUI.tokenFor = item.id; drawMcpTarget(); } else void mcpConnect(item, go); }, { tone: 'primary' });
13629
+ keys.append(go);
13630
+ }
13631
+ card.append(keys);
13632
+ return card;
13633
+ }
13634
+ async function mcpConnect(item, button, token = null) {
13635
+ if (item.auth === 'token' && !String(token ?? '').trim()) { toast(t('Paste the token first.')); return; }
13636
+ button.disabled = true; button.textContent = item.auth === 'oauth' ? t('Opening the sign-in…') : t('Checking…');
13637
+ // A short word the agents see; one already taken in this project gets a number.
13638
+ const taken = new Set((mcpUI.servers ?? []).map((one) => one.id));
13639
+ let id = item.id;
13640
+ for (let n = 2; taken.has(id); n += 1) id = `${item.id}-${n}`;
13641
+ try {
13642
+ const result = await mcpCall('/api/x/mcp/servers', { id, label: item.label, transport: 'http', url: item.url, auth: item.auth, token: token ?? undefined });
13643
+ mcpUI.tokenFor = null;
13644
+ const added = (mcpUI.servers ?? []).find((one) => one.id === id);
13645
+ drawMcpTarget(); syncSettingsCards();
13646
+ if (added?.auth === 'oauth' && result.check?.needsAuth) void mcpSignIn(added);
13647
+ else if (result.check?.ok) toast(t('{name} is connected · {n} tools', { name: item.label, n: result.check.tools.length }), { tone: 'done' });
13648
+ else if (result.check) toast(t('{name} did not answer: {problem}', { name: item.label, problem: result.check.problem ?? '' }));
13649
+ } catch (error) {
13650
+ toast(`${t('Diagnostics › ')}${resay(error.message)}`);
13651
+ button.disabled = false; button.textContent = t('Connect');
13652
+ }
13653
+ }
13654
+ async function mcpCheck(server, button) {
13655
+ if (button) { button.disabled = true; button.textContent = t('Checking…'); }
13656
+ try {
13657
+ const result = await mcpCall(`/api/x/mcp/servers/${server.id}/check`, {});
13658
+ if (result.check?.ok) toast(t('{name} answers · {n} tools', { name: server.label, n: result.check.tools.length }), { tone: 'done' });
13659
+ else if (result.check?.needsAuth) toast(t('{name} needs you to sign in again.', { name: server.label }));
13660
+ else toast(t('{name} did not answer: {problem}', { name: server.label, problem: result.check?.problem ?? '' }));
13661
+ } catch (error) { toast(`${t('Diagnostics › ')}${resay(error.message)}`); }
13662
+ drawMcpTarget(); syncSettingsCards();
13352
13663
  }
13353
13664
  function mcpServerRow(server) {
13354
13665
  const row = el('div', `sx-row stack mcp-row${server.enabled ? '' : ' off'}`);
@@ -13375,12 +13686,7 @@ function mcpServerRow(server) {
13375
13686
  const acting = (server.tools ?? []).filter((tool) => !tool.readOnly).length;
13376
13687
  const tools = el('div', 'mcp-actions');
13377
13688
  if (needsSignIn) tools.append(sxButton(t('Sign in'), () => void mcpSignIn(server), { tone: 'primary' }));
13378
- tools.append(sxButton(t('Check again'), async (event) => {
13379
- const button = event.currentTarget;
13380
- button.disabled = true; button.textContent = t('Checking…');
13381
- try { const result = await mcpCall(`/api/x/mcp/servers/${server.id}/check`, {}); if (!result.check?.ok && !result.check?.needsAuth) toast(t('{name} did not answer: {problem}', { name: server.label, problem: result.check?.problem ?? '' })); } catch (error) { toast(`${t('Diagnostics › ')}${resay(error.message)}`); }
13382
- drawMcpTarget(); syncSettingsCards();
13383
- }));
13689
+ tools.append(sxButton(t('Check the connection'), (event) => void mcpCheck(server, event.currentTarget)));
13384
13690
  if (server.tools?.length) {
13385
13691
  const open = mcpUI.open.has(server.id);
13386
13692
  const look = sxButton(open ? t('Hide tools') : t('See tools'), () => { if (open) mcpUI.open.delete(server.id); else mcpUI.open.add(server.id); drawMcpTarget(); });
@@ -13427,7 +13733,7 @@ async function mcpSignIn(server) {
13427
13733
  }
13428
13734
  function drawMcpForm(host) {
13429
13735
  const draft = mcpUI.adding;
13430
- const block = sxBlock(host, t('Add a tool'), t('A name for it, and how MADRE reaches it. MADRE checks it as soon as you save.'), { className: 'mcp-block' });
13736
+ const block = sxBlock(host, t('Add a tool'), t('A name for it, and how MADRE reaches it. MADRE checks it as soon as you save.'), { className: 'mcp-block mcp-form' });
13431
13737
  const input = (value, placeholder, { mono = false, type = 'text', change } = {}) => {
13432
13738
  const field = el('input', `sx-input${mono ? ' mono' : ''}`);
13433
13739
  field.type = type; field.value = value ?? ''; field.placeholder = placeholder; field.spellcheck = false; field.autocomplete = 'off';
@@ -13542,7 +13848,7 @@ function drawFilesSettings(host) {
13542
13848
  const item = modules.items.find((one) => one.id === id);
13543
13849
  if (!item) { sxRow(show, label, t('Reading…')); continue; }
13544
13850
  const blocked = !item.status?.installed && item.preflight && !item.preflight.ok;
13545
- sxRow(show, label, blocked ? item.preflight.problems.join(' ') : hint, sxSwitch(item.status?.installed, async (on, box) => {
13851
+ sxRow(show, label, blocked ? item.preflight.problems.map((one) => t(one)).join(' ') : hint, sxSwitch(item.status?.installed, async (on, box) => {
13546
13852
  box.disabled = true;
13547
13853
  try { await switchModule(item); } catch (error) { box.checked = !on; toast(error.message); }
13548
13854
  drawFilesTarget();
@@ -13593,8 +13899,10 @@ async function refreshModules() {
13593
13899
  drawFilesTarget();
13594
13900
  drawLocalTarget();
13595
13901
  syncSettingsCards();
13902
+ void syncNotes();
13903
+ if (!remindersKit.read) { remindersKit.read = true; void loadReminders(); }
13596
13904
  }
13597
- // AJUSTES › Local AI: the module's own blocks (Modules › Local AI), drawn here too.
13905
+ // AJUSTES › Local AI: the module's own blocks. Since 2026-10-20 they live only here: Local AI has no tile in Modules.
13598
13906
  function drawLocalTarget() {
13599
13907
  const target = state.settingsTargets.local;
13600
13908
  if (!target?.isConnected) return;
@@ -13805,7 +14113,7 @@ function cardShell(item, { on, state: stateText }) {
13805
14113
  if (item.commands?.length) {
13806
14114
  const body = cardFold(card, t('COMMANDS'), { key: `mod.${item.id}.commands`, count: item.commands.length });
13807
14115
  const list = el('ul', 'card-commands');
13808
- for (const line of item.commands) list.append(el('li', null, line));
14116
+ for (const line of item.commands) list.append(el('li', null, t(line)));
13809
14117
  body.append(list);
13810
14118
  }
13811
14119
 
@@ -14801,7 +15109,7 @@ function builtinCard(item) {
14801
15109
  if (item.preflight && !item.preflight.ok) {
14802
15110
  const warn = el('div', 'confirm');
14803
15111
  warn.append(el('span', 'warn', t('CANNOT ENABLE YET')));
14804
- for (const problem of item.preflight.problems) warn.append(el('p', null, problem));
15112
+ for (const problem of item.preflight.problems) warn.append(el('p', null, t(problem)));
14805
15113
  panel.append(warn);
14806
15114
  }
14807
15115
 
@@ -14844,7 +15152,7 @@ function moduleCard(item) {
14844
15152
  if (blocked) {
14845
15153
  const warn = el('div', 'confirm');
14846
15154
  warn.append(el('span', 'warn', t('CANNOT INSTALL HERE YET')));
14847
- for (const problem of item.preflight.problems) warn.append(el('p', null, problem));
15155
+ for (const problem of item.preflight.problems) warn.append(el('p', null, t(problem)));
14848
15156
  // What MADRE can put right itself (Continuity on a Mac with no git): one key, never a terminal.
14849
15157
  if (item.preflight.fix) {
14850
15158
  const fix = el('button', 'primary', item.preflight.fix.label ?? t('Set it up'));
@@ -14904,7 +15212,7 @@ function moduleCard(item) {
14904
15212
  if (log.length || running) {
14905
15213
  const box = el('div', 'module-log');
14906
15214
  box.id = `module-log-${item.id}`;
14907
- for (const line of log) box.append(el('div', /error|failed|ERR/i.test(line) ? 'err' : null, line));
15215
+ for (const line of log) box.append(el('div', /error|failed|ERR/i.test(line) ? 'err' : null, saidLine(line)));
14908
15216
  panel.append(box);
14909
15217
  queueMicrotask(() => { box.scrollTop = box.scrollHeight; });
14910
15218
  }
@@ -14946,7 +15254,7 @@ function moduleTile(item) {
14946
15254
  try { await switchModule(item); } catch (error) { box.checked = !next; box.disabled = false; toast(error.message); }
14947
15255
  }, { disabled: blocked, label: item.name });
14948
15256
  wrap.addEventListener('click', (event) => event.stopPropagation());
14949
- if (blocked) wrap.title = item.preflight.problems.join(' ');
15257
+ if (blocked) wrap.title = item.preflight.problems.map((one) => t(one)).join(' ');
14950
15258
  top.append(wrap);
14951
15259
  } else {
14952
15260
  top.append(sxChip(item.fixed ? t('Always') : item.kind === 'builtin' ? (on ? t('Turned on') : t('Turned off')) : on ? t('Installed') : t('Not installed'), on ? 'on' : ''));
@@ -15023,7 +15331,7 @@ function moduleFacts(host, item) {
15023
15331
  if (item.commands?.length) {
15024
15332
  const block = sxBlock(host, t('Commands'), t('What it adds to the Write box. Type it in the project.'));
15025
15333
  const list = el('div', 'mods-commands');
15026
- for (const line of item.commands) list.append(el('code', null, line));
15334
+ for (const line of item.commands) list.append(el('code', null, t(line)));
15027
15335
  block.rows.append(list);
15028
15336
  }
15029
15337
  }
@@ -15042,13 +15350,15 @@ function moduleSheet(host, item) {
15042
15350
  return;
15043
15351
  }
15044
15352
  const on = moduleOn(item);
15045
- const about = sxBlock(host, t('What it does'), moduleFace(item).summary ?? t(item.summary ?? ''));
15353
+ const about = sxBlock(host, t('What it does'), t(moduleFace(item).summary ?? item.summary ?? ''));
15354
+ // Whose idea it was, when a module says (Reminders, 2026-10-20): credited where it is used.
15355
+ if (item.credit) sxRow(about, t('Idea by {name}', { name: item.credit }), t('Thank you for building MADRE with us.'));
15046
15356
  if (item.fixed) sxRow(about, t('Always on'), item.status?.detail ? sentenceCase(t(item.status.detail)) : null);
15047
15357
  else {
15048
15358
  const blocked = !on && item.preflight && !item.preflight.ok;
15049
15359
  // A project's switch is that project's (src/module-scope.mjs); every project's is moved from Home.
15050
15360
  const ownSwitch = item.scope && item.id !== 'ollama' && item.id !== 'bishop';
15051
- sxRow(about, ownSwitch ? t('On in this project') : t('Active'), blocked ? item.preflight.problems.join(' ') : item.status?.detail ? sentenceCase(t(item.status.detail)) : null, sxSwitch(on, async (next, box) => {
15361
+ sxRow(about, ownSwitch ? t('On in this project') : t('Active'), blocked ? item.preflight.problems.map((one) => t(one)).join(' ') : item.status?.detail ? sentenceCase(t(item.status.detail)) : null, sxSwitch(on, async (next, box) => {
15052
15362
  box.disabled = true;
15053
15363
  try { await switchModule(item); } catch (error) { box.checked = !next; box.disabled = false; toast(error.message); }
15054
15364
  }, { disabled: blocked, label: item.name }), { off: blocked });
@@ -15085,6 +15395,9 @@ function moduleSheet(host, item) {
15085
15395
  const response = await fetch(`/api/extensions/${item.id}/settings`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ key: control.key, value }) });
15086
15396
  const result = await response.json().catch(() => ({}));
15087
15397
  if (!response.ok) toast(`${t('Diagnostics › ')}${result.error ?? t('{name} could not save {label}.', { name: item.name, label: control.label })}`);
15398
+ // A switch whose change shows nothing at once says what will happen, and when.
15399
+ const said = response.ok && control.said?.[(control.invert ? value === false : value === true) ? 'on' : 'off'];
15400
+ if (said) toast(t(said), { tone: 'note' });
15088
15401
  await refreshModules();
15089
15402
  };
15090
15403
  for (const control of item.controls) {
@@ -15092,18 +15405,19 @@ function moduleSheet(host, item) {
15092
15405
  if (control.type === 'select') {
15093
15406
  node = el('select', 'sx-input');
15094
15407
  const words = new Map((control.choices ?? []).map((choice) => [choice.value, choice.label]));
15095
- for (const option of control.options) { const choice = el('option', null, words.get(option) ?? option); choice.value = option; if (option === control.value) choice.selected = true; node.append(choice); }
15408
+ for (const option of control.options) { const choice = el('option', null, t(words.get(option) ?? option)); choice.value = option; if (option === control.value) choice.selected = true; node.append(choice); }
15096
15409
  node.addEventListener('change', () => save(control, node.value, node));
15097
15410
  } else if (control.type === 'switch') {
15098
- node = sxSwitch(control.invert ? control.value === false : control.value === true, (next, box) => save(control, control.invert ? !next : next, box), { label: control.label });
15411
+ node = sxSwitch(control.invert ? control.value === false : control.value === true, (next, box) => save(control, control.invert ? !next : next, box), { label: t(control.label) });
15099
15412
  } else {
15100
15413
  node = el('input', 'sx-input');
15101
15414
  node.type = 'text';
15102
15415
  node.value = control.value ?? '';
15103
15416
  node.addEventListener('change', () => save(control, node.value, node));
15104
15417
  }
15105
- node.setAttribute?.('aria-label', control.label);
15106
- sxRow(block, sentenceCase(control.label), control.note || null, node);
15418
+ // A module's words go through the catalogue too: MADRE's own are translated there.
15419
+ node.setAttribute?.('aria-label', t(control.label));
15420
+ sxRow(block, sentenceCase(t(control.label)), control.note ? t(control.note) : null, node);
15107
15421
  }
15108
15422
  }
15109
15423
  if (item.secrets?.length) {
@@ -15123,6 +15437,8 @@ function moduleSheet(host, item) {
15123
15437
  intentsReading(block.rows);
15124
15438
  }
15125
15439
  if (item.id === 'ollama') { ollamaBlock(host, item); hardwareBlock(host, item.recommended?.hardware); }
15440
+ if (item.id === 'notes') notesBlock(host, item);
15441
+ if (item.id === 'reminders') remindersBlock(host, item);
15126
15442
 
15127
15443
  moduleFacts(host, item);
15128
15444
  if (item.external) {
@@ -15145,13 +15461,21 @@ function ollamaBlock(host, item) {
15145
15461
  // Whether this project uses it, beside Home's choice for all of them (src/local-ai.mjs).
15146
15462
  const project = info.project;
15147
15463
  if (project && !project.home) {
15148
- const why = !project.master ? t('Local AI is off for every project.')
15149
- : project.mode === 'auto' ? t('Home turns it on in every project, and «Active» switches it for all of them. To choose project by project, go to Home › Settings › Local AI.')
15150
- : project.mode === 'pick' ? t('Home chooses the projects one by one; «Active» switches this one here too.')
15151
- : t('Each project decides on its own: «Active» is this project’s switch.');
15152
- // The switch is the card's own «Active» (src/modules/ollama.mjs, toggle): this row says whose it is.
15153
- sxRow(block, t('In this project'), why);
15464
+ const why = !project.master ? t('Local AI is off for every project. Turn it on in Home › Settings › Local AI.')
15465
+ : project.mode === 'auto' ? t('Home turns it on in every project. To choose project by project, go to Home › Settings › Local AI.')
15466
+ : project.mode === 'pick' ? t('Home chooses the projects one by one; this switch is the same one Home shows.')
15467
+ : t('Each project decides on its own: this is this project’s switch.');
15468
+ // Since 2026-10-20 Local AI has no tile in Modules: its switch lives here. It is the module's own
15469
+ // toggle (src/modules/ollama.mjs), which outside «auto» moves only this project.
15470
+ const own = project.editable && project.master ? sxSwitch(project.chosen, async (next, box) => {
15471
+ box.disabled = true;
15472
+ await fetch('/api/extensions/ollama/install', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' }).catch(() => null);
15473
+ await refreshModules();
15474
+ }, { label: t('In this project') }) : null;
15475
+ sxRow(block, t('In this project'), why, own);
15154
15476
  }
15477
+ // One model for the whole computer, chosen in Home as the agents are.
15478
+ if (info.running && info.chatModel) sxRow(block, t('Model'), t('{model} · chosen for the whole computer in Home › Settings › Local AI.', { model: info.chatModel }));
15155
15479
  if (info.models?.length) sxRow(block, t('Models'), info.models.map((model) => model.name).join(' · '));
15156
15480
  if (!info.running) {
15157
15481
  const step = info.binary
@@ -15221,7 +15545,10 @@ function moduleDetail(item) {
15221
15545
  return detail;
15222
15546
  }
15223
15547
 
15548
+ // Modules whose whole sheet is a category of Settings: every way in to them lands there.
15549
+ const IN_SETTINGS = { ollama: 'local' };
15224
15550
  function openModuleSheet(id) {
15551
+ if (IN_SETTINGS[id]) { if (modules.dialog?.open) closeModules(); openSettingsOn(IN_SETTINGS[id]); return; }
15225
15552
  modules.open = id;
15226
15553
  if (id) stepDone('module');
15227
15554
  renderModules();
@@ -15243,8 +15570,8 @@ function renderModules() {
15243
15570
  }
15244
15571
  const grid = el('div', 'mods-grid');
15245
15572
  // What is working for you first, what you could turn on after.
15246
- // A module whose settings live in the project's Settings (Connect MCP) has no tile here.
15247
- const offered = modules.items.filter((item) => item.card !== 'settings');
15573
+ // A module whose settings live in the project's Settings (Connect MCP, Local AI) has no tile here.
15574
+ const offered = modules.items.filter((item) => item.card !== 'settings' && !IN_SETTINGS[item.id]);
15248
15575
  const ordered = [...offered.filter(moduleOn), ...offered.filter((item) => !moduleOn(item))];
15249
15576
  const shown = ordered.filter((item) => !query || settingsFold(`${item.name} ${t(moduleFace(item).line ?? '')} ${item.summary ?? ''}`).includes(query));
15250
15577
  for (const item of shown) grid.append(moduleTile(item));
@@ -15286,6 +15613,7 @@ function rememberModuleWindows() { try { localStorage.setItem('pulse.moduleWindo
15286
15613
  // From the board to its own window. MODULES open over the whole room is modal, and would sit above
15287
15614
  // the window it just made, so it steps aside; docked or floating, it stays where it is.
15288
15615
  function floatModule(id) {
15616
+ if (IN_SETTINGS[id]) { openModuleSheet(id); return; }
15289
15617
  if (modules.open) openModuleSheet(null);
15290
15618
  openModuleWindow(id);
15291
15619
  }
@@ -15361,6 +15689,361 @@ function closeModuleWindow(id) {
15361
15689
  }
15362
15690
  function renderModuleWindows() { for (const id of moduleWindows.keys()) drawModuleWindow(id); }
15363
15691
 
15692
+ // NOTES (src/modules/notes.mjs, 0.1, 2026-10-20): colored notes on the project, each one a window
15693
+ // of the room — carried by its head, sized by its edges, arranged by its key, closed by its ×, as
15694
+ // every window is. Its own key beside them throws it away. Kept on this computer, read by no agent.
15695
+ const NOTE_COLORS = ['yellow', 'green', 'blue', 'pink', 'purple', 'orange'];
15696
+ const NOTE_COLOR_WORDS = { yellow: () => t('Yellow'), green: () => t('Green'), blue: () => t('Blue'), pink: () => t('Pink'), purple: () => t('Purple'), orange: () => t('Orange') };
15697
+ const TRASH_ICON = '<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.45" stroke-linecap="round" stroke-linejoin="round"><g class="ic-lid"><path d="M3.8 5.6h12.4"/><path d="M8 5.4V4.2a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1.2"/></g><path d="M5.3 5.8l.8 10a1.4 1.4 0 0 0 1.4 1.3h5a1.4 1.4 0 0 0 1.4-1.3l.8-10"/><path d="M8.6 9v5M11.4 9v5"/></svg>';
15698
+ const notesKit = { items: [], windows: new Map(), on: null, timers: new Map() };
15699
+ const notesOn = () => Boolean(modules.items.find((one) => one.id === 'notes')?.status?.installed);
15700
+ const noteTitle = (note) => String(note?.text ?? '').split('\n').map((line) => line.trim()).find(Boolean)?.slice(0, 48) || t('Note');
15701
+ // After every reading of the modules: the notes come when the module is on here, and go when it is not.
15702
+ // The notes are the room's, not a conversation's: a conversation open in its own window is this same
15703
+ // page in a frame (SPLIT_CHAT), and opening them there too showed every note twice (2026-10-20).
15704
+ async function syncNotes() {
15705
+ if (SPLIT_CHAT) return;
15706
+ const on = notesOn();
15707
+ if (on === notesKit.on) return;
15708
+ notesKit.on = on;
15709
+ if (!on) { notesKit.items = []; for (const id of [...notesKit.windows.keys()]) closeNoteWindow(id); return; }
15710
+ const answer = await fetch('/api/notes', { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null)).catch(() => null);
15711
+ if (!answer) return;
15712
+ notesKit.items = answer.notes ?? [];
15713
+ for (const note of notesKit.items) if (note.open) openNoteWindow(note.id);
15714
+ }
15715
+ // What an agent made while it answered (src/mcp/notes-server.mjs): read when its turn ends, the new
15716
+ // notes opened where they can be seen and the reminders taken in.
15717
+ async function notesAfterTurn() {
15718
+ // In a conversation's window the turn ended here, and the room around it is told to look.
15719
+ if (SPLIT_CHAT) { try { window.parent?.postMessage({ madre: 'notes' }, location.origin); } catch { /* not in a frame of the room */ } return; }
15720
+ if (modules.items.find((one) => one.id === 'reminders')?.status?.installed) void loadReminders();
15721
+ if (!notesOn()) return;
15722
+ const answer = await fetch('/api/notes', { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null)).catch(() => null);
15723
+ if (!answer) return;
15724
+ const known = new Set(notesKit.items.map((one) => one.id));
15725
+ const fresh = (answer.notes ?? []).filter((one) => !known.has(one.id));
15726
+ if (!fresh.length) return;
15727
+ notesKit.items = answer.notes;
15728
+ for (const note of fresh) if (note.open) openNoteWindow(note.id);
15729
+ drawNotesSheets();
15730
+ }
15731
+ // A conversation's window says its turn ended: only a frame of this page, from this same address.
15732
+ window.addEventListener?.('message', (event) => {
15733
+ if (SPLIT_CHAT || event.origin !== location.origin || event.data?.madre !== 'notes') return;
15734
+ if ([...document.querySelectorAll('iframe')].some((frame) => frame.contentWindow === event.source)) void notesAfterTurn();
15735
+ });
15736
+ async function saveNote(change) {
15737
+ const answer = await fetch('/api/notes', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(change) })
15738
+ .then(async (response) => ({ ok: response.ok, body: await response.json().catch(() => ({})) })).catch(() => ({ ok: false, body: {} }));
15739
+ if (!answer.ok) { toast(answer.body.error ?? t('The note was not saved.')); return null; }
15740
+ const note = answer.body.note;
15741
+ const at = notesKit.items.findIndex((one) => one.id === note.id);
15742
+ if (at >= 0) notesKit.items[at] = note; else notesKit.items.push(note);
15743
+ drawNotesSheets();
15744
+ return note;
15745
+ }
15746
+ async function newNote(color = null, seed = {}) {
15747
+ const used = new Set(notesKit.items.map((one) => one.color));
15748
+ const note = await saveNote({ color: color ?? NOTE_COLORS.find((one) => !used.has(one)) ?? NOTE_COLORS[notesKit.items.length % NOTE_COLORS.length], ...seed });
15749
+ if (!note) return;
15750
+ openNoteWindow(note.id);
15751
+ notesKit.windows.get(note.id)?.text.focus();
15752
+ }
15753
+ // Its text is saved as it is written, half a second after the last key.
15754
+ function saveNoteText(id, text) {
15755
+ clearTimeout(notesKit.timers.get(id));
15756
+ notesKit.timers.set(id, setTimeout(() => { notesKit.timers.delete(id); void saveNote({ id, text }); }, 500));
15757
+ }
15758
+ function openNoteWindow(id) {
15759
+ const note = notesKit.items.find((one) => one.id === id);
15760
+ if (!note) return;
15761
+ let entry = notesKit.windows.get(id);
15762
+ if (!entry) {
15763
+ const node = el('dialog', 'surface window module-window note-window');
15764
+ node.dataset.color = note.color;
15765
+ const head = el('header', 'module-window-head custom-head note-head');
15766
+ const title = el('div', 'module-window-title');
15767
+ const name = el('b', null, noteTitle(note));
15768
+ title.append(name);
15769
+ const group = el('span', 'surface-modes');
15770
+ const arrange = el('button', 'surface-mode window');
15771
+ arrange.type = 'button';
15772
+ arrange.innerHTML = FLOAT_ICON; // trusted: our own SVG string
15773
+ arrange.setAttribute('aria-pressed', 'true');
15774
+ arrange.setAttribute('aria-label', t('Arrange the windows'));
15775
+ arrange.addEventListener('click', (event) => { event.stopPropagation(); showArrange(arrange, { owner: () => node }); });
15776
+ arrangeOnHover(arrange, { owner: () => node });
15777
+ // Thrown away from the note itself, beside its ×: the two keys of a note.
15778
+ const trash = el('button', 'surface-mode note-delete');
15779
+ trash.type = 'button';
15780
+ trash.innerHTML = TRASH_ICON; // trusted: our own SVG string
15781
+ trash.setAttribute('aria-label', t('Delete the note'));
15782
+ trash.title = t('Delete the note');
15783
+ trash.addEventListener('click', (event) => { event.stopPropagation(); void deleteNote(id); });
15784
+ group.append(arrange, el('span', 'surface-sep'), trash);
15785
+ const close = el('button', 'close', t('Close the note'));
15786
+ close.type = 'button';
15787
+ close.addEventListener('click', () => { closeNoteWindow(id); void saveNote({ id, open: false }); });
15788
+ joinClose(group, close);
15789
+ head.append(title, group);
15790
+ const body = el('div', 'note-body');
15791
+ const text = el('textarea', 'note-text');
15792
+ text.value = note.text;
15793
+ text.placeholder = t('Write here…');
15794
+ text.setAttribute('aria-label', t('Note'));
15795
+ text.addEventListener('input', () => { name.textContent = noteTitle({ text: text.value }); saveNoteText(id, text.value); });
15796
+ const colors = el('div', 'note-colors');
15797
+ colors.setAttribute('role', 'radiogroup');
15798
+ colors.setAttribute('aria-label', t('Color'));
15799
+ for (const color of NOTE_COLORS) {
15800
+ const dot = el('button', 'note-dot');
15801
+ dot.type = 'button';
15802
+ dot.dataset.color = color;
15803
+ dot.setAttribute('role', 'radio');
15804
+ dot.setAttribute('aria-label', NOTE_COLOR_WORDS[color]());
15805
+ dot.addEventListener('click', () => {
15806
+ node.dataset.color = color;
15807
+ for (const other of colors.children) other.setAttribute('aria-checked', String(other === dot));
15808
+ void saveNote({ id, color });
15809
+ });
15810
+ colors.append(dot);
15811
+ }
15812
+ body.append(text, colors);
15813
+ node.append(head, body);
15814
+ (document.querySelector('#settings')?.parentElement ?? document.body).append(node);
15815
+ entry = { node, text, name, colors, box: null };
15816
+ notesKit.windows.set(id, entry);
15817
+ const place = (box) => { entry.box = clampWindowBox(box, { minW: 220, minH: 180 }); applyWindowBox(node, entry.box); };
15818
+ const done = () => void saveNote({ id, box: entry.box });
15819
+ carryWindowBy(head, node, { box: () => entry.box, place, done });
15820
+ windowEdgesFor(node, { box: () => entry.box, place, done, minW: 220, minH: 180 });
15821
+ entry.place = place;
15822
+ node.addEventListener('pointerdown', () => bringWindowForward(node));
15823
+ node.addEventListener('cancel', (event) => { event.preventDefault(); closeNoteWindow(id); void saveNote({ id, open: false }); });
15824
+ }
15825
+ const { node } = entry;
15826
+ node.dataset.color = note.color;
15827
+ for (const dot of entry.colors.children) dot.setAttribute('aria-checked', String(dot.dataset.color === note.color));
15828
+ if (!node.open) {
15829
+ if (DIALOG) DIALOG.show.call(node); else node.show?.();
15830
+ node.classList.add('entering');
15831
+ setTimeout(() => node.classList.remove('entering'), motion(460));
15832
+ // A new note lands a little lower and to the left of the one before, never on top of it.
15833
+ const open = [...notesKit.windows.values()].filter((one) => one.node.open).length;
15834
+ const w = Math.min(280, window.innerWidth - 32);
15835
+ const h = Math.min(260, window.innerHeight - 96);
15836
+ // A note left larger than this screen, or partly off it, comes back whole and inside it.
15837
+ const kept = note.box ? { ...note.box, w: Math.min(note.box.w, window.innerWidth - 32), h: Math.min(note.box.h, window.innerHeight - 96) } : null;
15838
+ if (kept) kept.x = Math.min(Math.max(16, kept.x), Math.max(16, window.innerWidth - kept.w - 16));
15839
+ entry.place(kept ?? { x: Math.max(16, window.innerWidth - w - 40 - 28 * open), y: 96 + 28 * open, w, h });
15840
+ if (!note.open) void saveNote({ id, open: true });
15841
+ }
15842
+ bringWindowForward(node);
15843
+ }
15844
+ function closeNoteWindow(id) {
15845
+ const entry = notesKit.windows.get(id);
15846
+ if (!entry?.node.open) return;
15847
+ entry.node.close();
15848
+ dropWindow(entry.node);
15849
+ }
15850
+ async function deleteNote(id) {
15851
+ const note = notesKit.items.find((one) => one.id === id);
15852
+ clearTimeout(notesKit.timers.get(id));
15853
+ const entry = notesKit.windows.get(id);
15854
+ const text = entry?.text.value ?? note?.text ?? '';
15855
+ const answer = await fetch('/api/notes/delete', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id }) }).then((response) => response.ok).catch(() => false);
15856
+ if (!answer) { toast(t('The note was not deleted.')); return; }
15857
+ closeNoteWindow(id);
15858
+ entry?.node.remove();
15859
+ notesKit.windows.delete(id);
15860
+ notesKit.items = notesKit.items.filter((one) => one.id !== id);
15861
+ drawNotesSheets();
15862
+ // Thrown away by mistake: it comes back, as it was, from the toast.
15863
+ if (text.trim()) toast(t('Note deleted.'), { action: { label: t('Undo'), run: () => void newNote(note?.color, { text, box: entry?.box ?? note?.box ?? undefined }) } });
15864
+ }
15865
+ // The module's sheet (Modules › Notes, and its window): every note of the project, the open ones
15866
+ // brought forward, the closed ones opened again, and a new one.
15867
+ function notesBlock(host, item) {
15868
+ if (!moduleOn(item)) return;
15869
+ const add = sxButton(t('New note'), () => void newNote(), { tone: 'primary' });
15870
+ const block = sxBlock(host, t('Your notes'), notesKit.items.length ? t('{n} in this project. Only you read them.', { n: notesKit.items.length }) : t('None yet. A new one opens as a window you can move anywhere.'), { aside: add, className: 'notes-sheet' });
15871
+ const list = [...notesKit.items].sort((a, b) => String(b.at).localeCompare(String(a.at)));
15872
+ for (const note of list) {
15873
+ const row = sxRow(block, noteTitle(note), note.open ? t('Open') : t('Closed'), sxButton(note.open ? t('Bring forward') : t('Open'), () => openNoteWindow(note.id)));
15874
+ const dot = el('span', 'note-dot static');
15875
+ dot.dataset.color = note.color;
15876
+ row.prepend(dot);
15877
+ }
15878
+ }
15879
+ // REMINDERS (src/modules/reminders.mjs, 0.1, 2026-10-20 · an idea by Daniel Castillo). Under a
15880
+ // message that holds something pending, a card offers the reminder with its time already chosen:
15881
+ // one press sets it. When one is due, the project it came from says so the moment it opens, and
15882
+ // Home says it for every project.
15883
+ const reminderCards = new Map();
15884
+ const reminderLocale = () => (document.documentElement.lang === 'en' ? 'en-US' : 'es-MX');
15885
+ const reminderWhen = (due) => new Intl.DateTimeFormat(reminderLocale(), { weekday: 'long', day: 'numeric', month: 'long', hour: 'numeric', minute: '2-digit' }).format(new Date(due));
15886
+ const reminderHour = (due) => new Intl.DateTimeFormat(reminderLocale(), { hour: 'numeric', minute: '2-digit' }).format(new Date(due));
15887
+ const REPEAT_WORDS = { daily: () => t('every day'), weekdays: () => t('every weekday'), weekly: () => t('every week') };
15888
+ const whenLine = (due, repeat) => (repeat ? `${REPEAT_WORDS[repeat]?.() ?? ''} · ${reminderHour(due)}` : reminderWhen(due));
15889
+ // «Later», as long as Reminders' settings say, and tomorrow at the hour a day starts there.
15890
+ const laterWords = (minutes) => (minutes === 60 ? t('In an hour') : minutes > 60 ? t('In {n} hours', { n: Math.round(minutes / 60) }) : t('In {n} minutes', { n: minutes }));
15891
+ const tomorrowAt = (hour = 9) => { const next = new Date(); next.setDate(next.getDate() + 1); next.setHours(hour, 0, 0, 0); return next; };
15892
+ // The other times a card offers beside its own: in an hour, this evening, tomorrow, Monday.
15893
+ function quickReminderTimes(now = new Date()) {
15894
+ const at = (days, hour) => { const next = new Date(now); next.setDate(next.getDate() + days); next.setHours(hour, 0, 0, 0); return next; };
15895
+ const out = [{ label: t('In an hour'), due: new Date(now.getTime() + 3600000) }];
15896
+ if (at(0, 18) > new Date(now.getTime() + 30 * 60000)) out.push({ label: t('This evening'), due: at(0, 18) });
15897
+ out.push({ label: t('Tomorrow morning'), due: at(1, remindersKit.prefs.hour) });
15898
+ out.push({ label: t('On Monday'), due: at(((8 - now.getDay()) % 7) || 7, remindersKit.prefs.hour) });
15899
+ return out;
15900
+ }
15901
+ function renderReminderOffer(payload) {
15902
+ const card = el('div', 'system market-offer reminder-offer');
15903
+ const words = el('div', 'market-offer-words');
15904
+ const acts = el('div', 'market-offer-acts');
15905
+ card.append(appIcon({ id: 'reminders' }, 40), words, acts);
15906
+ const entry = { card, words, acts, payload };
15907
+ reminderCards.set(payload.offer, entry);
15908
+ const answer = async (choice, keys) => {
15909
+ for (const key of keys) key.disabled = true;
15910
+ const reply = await fetch('/api/reminders/answer', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ offer: payload.offer, chat: SPLIT_CHAT ?? chats.active, text: payload.what, why: payload.why, ...choice }) })
15911
+ .then(async (response) => ({ ok: response.ok, body: await response.json().catch(() => ({})) })).catch(() => ({ ok: false, body: {} }));
15912
+ if (!reply.ok) { toast(reply.body.error ?? t('The reminder was not set.')); for (const key of keys) key.disabled = false; return; }
15913
+ settleReminderOffer(reply.body);
15914
+ void loadReminders();
15915
+ };
15916
+ const ask = () => {
15917
+ words.replaceChildren(el('b', null, payload.why === 'frequent' ? t('You ask for this often. Shall I remind you?') : t('Shall I remind you?')), el('span', null, `${payload.what} · ${whenLine(payload.due, payload.repeat)}`));
15918
+ const yes = el('button', 'primary', t('Remind me'));
15919
+ const other = el('button', null, t('Another time'));
15920
+ const no = el('button', 'quiet', t('No, thanks'));
15921
+ for (const key of [yes, other, no]) key.type = 'button';
15922
+ const keys = [yes, other, no];
15923
+ yes.addEventListener('click', () => void answer({ accept: true, due: payload.due, repeat: payload.repeat ?? null }, keys));
15924
+ no.addEventListener('click', () => void answer({ accept: false }, keys));
15925
+ // The other times, in the same row: still one press each.
15926
+ other.addEventListener('click', () => {
15927
+ acts.replaceChildren();
15928
+ const times = quickReminderTimes().map(({ label, due }) => { const key = el('button', null, label); key.type = 'button'; key.addEventListener('click', () => void answer({ accept: true, due: due.toISOString(), repeat: null }, times)); return key; });
15929
+ if (!payload.repeat) { const daily = el('button', null, t('Every day')); daily.type = 'button'; daily.addEventListener('click', () => void answer({ accept: true, due: payload.due, repeat: 'daily' }, times)); times.push(daily); }
15930
+ const back = el('button', 'quiet', t('Back'));
15931
+ back.type = 'button';
15932
+ back.addEventListener('click', ask);
15933
+ acts.append(...times, back);
15934
+ });
15935
+ acts.replaceChildren(yes, other, no);
15936
+ };
15937
+ ask();
15938
+ return card;
15939
+ }
15940
+ function settleReminderOffer(payload) {
15941
+ const entry = reminderCards.get(payload?.offer);
15942
+ if (!entry || entry.card.classList.contains('settled')) return;
15943
+ entry.card.classList.add('settled');
15944
+ entry.words.replaceChildren(el('b', null, payload.accepted ? t('Reminder set') : t('No reminder')), el('span', null, payload.accepted ? `${entry.payload.what} · ${whenLine(payload.due, payload.repeat)}` : t('Nothing was set. Ask any agent for one with /reminders.')));
15945
+ entry.acts.replaceChildren();
15946
+ }
15947
+
15948
+ // The due ones of this project, read when it opens and every minute after: one card at a time,
15949
+ // bottom right, until each is done or moved.
15950
+ const remindersKit = { list: [], done: [], prefs: { hour: 9, snooze: 60 }, at: 0, card: null };
15951
+ async function loadReminders() {
15952
+ // The card of what is due is the room's, once, never again inside a conversation's window.
15953
+ if (state.device || SPLIT_CHAT) return;
15954
+ const answer = await fetch('/api/reminders?done=1', { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null)).catch(() => null);
15955
+ if (!answer) return;
15956
+ remindersKit.list = answer.reminders ?? [];
15957
+ remindersKit.done = answer.done ?? [];
15958
+ if (answer.prefs) remindersKit.prefs = answer.prefs;
15959
+ drawDueReminder();
15960
+ if (modules.open === 'reminders' && modules.dialog.open) renderModules();
15961
+ if (moduleWindows.get('reminders')?.node.open) drawModuleWindow('reminders');
15962
+ }
15963
+ async function actOnReminder(path, payload) {
15964
+ const ok = await fetch(path, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(payload) }).then((response) => response.ok).catch(() => false);
15965
+ if (!ok) toast(t('The reminder did not change.'));
15966
+ await loadReminders();
15967
+ }
15968
+ function drawDueReminder() {
15969
+ const due = remindersKit.list.filter((one) => Date.parse(one.due) <= Date.now());
15970
+ if (!due.length) { remindersKit.card?.remove(); remindersKit.card = null; return; }
15971
+ remindersKit.at = Math.min(remindersKit.at, due.length - 1);
15972
+ const one = due[remindersKit.at];
15973
+ const card = remindersKit.card ?? el('aside', 'reminder-due');
15974
+ card.setAttribute('role', 'status');
15975
+ card.replaceChildren();
15976
+ const head = el('div', 'reminder-due-head');
15977
+ head.append(appIcon({ id: 'reminders' }, 28), el('b', null, t('Reminder')));
15978
+ if (due.length > 1) {
15979
+ const next = el('button', 'reminder-due-next', t('{n} of {total}', { n: remindersKit.at + 1, total: due.length }));
15980
+ next.type = 'button';
15981
+ next.addEventListener('click', () => { remindersKit.at = (remindersKit.at + 1) % due.length; drawDueReminder(); });
15982
+ head.append(next);
15983
+ }
15984
+ const acts = el('div', 'reminder-due-acts');
15985
+ const key = (words, tone, run) => { const button = el('button', tone, words); button.type = 'button'; button.addEventListener('click', () => { button.disabled = true; void run(); }); acts.append(button); };
15986
+ key(one.repeat ? t('Done for today') : t('Done'), 'primary', () => actOnReminder('/api/reminders/done', { id: one.id }));
15987
+ key(laterWords(remindersKit.prefs.snooze), null, () => actOnReminder('/api/reminders/snooze', { id: one.id, minutes: remindersKit.prefs.snooze }));
15988
+ key(t('Tomorrow'), null, () => actOnReminder('/api/reminders/snooze', { id: one.id, until: tomorrowAt(remindersKit.prefs.hour).toISOString() }));
15989
+ card.append(head, el('p', 'reminder-due-text', one.text), el('small', null, whenLine(one.due, one.repeat)), acts);
15990
+ if (!remindersKit.card) { document.body.append(card); remindersKit.card = card; }
15991
+ }
15992
+ // Unref'd, as the budget's ticker: under Node (the UI smoke test) a page's clock must not keep it alive.
15993
+ if (!state.device) { const ticker = setInterval(() => { if (!document.hidden) void loadReminders(); }, 60000); ticker.unref?.(); }
15994
+ // Modules › Reminders: what is coming, each with its keys, and one to write by hand.
15995
+ function remindersBlock(host, item) {
15996
+ const form = el('form', 'reminders-new');
15997
+ const input = el('input');
15998
+ input.type = 'text';
15999
+ input.maxLength = 200;
16000
+ input.placeholder = t('What and when: «tomorrow at 5 call Daniel»');
16001
+ input.setAttribute('aria-label', t('New reminder'));
16002
+ const add = el('button', 'sx-btn primary', t('Add'));
16003
+ add.type = 'submit';
16004
+ form.append(input, add);
16005
+ form.addEventListener('submit', async (event) => {
16006
+ event.preventDefault();
16007
+ const text = input.value.trim();
16008
+ if (!text) return;
16009
+ add.disabled = true;
16010
+ const ok = await fetch('/api/reminders', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ text }) }).then((response) => response.ok).catch(() => false);
16011
+ add.disabled = false;
16012
+ if (!ok) { toast(t('The reminder was not set.')); return; }
16013
+ input.value = '';
16014
+ await loadReminders();
16015
+ });
16016
+ const block = sxBlock(host, t('Coming up'), remindersKit.list.length ? t('{n} in this project. Home shows them for every project.', { n: remindersKit.list.length }) : moduleOn(item) ? t('None yet. When you write something you still have to do, a card offers the reminder.') : t('Turn it on and a card offers a reminder when you write something you still have to do.'), { className: 'reminders-sheet' });
16017
+ block.rows.append(form);
16018
+ for (const one of remindersKit.list) {
16019
+ const keys = el('span', 'reminders-keys');
16020
+ // Moved to another time in one choice, as a card offers it.
16021
+ const move = el('select', 'sx-input reminders-move');
16022
+ move.setAttribute('aria-label', t('Move it'));
16023
+ move.append(el('option', null, t('Move…')));
16024
+ for (const time of quickReminderTimes()) { const option = el('option', null, time.label); option.value = time.due.toISOString(); move.append(option); }
16025
+ move.addEventListener('change', () => { if (move.value) { move.disabled = true; void actOnReminder('/api/reminders/snooze', { id: one.id, until: move.value }); } });
16026
+ const done = sxButton(one.repeat ? t('Done for today') : t('Done'), () => void actOnReminder('/api/reminders/done', { id: one.id }));
16027
+ const drop = sxButton(t('Delete'), () => void actOnReminder('/api/reminders/delete', { id: one.id }));
16028
+ keys.append(move, done, drop);
16029
+ const late = Date.parse(one.due) <= Date.now();
16030
+ sxRow(block, one.text, `${late ? `${t('Due')} · ` : ''}${whenLine(one.due, one.repeat)}`, keys);
16031
+ }
16032
+ // What was done, newest first: brought back with one press, or cleared.
16033
+ if (remindersKit.done.length) {
16034
+ const clear = sxButton(t('Clear'), () => void actOnReminder('/api/reminders/clear-done', {}));
16035
+ const history = sxBlock(host, t('Already done'), t('The last ones you marked done in this project.'), { aside: clear, className: 'reminders-sheet' });
16036
+ for (const one of remindersKit.done.slice(0, 10)) {
16037
+ const again = sxButton(t('Again tomorrow'), () => void actOnReminder('/api/reminders/snooze', { id: one.id, until: tomorrowAt(remindersKit.prefs.hour).toISOString() }));
16038
+ sxRow(history, one.text, t('Done {when}', { when: reminderWhen(one.done) }), again);
16039
+ }
16040
+ }
16041
+ }
16042
+ function drawNotesSheets() {
16043
+ if (modules.open === 'notes' && modules.dialog.open) renderModules();
16044
+ if (moduleWindows.get('notes')?.node.open) drawModuleWindow('notes');
16045
+ }
16046
+
15364
16047
  // Create your module: the guide, in its own dialog over the board. What a module is, the two ways
15365
16048
  // to make one, where it lives, and the button that loads it — then yours, and what failed.
15366
16049
  const moduleGuide = document.querySelector('#module-guide');
@@ -15528,6 +16211,21 @@ function openModules() {
15528
16211
  }
15529
16212
  bringWindowForward(node);
15530
16213
  modules.button.setAttribute('aria-pressed', 'true');
16214
+ inviteToMarket();
16215
+ }
16216
+ // THE MARKET, MET (1.0.5): the first time someone opens Modules, a card beside the Market's key
16217
+ // says what it is in plain words. Once per person (hintSeen); after any card already showing.
16218
+ // Whoever knew MADRE before had the Market already: they are told only what is new (2026-10-21).
16219
+ let marketInviteTries = 0;
16220
+ function inviteToMarket(delay = 900) {
16221
+ if (state.device || hintsSeen().market || roomTour().returning()) return;
16222
+ setTimeout(() => {
16223
+ const key = modules.dialog?.querySelector('.mods-market');
16224
+ if (!modules.dialog?.open || !key?.getClientRects().length || hintsSeen().market) return;
16225
+ if (document.querySelector('.hint-card, .tour-hint')) { if ((marketInviteTries += 1) <= 6) inviteToMarket(4000); return; }
16226
+ hintSeen('market');
16227
+ showFirstTouch({ title: t('Discover the Market'), text: t('More things your project can do, ready to use: see your page in a browser, make images, keep notes, get reminders and more. Most are free. Pick one and turn it on here; you can turn it off whenever you want.') }, key);
16228
+ }, motion(delay));
15531
16229
  }
15532
16230
  function closeModules() {
15533
16231
  const node = modules.dialog;
@@ -15564,8 +16262,11 @@ function openRoomMarket(focus = null) {
15564
16262
  const head = modules.dialog?.querySelector('.mods-head');
15565
16263
  const add = head?.querySelector('#modules-add');
15566
16264
  if (head && add) {
15567
- const market = el('button', 'sx-btn mods-market', t('Market'));
16265
+ const market = el('button', 'sx-btn mods-market');
15568
16266
  market.type = 'button';
16267
+ // The Market's basket, as on Home's bar (salas-mac.html), beside its word.
16268
+ market.innerHTML = '<svg viewBox="0 0 20 20" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><g class="ic-basket"><g class="ic-mods" stroke-width="1.4"><rect class="ic-m1" x="4.4" y="5.2" width="3.4" height="3.4" rx="1"/><circle class="ic-m2" cx="10" cy="5.3" r="1.8"/><rect class="ic-m3" x="12.2" y="5.2" width="3.4" height="3.4" rx="1"/></g><path d="M2.8 10.4h14.4l-1.5 5.4a1.6 1.6 0 0 1-1.6 1.2H5.9a1.6 1.6 0 0 1-1.6-1.2z"/><path d="M7.6 13v1.6M10 13v1.6M12.4 13v1.6" stroke-width="1.3"/></g></svg>'; // trusted: our own SVG string
16269
+ market.append(el('span', null, t('Market')));
15569
16270
  market.title = t('Every module MADRE can add to this project');
15570
16271
  market.addEventListener('click', () => openRoomMarket());
15571
16272
  add.before(market);
@@ -15908,7 +16609,7 @@ function renderLoginEvent(event) {
15908
16609
  tint(node, agent);
15909
16610
  node.append(el('b', null, t('connections › ')));
15910
16611
  node.append(finished
15911
- ? (ok ? t('@{agent} signed in', { agent }) + (session?.detail ? ` · ${session.detail}` : '') : t('@{agent} sign-in did not complete', { agent }) + (error ? ` · ${error}` : code ? t(' · exit {code}', { code }) : ''))
16612
+ ? (ok ? t('@{agent} signed in', { agent }) + (sessionDetail(session) ? ` · ${sessionDetail(session)}` : '') : t('@{agent} sign-in did not complete', { agent }) + (error ? ` · ${error}` : code ? t(' · exit {code}', { code }) : ''))
15912
16613
  : t('signing in @{agent} · {command}', { agent, command }));
15913
16614
  if (finished) { state.sessions[agent] = session ?? state.sessions[agent]; renderAgents(); renderPicker(); renderOnboarding(); if (state.settingsOpen) void loadSettings(); }
15914
16615
  if (!replaying) {
@@ -15965,8 +16666,15 @@ function appendLoginOutput(event) {
15965
16666
  if (url && !replaying) toast(t('@{agent}: open {url} to finish signing in', { agent, url }));
15966
16667
  }
15967
16668
  const HEARTBEAT = /^… still running · \d+s · /;
16669
+ // MADRE's own «still running» line (src/extensions.mjs, runInstaller), said in the room's language;
16670
+ // what the installer itself printed stays as it printed it (2026-10-20).
16671
+ function saidLine(line) {
16672
+ const beat = String(line ?? '').match(/^… still running · (\d+)s · (.*)$/);
16673
+ return beat ? t('… still running · {seconds}s · {note}', { seconds: beat[1], note: t(beat[2]) }) : line;
16674
+ }
15968
16675
  function loginLine({ line, url }) {
15969
16676
  const div = el('div', HEARTBEAT.test(line ?? '') ? 'beat' : null);
16677
+ line = saidLine(line);
15970
16678
  if (url) {
15971
16679
  const a = el('a', null, line); a.href = url; a.target = '_blank'; a.rel = 'noopener noreferrer';
15972
16680
  div.append(a);
@@ -17198,7 +17906,7 @@ function connectionCard(agent) {
17198
17906
  const where = el('code', null, agent.detected ? `${agent.version ?? t('version unknown')} · ${agent.path}` : (agent.login?.install ?? []).join(' · '));
17199
17907
  where.title = where.textContent;
17200
17908
  meta.append(where);
17201
- const facts = [session?.detail ? t('Session {detail}', { detail: session.detail }) : null, agent.account ? `${agent.paid === false ? `${t('Free plan')} · ` : ''}${agent.account}` : null].filter(Boolean);
17909
+ const facts = [sessionDetail(session) ? t('Session {detail}', { detail: sessionDetail(session) }) : null, agent.account ? `${agent.paid === false ? `${t('Free plan')} · ` : ''}${agent.account}` : null].filter(Boolean);
17202
17910
  if (facts.length) meta.append(el('span', null, facts.join(' · ')));
17203
17911
  card.append(meta);
17204
17912
  const body = el('div', 'sx-agent-body');
@@ -17271,7 +17979,7 @@ function connectionCard(agent) {
17271
17979
  if (result?.sessions) renderSettings();
17272
17980
  recheck.disabled = false;
17273
17981
  });
17274
- if (!agent.detected && agent.install) {
17982
+ if (!agent.detected && agent.install?.command) {
17275
17983
  const install = sxButton(t('Install'), async () => {
17276
17984
  install.disabled = true;
17277
17985
  state.loginLogs.set(agent.id, []);
@@ -17742,6 +18450,8 @@ function drawOpenCodeSettings(host, s) {
17742
18450
  }
17743
18451
  // One line per provider OpenCode can answer through: its name and how it is connected, its
17744
18452
  // switch for the chat, and the way its key comes out (an account is signed out in OpenCode).
18453
+ // What went wrong with a provider the last time a turn used it (src/opencode-health.mjs).
18454
+ const openCodeTrouble = (provider) => (provider.problem === 'no-credit' ? t('No credit left: its turns are refused') : provider.problem === 'bad-key' ? t('Its key is no longer valid') : null);
17745
18455
  function openCodeProviderRow(provider, reload, hidden) {
17746
18456
  const row = el('div', 'oc-provider');
17747
18457
  const words = el('div', 'sx-words');
@@ -17750,7 +18460,8 @@ function openCodeProviderRow(provider, reload, hidden) {
17750
18460
  : provider.via === 'oauth' ? t('Connected with its account · {n} models', { n: provider.models.length })
17751
18461
  : t('Connected · {n} models', { n: provider.models.length });
17752
18462
  words.append(el('b', null, provider.label), el('span', 'sx-hint', status));
17753
- if (provider.via === 'oauth') words.lastChild.title = t('Signed in with its account from OpenCode. To sign it out, run `opencode auth logout` in a terminal.');
18463
+ if (openCodeTrouble(provider)) words.append(el('span', 'oc-problem', openCodeTrouble(provider)));
18464
+ if (provider.via === 'oauth') words.querySelector('.sx-hint').title = t('Signed in with its account from OpenCode. To sign it out, run `opencode auth logout` in a terminal.');
17754
18465
  row.append(words);
17755
18466
  const controls = el('div', 'oc-controls');
17756
18467
  if (provider.via === 'api') {
@@ -19200,6 +19911,12 @@ async function forgetFromCard(card, button) {
19200
19911
 
19201
19912
 
19202
19913
  document.querySelector('#tour-button')?.addEventListener('click', () => { document.querySelector('#mother')?.close?.(); stepsResume(); roomTour().openChapters(); });
19914
+ // What Switch project is, once; for someone new, after the walk of the way in (showNewHints), not
19915
+ // before its first card (2026-10-21).
19916
+ function saySwitch() {
19917
+ if (isNewcomer() && GUIDE_HINTS.some((hint) => !hintsSeen()[hint.id])) return;
19918
+ if (switcher.key && !document.querySelector('dialog[open]')) void roomTour().hint('switch', switcher.key, { title: t('Switch project'), text: t('Takes you to another open project. Its light turns on when that project needs you or finishes something.') });
19919
+ }
19203
19920
  function maybeStartTour() {
19204
19921
  // The half on the right of a split window is the same room; the left half already did this.
19205
19922
  // A phone gets the room as it is: the tour points at keys that live on the Mac.
@@ -19215,7 +19932,7 @@ function maybeStartTour() {
19215
19932
  if (answer?.owed) { await roomTour().maybeBonjour(); return; }
19216
19933
  if (answer?.state?.bonjourAt) {
19217
19934
  const shown = await maybeShowWhatsNew();
19218
- if (!shown) setTimeout(() => { if (switcher.key && !document.querySelector('dialog[open]')) void roomTour().hint('switch', switcher.key, { title: t('Switch project'), text: t('It takes you to another open project. Its light tells you when one needs you or finishes while you are here.') }); }, 2400);
19935
+ if (!shown) setTimeout(saySwitch, 2400);
19219
19936
  return;
19220
19937
  }
19221
19938
  // The welcome could not be read: the news of this version, if any (the five-stop tour that
@@ -19258,82 +19975,141 @@ function roomTour() {
19258
19975
  // what it is for. Once per button: after that the button is just a button. From 1.1 every key of
19259
19976
  // the bar that opens something says so too (2026-10-14).
19260
19977
  const FIRST_TOUCH = {
19978
+ // Code (1.0.3) said nothing the first time it opened, and nor did Outside tools (2026-10-21).
19979
+ code: {
19980
+ button: '#code-button',
19981
+ panel: '#viewer',
19982
+ title: t('Code'),
19983
+ text: t('Your project\'s files, beside the chat. ⌘ P finds one by its name. Click a line number and press ASK to ask an agent about it. What an agent changed shows in its colour.'),
19984
+ },
19985
+ mcp: {
19986
+ // Not a key of the bar: said the first time its page opens in Settings (openSettingsCategory).
19987
+ button: '#settings .settings-detail-head',
19988
+ title: t('Outside tools (MCP)'),
19989
+ text: t('Connect your agents to GitHub, Notion, your calendar and other apps. Pick one from the list and press Connect; «Check the connection» tells you whether it works.'),
19990
+ },
19261
19991
  settings: {
19262
19992
  button: '#custom-button',
19263
19993
  panel: '#settings',
19264
19994
  title: t('Settings'),
19265
- text: t('Everything this project uses, in one window: appearance, agents, memory, permissions, privacy and version. Press / to search any setting.'),
19995
+ text: t('How this project looks and works. Type in the search to find a setting by its name, such as «accent» or «permissions».'),
19266
19996
  },
19267
19997
  modules: {
19268
19998
  button: '#modules-button',
19269
19999
  panel: '#modules',
19270
20000
  title: t('Modules'),
19271
- text: t('Extra features for this project, like apps. Each tile says what it does and what it needs; nothing is installed until you ask.'),
20001
+ text: t('Features you turn on when you need them. Press a tile to read what it does before you switch it on.'),
19272
20002
  },
19273
20003
  mother: {
19274
20004
  button: '#mother-button',
19275
20005
  panel: '#mother',
19276
20006
  title: t('Diagnostics'),
19277
- text: t('When something fails, describe it in your own words: Diagnostics says what is going on and gives you the button that fixes it.'),
20007
+ text: t('When something goes wrong, write it as you see it, for example «Claude asks me to sign in». Diagnostics finds the case and tells you what to do.'),
19278
20008
  },
19279
20009
  memory: {
19280
20010
  button: '#nostromo-bar',
19281
20011
  title: t('Memory map'),
19282
- text: t('Everything MADRE remembers about this project, as stars. Drag to turn it, use the wheel to zoom in, and click a star to read that memory.'),
20012
+ text: t('What MADRE remembers about this project, drawn as stars. Drag to turn it, scroll to come closer and click a star to read it.'),
19283
20013
  },
19284
20014
  crew: {
19285
20015
  button: '#agents-compact',
19286
20016
  title: t('Agents'),
19287
- text: t('The agents this project can call, and whether each one is ready. Their sessions are set in Settings › Agents.'),
20017
+ text: t('The agents this project can call, and which of them are ready. You sign in to them in Settings › Agents.'),
19288
20018
  },
19289
20019
  steps: {
19290
20020
  button: '#steps-pill',
19291
20021
  title: t('First steps'),
19292
- text: t('A short list to get the most out of MADRE. Each step is checked off on its own when you do it, and the pill goes away when you are done.'),
20022
+ text: t('A few things to try in your first days. Each one ticks itself off when you do it.'),
19293
20023
  },
19294
20024
  browser: {
19295
20025
  button: '#browser-button',
19296
20026
  title: t('The browser'),
19297
- text: t('See what you are building without leaving the project: the servers answering on this computer, in tabs, at phone, tablet or desktop width. To open the web, switch Preview on in MODULES.'),
20027
+ text: t('The pages you are building, inside MADRE: whatever runs on this computer, at phone, tablet or desktop width. For sites on the internet, turn on Preview in Modules.'),
19298
20028
  },
19299
20029
  tree: {
19300
20030
  button: '#tree-button',
19301
20031
  title: t('The project files'),
19302
- text: t('Your project as a tree. Click a file to read it, search by name, and right-click to copy, move, rename or create files and folders.'),
20032
+ text: t('Your project\'s folders and files. Click one to read it; right-click to copy, move or rename it, or to make a new one.'),
19303
20033
  },
19304
20034
  chats: {
19305
20035
  button: '#chats-button',
19306
20036
  panel: '#chats',
19307
20037
  title: t('Conversations, one memory'),
19308
- text: t('A project can hold many conversations and a single memory. Start a new one for a new subject: they all feed the same archive, and every agent recalls what was said in the others.'),
20038
+ text: t('Start a new chat for each subject. They all share the project\'s memory, so an agent in one knows what was decided in another.'),
19309
20039
  },
19310
20040
  };
20041
+ // What was seen is the person's, in ~/.pulse/tour.json (src/tour.mjs, HINTS), not this page's: a
20042
+ // page lives on one port, and a project opens on the first free one, so the cards came back with
20043
+ // every new port (2026-10-19). The page's own copy stays as the fallback, and what it already held
20044
+ // is carried to the person once (keptHints).
19311
20045
  const HINTS_KEY = 'madre.hints';
19312
- function hintsSeen() {
20046
+ const keptId = (id) => (/^(new|guide)-/.test(id) ? id : `touch-${id}`);
20047
+ const ownHint = (id) => id in FIRST_TOUCH || [...NEW_HINTS, ...GUIDE_HINTS].some((hint) => hint.id === id);
20048
+ function pageHints() {
19313
20049
  try { return JSON.parse(localStorage.getItem(HINTS_KEY) ?? '{}') ?? {}; } catch { return {}; }
19314
20050
  }
20051
+ // The page's own copy counts only for whoever met MADRE before the person's copy existed (1.0.4,
20052
+ // 2026-10-19). A port is reused by every MADRE that ever ran on this computer — another install, a
20053
+ // test, a project that held the port before — and what its storage kept made a new person's cards
20054
+ // count as seen before they were ever shown (2026-10-20).
20055
+ const HINTS_PERSONAL_SINCE = '2026-10-19';
20056
+ function pageHintsCount() {
20057
+ const at = roomTour().state()?.bonjourAt;
20058
+ return !at || at < HINTS_PERSONAL_SINCE;
20059
+ }
20060
+ function hintsSeen() {
20061
+ const seen = pageHintsCount() ? pageHints() : {};
20062
+ for (const id of Object.keys(roomTour().state()?.hints ?? {})) seen[id.startsWith('touch-') ? id.slice('touch-'.length) : id] = true;
20063
+ return seen;
20064
+ }
20065
+ function hintSeen(id) {
20066
+ try { localStorage.setItem(HINTS_KEY, JSON.stringify({ ...pageHints(), [id]: true })); } catch { /* the person's copy is enough */ }
20067
+ if (!state.device) void roomTour().seen(keptId(id)).catch(() => {});
20068
+ }
20069
+ async function keptHints() {
20070
+ await roomTour().loaded;
20071
+ if (!pageHintsCount()) return;
20072
+ const kept = roomTour().state()?.hints ?? {};
20073
+ for (const id of Object.keys(pageHints()).filter(ownHint)) if (!kept[keptId(id)]) await roomTour().seen(keptId(id)).catch(() => {});
20074
+ }
19315
20075
  function firstTouch(id) {
19316
- // Its cards speak of the Mac's own gestures (a right-click, a panel beside the room).
19317
- if (state.device) return;
20076
+ // Its cards speak of the Mac's own gestures (a right-click, a panel beside the room). Whoever knew
20077
+ // MADRE before knows its keys: they are told what is new, not what each key is (2026-10-21).
20078
+ if (state.device || roomTour().returning()) return;
19318
20079
  const hint = FIRST_TOUCH[id];
19319
20080
  const seen = hintsSeen();
19320
20081
  if (!hint || seen[id]) return;
19321
- try { localStorage.setItem(HINTS_KEY, JSON.stringify({ ...seen, [id]: true })); } catch { /* a private window gets the card every time */ }
20082
+ // Kept as seen only once there is something to point at: a page not drawn yet is not a card shown.
19322
20083
  const button = document.querySelector(hint.button);
19323
20084
  if (!button) return;
20085
+ hintSeen(id);
19324
20086
  // Said once what was pressed has opened: some open after a moment, and a modal window (the
19325
20087
  // Memory map) makes everything outside it unreachable, so the card goes inside that window.
19326
20088
  setTimeout(() => showFirstTouch(hint, button), 320);
19327
20089
  }
19328
- function showFirstTouch(hint, button) {
20090
+ // `step` of `of`: one of a short walk (showNewHints), said as «2 of 5» with «Next», and `skip`
20091
+ // puts the rest of it away.
20092
+ function showFirstTouch(hint, button, { step = 0, of = 0, skip = null } = {}) {
19329
20093
  document.querySelector('.hint-card')?.remove();
19330
20094
  document.querySelectorAll('.hint-spot').forEach((node) => node.remove());
19331
20095
  const card = el('section', 'hint-card');
19332
20096
  card.setAttribute('role', 'dialog');
19333
20097
  card.setAttribute('aria-label', hint.title);
19334
- const ok = el('button', 'hint-ok', t('Got it'));
20098
+ const walking = step > 0 && of > 1;
20099
+ const more = walking && step < of;
20100
+ const ok = el('button', 'hint-ok', more ? t('Next') : t('Got it'));
19335
20101
  ok.type = 'button';
19336
- card.append(el('h3', null, hint.title), el('p', null, hint.text), ok);
20102
+ if (walking) card.append(el('span', 'hint-step', t('{n} of {total}', { n: step, total: of })));
20103
+ card.append(el('h3', null, hint.title), el('p', null, hint.text));
20104
+ const keys = el('div', 'hint-keys');
20105
+ if (more && skip) {
20106
+ const away = el('button', 'hint-skip', t('Skip the tips'));
20107
+ away.type = 'button';
20108
+ away.addEventListener('click', () => { skip(); close(); });
20109
+ keys.append(away);
20110
+ }
20111
+ keys.append(ok);
20112
+ card.append(keys);
19337
20113
  const modal = [...document.querySelectorAll('dialog[open]')].reverse().find((one) => one.matches(':modal'));
19338
20114
  (modal ?? document.body).append(card);
19339
20115
  if (modal) card.classList.add('in-modal');
@@ -19387,12 +20163,46 @@ for (const id of Object.keys(FIRST_TOUCH)) document.querySelector(FIRST_TOUCH[id
19387
20163
  // notices). Only when the room is quiet — no dialog open, no
19388
20164
  // other card — one after the other, each pointing at where it lives.
19389
20165
  const NEW_HINTS = [
19390
- { id: 'new-copilot', button: '.copilot-chip', title: t('New: Copilot'), text: t('Let an agent work on its own for a while. Press the robot, choose how long, and the agent you write to can change files, make plans and run safe commands without asking you each time. It asks for your permission only once.') },
19391
- { id: 'new-mcp', button: '#custom-button', panel: '#settings', title: t('New: Outside tools (MCP)'), text: t('Agents can now use other apps and services: a program on this computer or one on the internet. Add them in Settings › Outside tools (MCP). If you already set some up in Claude Code, Codex, Gemini or Cursor, you can bring them over.') },
19392
- { id: 'new-finder', button: '#tree-button', spill: '.bar-more', title: t('New: your files stay up to date'), text: t('The file list updates by itself after every answer and every command. A colored dot on a folder tells you which agent changed something inside.') },
19393
- { id: 'new-memory-access', button: '#nostromo-bar', spill: '.bar-more', title: t('New: open the memory faster'), text: t('The Memory map asks you to type the project name before it opens. You can skip that step for 1, 8 or 24 hours, or for good: choose «Don\'t ask again…» when it asks, or go to Settings › Permissions.') },
19394
- { id: 'new-dots', button: '#messages .sys-dots:not(.open)', onScreen: true, title: t('New: notices shrink into dots'), text: t('To keep the chat clean, notices shrink into a small dot after 10 seconds. Click the dot to read them again. The ones that need something from you stay open.') },
20166
+ { id: 'new-copilot', level: '1.0.2', button: '.copilot-chip', title: t('New: Copilot'), text: t('Let an agent work on its own for a while. Press the robot, choose how long, and the agent you write to can change files, make plans and run safe commands without asking you each time. It asks for your permission only once.') },
20167
+ { id: 'new-mcp', level: '1.0.2', button: '#custom-button', panel: '#settings', title: t('New: Outside tools (MCP)'), text: t('Agents can now use other apps and services: a program on this computer or one on the internet. Add them in Settings › Outside tools (MCP). If you already set some up in Claude Code, Codex, Gemini or Cursor, you can bring them over.') },
20168
+ { id: 'new-finder', level: '1.0.2', button: '#tree-button', spill: '.bar-more', title: t('New: your files stay up to date'), text: t('The file list updates by itself after every answer and every command. A colored dot on a folder tells you which agent changed something inside.') },
20169
+ { id: 'new-memory-access', level: '1.0.2', button: '#nostromo-bar', spill: '.bar-more', title: t('New: open the memory faster'), text: t('The Memory map asks you to type the project name before it opens. You can skip that step for 1, 8 or 24 hours, or for good: choose «Don\'t ask again…» when it asks, or go to Settings › Permissions.') },
20170
+ { id: 'new-dots', level: '1.0.2', button: '#messages .sys-dots:not(.open)', onScreen: true, title: t('New: notices shrink into dots'), text: t('To keep the chat clean, notices shrink into a small dot after 10 seconds. Click the dot to read them again. The ones that need something from you stay open.') },
20171
+ // 1.0.5 (2026-10-21), for whoever met MADRE before it.
20172
+ { id: 'new-code-ask', level: '1.0.5', button: '#code-button', title: t('New in Code: ask about any line'), text: t('In Code, click a line number and press ASK. You choose the agent and what you want: that it explains the line, improves it, tests it or fixes it.') },
20173
+ { id: 'new-notes', level: '1.0.5', button: '#modules-button', spill: '.bar-more', title: t('New: Notes and Reminders'), text: t('Turn them on in Modules. Then write to an agent «remind me tomorrow at 5 to call the client», and MADRE tells you when the time comes.') },
20174
+ { id: 'new-connectors', level: '1.0.5', button: '#custom-button', panel: '#settings', title: t('New: connectors ready to use'), text: t('In Settings › Connectors (MCP) you now pick GitHub, Notion or your calendar from a list and connect it with one key.') },
20175
+ { id: 'new-manual', level: '1.0.5', button: '#custom-button', panel: '#settings', title: t('New: the user manual'), text: t('Pictures of MADRE with every step marked, for whenever you want to look something up. Settings › System › User manual, or as a PDF.') },
19395
20176
  ];
20177
+ // The way in, for whoever meets MADRE now (2026-10-21): once the bonjour is behind them and they
20178
+ // open a project, the box, who answers and how far it may go, one card after the other. Every other
20179
+ // key says what it is the first time it is pressed (FIRST_TOUCH).
20180
+ const GUIDE_HINTS = [
20181
+ { id: 'guide-talk', button: '#composer .field', title: t('Start here'), text: t('Write here what you need, the way you would ask a person. Try «explain what this project does». ↵ sends it.') },
20182
+ { id: 'guide-agent', button: '#picker', title: t('Who answers'), text: t('This circle is the agent that will answer you. Press it to pick another: Codex, Claude, Gemini, whichever you are signed in to.') },
20183
+ { id: 'guide-mode', button: '.picker .mode-chip', title: t('How far it may go'), text: t('With #1 the agent reads and answers, nothing more. When you want it to create or change files, raise it here; MADRE asks you first.') },
20184
+ // Code and the manual too (2026-10-21): the two things someone new asked for and did not find.
20185
+ // Each says once what its first touch would have said again (`touches`).
20186
+ { id: 'guide-code', button: '#code-button', spill: '.bar-more', touches: 'code', title: t('Code'), text: t('Your project\'s files open here, beside the chat. Click a line number and press ASK to ask an agent about it.') },
20187
+ { id: 'guide-manual', button: '#custom-button', title: t('The user manual'), text: t('To look something up later: Settings › System › User manual, with pictures of every step. Also as a PDF.') },
20188
+ ];
20189
+ // News is for whoever met MADRE before it came: someone back from 0.7.2 or 1.0, or someone who began
20190
+ // new before its version (`met`, written on the bonjour: src/tour.mjs, NEWS_LEVEL). Gated on the path
20191
+ // alone, it never reached anyone who had begun new — a person on 1.0.0 never heard of the copilot or
20192
+ // outside tools, nor someone on 1.0.4 of what 1.0.5 brings (2026-10-21).
20193
+ const NEWS_SINCE = '2026-10-16';
20194
+ const levelBelow = (a, b) => { const x = String(a).split('.').map(Number); const y = String(b).split('.').map(Number); for (let i = 0; i < 3; i += 1) if ((x[i] ?? 0) !== (y[i] ?? 0)) return (x[i] ?? 0) < (y[i] ?? 0); return false; };
20195
+ function isNewsFor(hint) {
20196
+ if (roomTour().path() !== 'new') return true;
20197
+ const met = roomTour().state()?.met;
20198
+ if (met) return levelBelow(met, hint.level);
20199
+ // A person from before `met` was written met MADRE before 1.0.5; 1.0.2's cards only if before it too.
20200
+ const at = roomTour().state()?.bonjourAt;
20201
+ return Boolean(at) && (hint.level !== '1.0.2' || at < NEWS_SINCE);
20202
+ }
20203
+ // Someone who met MADRE on this version (public/tour.js, newcomer): walked through the way in.
20204
+ // Whoever knew it before is told only what is new (2026-10-21).
20205
+ const isNewcomer = () => roomTour().newcomer();
19396
20206
  // Asked again while a card has nothing to point at, a few times only: a timer that never stops would
19397
20207
  // keep a page (and a test) alive for nothing.
19398
20208
  let newHintTries = 0;
@@ -19409,15 +20219,24 @@ function showNewHints(delay = 2500) {
19409
20219
  return box.width && box.bottom > 60 && box.top < window.innerHeight - 160;
19410
20220
  }).at(-1) ?? null;
19411
20221
  const anchorOf = (hint) => (hint.onScreen ? inView(hint.button) : shown(hint.button)) ?? shown(hint.spill);
19412
- const pending = NEW_HINTS.filter((hint) => !hintsSeen()[hint.id]);
20222
+ // One short walk, «2 of 5» and «Next» from one card to the other: the cards that have a place
20223
+ // on this page, in their order, the seen ones counted too.
20224
+ const walk = [...(isNewcomer() ? GUIDE_HINTS : []), ...NEW_HINTS.filter(isNewsFor)];
20225
+ const pending = walk.filter((hint) => !hintsSeen()[hint.id]);
19413
20226
  const next = pending.find(anchorOf);
20227
+ // The walk is over: what Switch project is, if it was held back for it.
20228
+ if (!pending.length) { if (isNewcomer()) saySwitch(); return; }
19414
20229
  // Nothing to point at yet (no folded notice, a key not on screen): asked again later.
19415
20230
  if (!next) { if (pending.length && (newHintTries += 1) <= 10) showNewHints(30000); return; }
19416
20231
  // Not over something the person is already reading: tried again later, never stacked.
19417
- if (document.querySelector('dialog[open], .hint-card') || !els.onboarding.hidden) { showNewHints(8000); return; }
19418
- try { localStorage.setItem(HINTS_KEY, JSON.stringify({ ...hintsSeen(), [next.id]: true })); } catch { return; }
20232
+ if (document.querySelector('dialog[open], .hint-card, .tour-hint') || !els.onboarding.hidden) { showNewHints(8000); return; }
20233
+ hintSeen(next.id);
20234
+ if (next.touches) hintSeen(next.touches);
19419
20235
  const behind = !next.onScreen && !shown(next.button);
19420
- showFirstTouch(behind ? { ...next, text: `${next.text} ${t('You\'ll find it under «More», on the top bar.')}` } : next, anchorOf(next));
20236
+ const here = walk.filter((hint) => hintsSeen()[hint.id] || anchorOf(hint));
20237
+ const step = here.indexOf(next) + 1;
20238
+ const skip = () => { for (const rest of here.slice(step)) { hintSeen(rest.id); if (rest.touches) hintSeen(rest.touches); } };
20239
+ showFirstTouch(behind ? { ...next, text: `${next.text} ${t('You\'ll find it under «More», on the top bar.')}` } : next, anchorOf(next), { step, of: here.length, skip });
19421
20240
  const card = document.querySelector('.hint-card');
19422
20241
  const watch = setInterval(() => { if (!card?.isConnected) { clearInterval(watch); showNewHints(600); } }, 400);
19423
20242
  watch?.unref?.();
@@ -19623,11 +20442,17 @@ function showWhatsNew(news, { after = null } = {}) {
19623
20442
  document.body.append(dialog);
19624
20443
  drawBoard();
19625
20444
  dialog.addEventListener('close', () => {
19626
- if (!news.preview) void fetch('/api/whats-new/seen', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' }).catch(() => null);
19627
20445
  dialog.remove();
19628
20446
  if (!board.went) after?.();
19629
20447
  });
19630
- setTimeout(() => { dialog.showModal(); cards[0]?.focus?.({ preventScroll: true }); body.scrollTop = 0; }, after ? 700 : 0);
20448
+ // Seen once it is shown, not once it is closed: a board left open when MADRE was turned off, the
20449
+ // page reloaded or the tab closed came back at the next start (2026-10-19).
20450
+ setTimeout(() => {
20451
+ dialog.showModal();
20452
+ if (!news.preview) void fetch('/api/whats-new/seen', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' }).catch(() => null);
20453
+ cards[0]?.focus?.({ preventScroll: true });
20454
+ body.scrollTop = 0;
20455
+ }, after ? 700 : 0);
19631
20456
  return dialog;
19632
20457
  }
19633
20458
 
@@ -19878,7 +20703,7 @@ const BAR_BUILT = {
19878
20703
  // They ride with the crew when it is there, and lead the keys when it is not: where they always were.
19879
20704
  const BAR_CONTEXTUAL = ['#steps-pill', '#tour-pill-slot', '#handoff-pill', '#update-pill', '#stop-all'];
19880
20705
  // A module's name before the board has answered; once it has, the module says its own.
19881
- const BAR_MODULE_NAMES = { ash: 'Token saver', ollama: 'Local AI', intents: 'Suggested effort' };
20706
+ const BAR_MODULE_NAMES = { ash: 'Token saver', ollama: 'Local AI', intents: 'Suggested effort', notes: 'Notes', reminders: 'Reminders' };
19882
20707
  const BAR_MINUS = '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 8h7" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>';
19883
20708
  // Its mirror on a key that can still go on the bar, in the card under it.
19884
20709
  const BAR_PLUS = '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 4.5v7M4.5 8h7" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>';
@@ -20126,7 +20951,7 @@ function switchState(room) {
20126
20951
  if (glance.waitingCount) return { key: 'waiting', count: glance.waitingCount, words: t('Waiting for you · {n}', { n: glance.waitingCount }) };
20127
20952
  if (glance.working?.length) return { key: 'working', words: glance.working.length === 1 ? t('@{agent} is working', { agent: glance.working[0] }) : t('{n} agents working', { n: glance.working.length }) };
20128
20953
  if (switcher.done.has(room.id)) return { key: 'done', words: t('Finished') };
20129
- return { key: 'calm', words: t('Calm') };
20954
+ return { key: 'calm', words: t('Active') };
20130
20955
  }
20131
20956
  // The Coordinator first, then the projects by name: each keeps its place, whatever it is doing.
20132
20957
  const switchOrder = () => [...switcher.rooms].sort((a, b) => (a.id === switcher.salas ? -1 : b.id === switcher.salas ? 1 : a.name.localeCompare(b.name)));
@@ -20180,16 +21005,18 @@ function switchLamp() {
20180
21005
  const of = (kind) => seen.filter(({ state }) => state.key === kind);
20181
21006
  const waiting = of('waiting');
20182
21007
  const top = waiting.length ? 'waiting' : of('working').length ? 'working' : of('done').length ? 'done' : '';
20183
- key.dataset.state = top;
21008
+ // Read every few seconds and mostly the same: written only when it changed, so the key is not
21009
+ // restyled for nothing on every reading (2026-10-21).
21010
+ if (key.dataset.state !== top) key.dataset.state = top;
20184
21011
  const lamp = key.querySelector('.switch-lamp');
20185
21012
  if (lamp) {
20186
- lamp.hidden = !top;
20187
- lamp.textContent = waiting.length ? String(waiting.reduce((sum, { state }) => sum + state.count, 0)) : '';
21013
+ if (lamp.hidden !== !top) lamp.hidden = !top;
21014
+ const count = waiting.length ? String(waiting.reduce((sum, { state }) => sum + state.count, 0)) : '';
21015
+ if (lamp.textContent !== count) lamp.textContent = count;
20188
21016
  }
20189
21017
  const news = [...waiting, ...of('working'), ...of('done')].map(({ room, state }) => `${switchName(room)}: ${state.words}`);
20190
21018
  const said = [t('Switch project'), ...news].join(' · ');
20191
- key.title = said;
20192
- key.setAttribute('aria-label', said);
21019
+ if (key.title !== said) { key.title = said; key.setAttribute('aria-label', said); }
20193
21020
  }
20194
21021
  function switchOpen() {
20195
21022
  if (!switcher.panel) {
@@ -20268,6 +21095,8 @@ function switchDraw() {
20268
21095
  const icon = tile.querySelector('.switch-icon');
20269
21096
  const face = icon.querySelector('.switch-face');
20270
21097
  const coordinator = room.id === switcher.salas;
21098
+ // Each project in its own accent (1.0.5, src/looks.mjs): the gradient of the tile is its colour.
21099
+ if ((icon.dataset.accent ?? '') !== (room.accent ?? '')) { if (room.accent) icon.dataset.accent = room.accent; else delete icon.dataset.accent; }
20271
21100
  if (face.dataset.of !== (coordinator ? 'coordinator' : room.name)) {
20272
21101
  face.dataset.of = coordinator ? 'coordinator' : room.name;
20273
21102
  icon.classList.toggle('is-coordinator', coordinator);
@@ -20723,8 +21552,19 @@ if (barKit.node) {
20723
21552
  barKit.more.innerHTML = '<svg viewBox="0 0 20 20" aria-hidden="true"><circle cx="5" cy="10" r="1.6" fill="currentColor"/><circle cx="10" cy="10" r="1.6" fill="currentColor"/><circle cx="15" cy="10" r="1.6" fill="currentColor"/></svg>'; // trusted: our own SVG
20724
21553
  barKit.more.addEventListener('click', (event) => { event.stopPropagation(); if (barKit.moreCard && !barKit.moreCard.hidden) barCloseMore(); else barDrawMore(); });
20725
21554
  barLayout();
21555
+ // While the bar keeps changing size — Code or a panel gliding in narrows it frame by frame — it is
21556
+ // fitted once, when it settles: fitted on every frame, «More» came and went four times in a tenth
21557
+ // of a second and the bar blinked (2026-10-21). A single change is still fitted on the next frame.
20726
21558
  let fitting = 0;
20727
- const refit = () => { cancelAnimationFrame?.(fitting); fitting = requestAnimationFrame?.(() => barFit()) ?? 0; };
21559
+ let settling = 0;
21560
+ let fittedAt = 0;
21561
+ const refit = () => {
21562
+ cancelAnimationFrame?.(fitting);
21563
+ clearTimeout(settling);
21564
+ const fit = () => { fittedAt = Date.now(); barFit(); };
21565
+ if (Date.now() - fittedAt < 160) { settling = setTimeout(fit, 160); settling?.unref?.(); return; }
21566
+ fitting = requestAnimationFrame?.(fit) ?? 0;
21567
+ };
20728
21568
  window.addEventListener?.('resize', refit);
20729
21569
  // The bar is as wide as the room, not the window (2026-10-17): the code workspace docked beside
20730
21570
  // the conversation narrows it with the window unmoved, and MODULES ended up under the house's