@jossuealcala/madre 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/CHANGELOG.en.md +40 -1
  2. package/CHANGELOG.md +40 -1
  3. package/README.en.md +3 -3
  4. package/README.md +3 -3
  5. package/SECURITY.md +11 -6
  6. package/TRADEMARKS.md +6 -2
  7. package/bin/madre.mjs +76 -11
  8. package/docs/REFERENCE.md +16 -10
  9. package/docs/SDK.md +36 -9
  10. package/docs/en/REFERENCE.md +12 -8
  11. package/docs/en/SDK.md +34 -8
  12. package/docs/en/training/README.md +1 -1
  13. package/docs/sdk/connector-module.mjs +1 -1
  14. package/docs/sdk/hello-module.mjs +39 -4
  15. package/docs/training/README.md +1 -1
  16. package/docs/training/train.sh +3 -0
  17. package/habilidades/explicamelo-facil/HABILIDAD.md +19 -0
  18. package/habilidades/hojas-de-calculo/HABILIDAD.md +18 -0
  19. package/habilidades/mensajes-a-clientes/HABILIDAD.md +19 -0
  20. package/habilidades/publicaciones-para-redes/HABILIDAD.md +19 -0
  21. package/habilidades/resumen-y-pendientes/HABILIDAD.md +18 -0
  22. package/habilidades/tu-pagina-paso-a-paso/HABILIDAD.md +19 -0
  23. package/package.json +7 -4
  24. package/public/activity.js +66 -22
  25. package/public/app.js +4947 -894
  26. package/public/assets/brand/OFL-SpaceGrotesk.txt +93 -0
  27. package/public/assets/brand/SpaceGrotesk-latin-ext.woff2 +0 -0
  28. package/public/assets/brand/SpaceGrotesk-latin.woff2 +0 -0
  29. package/public/assets/brand/madre-app-180.png +0 -0
  30. package/public/assets/brand/madre-app-192.png +0 -0
  31. package/public/assets/brand/madre-app-512.png +0 -0
  32. package/public/assets/brand/madre-app.svg +1 -1
  33. package/public/assets/brand/madre-favicon.svg +1 -1
  34. package/public/attribution.js +29 -19
  35. package/public/auto-open.js +102 -0
  36. package/public/brands.js +36 -19
  37. package/public/changes.js +63 -0
  38. package/public/en.js +1085 -102
  39. package/public/es.js +2940 -1656
  40. package/public/i18n.js +11 -0
  41. package/public/index.html +31 -27
  42. package/public/loader.js +322 -117
  43. package/public/macroverso.js +57 -355
  44. package/public/manual-content.js +69 -9
  45. package/public/manual.js +21 -6
  46. package/public/market-view.js +298 -84
  47. package/public/market.js +25 -2
  48. package/public/mcp-catalog.js +7 -2
  49. package/public/missions.js +169 -0
  50. package/public/news-scenes.js +292 -0
  51. package/public/nostromo-engine.js +935 -654
  52. package/public/notices.js +78 -0
  53. package/public/notifications.js +119 -0
  54. package/public/power.js +1 -1
  55. package/public/provider-marks.js +170 -0
  56. package/public/provider-pick.js +147 -0
  57. package/public/resay.js +4 -0
  58. package/public/review-ask.js +16 -13
  59. package/public/routing.js +29 -3
  60. package/public/salas-mac.css +467 -47
  61. package/public/salas-mac.html +8 -5
  62. package/public/salas-mac.js +805 -109
  63. package/public/salas.css +2 -2
  64. package/public/salas.html +2 -2
  65. package/public/salas.js +1 -1
  66. package/public/starters.js +128 -0
  67. package/public/styles.css +3036 -340
  68. package/public/subscription.js +303 -0
  69. package/public/terms-field.js +170 -0
  70. package/public/terms.js +117 -19
  71. package/public/tips.js +158 -0
  72. package/public/tour-chapters.js +88 -88
  73. package/public/tour.js +364 -46
  74. package/public/troubleshooting.js +313 -27
  75. package/public/welcome-scene.js +446 -0
  76. package/public/welcome.js +827 -282
  77. package/src/adapters/claude.mjs +2 -1
  78. package/src/adapters/codex.mjs +2 -1
  79. package/src/adapters/cursor.mjs +9 -6
  80. package/src/adapters/gemini-rest.mjs +236 -0
  81. package/src/adapters/gemini.mjs +13 -7
  82. package/src/adapters/grok.mjs +290 -0
  83. package/src/adapters/madre.mjs +71 -23
  84. package/src/adapters/opencode.mjs +15 -2
  85. package/src/adapters/process.mjs +14 -3
  86. package/src/adapters/steps.mjs +176 -0
  87. package/src/app-invite.mjs +90 -0
  88. package/src/auth-probe.mjs +32 -0
  89. package/src/billing-key.mjs +8 -0
  90. package/src/billing.mjs +317 -0
  91. package/src/bridge/policy.mjs +1 -1
  92. package/src/capabilities.mjs +46 -10
  93. package/src/chats.mjs +44 -2
  94. package/src/checkpoint.mjs +119 -1
  95. package/src/codex-route.mjs +113 -0
  96. package/src/commands.mjs +5 -2
  97. package/src/credentials.mjs +46 -8
  98. package/src/dataset.mjs +18 -7
  99. package/src/directives.mjs +1 -0
  100. package/src/event-store.mjs +25 -2
  101. package/src/extensions.mjs +5 -1
  102. package/src/ficha.mjs +158 -0
  103. package/src/files.mjs +36 -2
  104. package/src/image-studio.mjs +13 -3
  105. package/src/install-metrics.mjs +9 -3
  106. package/src/lease.mjs +6 -1
  107. package/src/looks.mjs +4 -1
  108. package/src/market-check.mjs +1 -1
  109. package/src/market-remote.mjs +135 -1
  110. package/src/mcp/image-server.mjs +59 -90
  111. package/src/mcp/memory-server.mjs +10 -0
  112. package/src/memory-tools.mjs +3 -0
  113. package/src/memory.mjs +29 -4
  114. package/src/models.mjs +21 -3
  115. package/src/modules/ahp.mjs +10 -4
  116. package/src/modules/bishop-exam.mjs +41 -12
  117. package/src/modules/bishop.mjs +2 -2
  118. package/src/modules/choices.mjs +12 -10
  119. package/src/modules/fetch-alone.mjs +7 -0
  120. package/src/modules/github.mjs +6 -2
  121. package/src/modules/helpers.mjs +23 -5
  122. package/src/modules/image-providers.mjs +281 -0
  123. package/src/modules/image-studio.mjs +106 -39
  124. package/src/modules/index.mjs +61 -12
  125. package/src/modules/intents-observe.mjs +3 -1
  126. package/src/modules/isolated.mjs +160 -0
  127. package/src/modules/ollama.mjs +35 -6
  128. package/src/modules/playwright.mjs +78 -20
  129. package/src/modules/reminders.mjs +42 -2
  130. package/src/modules/ripley.mjs +2 -1
  131. package/src/modules/run-alone.mjs +122 -0
  132. package/src/modules/runs.mjs +11 -8
  133. package/src/modules/sdk.mjs +10 -3
  134. package/src/notices-key.mjs +8 -0
  135. package/src/notices.mjs +185 -0
  136. package/src/ollama.mjs +57 -15
  137. package/src/opencode-health.mjs +1 -1
  138. package/src/outbound.mjs +124 -13
  139. package/src/quota-sources.mjs +148 -3
  140. package/src/review-ask.mjs +55 -31
  141. package/src/room/archivist.mjs +30 -5
  142. package/src/room/busy.mjs +16 -0
  143. package/src/room/changes.mjs +79 -0
  144. package/src/room/control.mjs +36 -6
  145. package/src/room/economy.mjs +1 -1
  146. package/src/room/guard.mjs +39 -2
  147. package/src/room/prompt.mjs +49 -6
  148. package/src/room/vectors.mjs +7 -1
  149. package/src/room.mjs +181 -49
  150. package/src/router.mjs +1 -1
  151. package/src/runs.mjs +39 -0
  152. package/src/runtime-detection.mjs +46 -6
  153. package/src/salas.mjs +181 -18
  154. package/src/server.mjs +1101 -118
  155. package/src/service.mjs +116 -0
  156. package/src/setup-trouble.mjs +20 -1
  157. package/src/setup.mjs +1 -1
  158. package/src/skill-check.mjs +269 -0
  159. package/src/skills-import.mjs +128 -0
  160. package/src/skills.mjs +502 -0
  161. package/src/terms.mjs +23 -5
  162. package/src/tour.mjs +31 -5
  163. package/src/updates.mjs +47 -4
  164. package/src/web-preview.mjs +181 -0
  165. package/src/whats-new.mjs +121 -1
  166. package/src/rumbo.mjs +0 -337
package/src/updates.mjs CHANGED
@@ -6,7 +6,8 @@
6
6
  // MADRE never updates itself: the room is in use and the process belongs to the human. It
7
7
  // shows the exact command for how this copy was launched.
8
8
 
9
- import { readFile, writeFile, mkdir } from 'node:fs/promises';
9
+ import { constants, realpathSync } from 'node:fs';
10
+ import { access, readFile, writeFile, mkdir } from 'node:fs/promises';
10
11
  import { dirname } from 'node:path';
11
12
 
12
13
  export const REGISTRY = 'https://registry.npmjs.org';
@@ -43,9 +44,15 @@ export function compareVersions(a, b) {
43
44
  }
44
45
 
45
46
  // How this copy runs, from the path of the script Node started: npx cache, the project's own
46
- // node_modules, a global install, or the source tree.
47
- export function detectInstall({ script = process.argv[1] ?? '', projectRoot = process.cwd() } = {}) {
48
- const path = String(script).replace(/\\/g, '/');
47
+ // node_modules, a global install, or the source tree. Or inside MADRE.app (Tauri), which
48
+ // says so and updates itself from madre.run: never by npm or git from here.
49
+ export function detectInstall({ script = process.argv[1] ?? '', projectRoot = process.cwd(), env = process.env } = {}) {
50
+ if (env.MADRE_APP === '1') return 'app';
51
+ // Followed to where it leads (Q-22): npm -g leaves `madre` as a link in a bin folder, and Node
52
+ // keeps that path; read as written, a global copy looked like one run from source.
53
+ let real = String(script);
54
+ try { real = realpathSync(real); } catch { /* read as written */ }
55
+ const path = real.replace(/\\/g, '/');
49
56
  if (/\/_npx\//.test(path)) return 'npx';
50
57
  if (projectRoot && path.startsWith(`${String(projectRoot).replace(/\\/g, '/').replace(/\/$/, '')}/node_modules/`)) return 'project';
51
58
  if (/\/node_modules\//.test(path)) return 'global';
@@ -64,6 +71,7 @@ export function updateCommand(install, name, version = 'latest') {
64
71
  case 'npx': return `npx ${name}@${version} start`;
65
72
  case 'project': return `npm install ${name}@${version}`;
66
73
  case 'global': return `npm install -g ${name}@${version}`;
74
+ case 'app': return null;
67
75
  default: return 'git pull';
68
76
  }
69
77
  }
@@ -93,6 +101,41 @@ export function applyCommand({ install, name, version, port, projectRoot }) {
93
101
  }
94
102
  }
95
103
 
104
+ // Whether npm -g can put the new version where this one is (Q-22, 2026-11-10): a copy installed with
105
+ // sudo lives in a folder of root's, and `npm install -g` without sudo failed there after MADRE had
106
+ // already closed. Asked before closing anything.
107
+ export async function canReplace(packageRoot) {
108
+ try { await access(dirname(packageRoot), constants.W_OK); return true; } catch { return false; }
109
+ }
110
+
111
+ // TAKING ITS OWN PLACE (Q-23, 2026-11-10). Restarting or updating used to start a new MADRE and end
112
+ // this process. Whoever waits on this process saw MADRE end: the terminal gave its prompt back, and
113
+ // in WSL the Windows shortcut's wsl.exe ended with it, after which WSL put the distribution away
114
+ // (~15 s), with the new MADRE — and a half-done npm install — inside. On Linux the new one now takes
115
+ // this process's place (process.execve, Node 22.15 and later), with the same PID; elsewhere, or on
116
+ // an older Node, as before.
117
+ export const takesItsPlace = ({ platform, execve } = { platform: process.platform, execve: process.execve }) => platform === 'linux' && typeof execve === 'function';
118
+
119
+ // What takes its place: `file args…`, as is when a terminal shows what MADRE says (the new address
120
+ // with its ficha too), else through /bin/sh with everything it says going to `log`, the witness a
121
+ // restart or an update always had (restart.log, update.log). Returns [program, argv] for execve.
122
+ export function nextProcess({ file, args = [], log = null, terminal = false }) {
123
+ if (terminal || !log) return [file, [file, ...args]];
124
+ return ['/bin/sh', ['/bin/sh', '-c', 'exec >>"$1" 2>&1; shift; exec "$@"', 'madre', log, file, ...args]];
125
+ }
126
+
127
+ // Q-21 (2026-11-10): MADRE before 1.1.3 had no ficha, so a tab open on it has no cookie, and the start
128
+ // an update makes (PULSE_UPDATE_RESTART, without the browser) left that tab on «This tab needs to be
129
+ // opened from MADRE» with nobody to give it the address. The start that comes from an update and
130
+ // finds no ficha on file opens the browser at the address that carries it.
131
+ export const opensBrowser = ({ asked = false, env = process.env, hadFicha = true } = {}) => Boolean(asked) || (env.PULSE_UPDATE_RESTART === '1' && !hadFicha);
132
+
133
+ // L-13 (Carlos's server, 2026-11-10): an update restarted only the room it was pressed in, and Home
134
+ // and the other projects stayed on the older MADRE. The rooms an update still has to bring to this
135
+ // version: every other open one that says an older version, or none (a mark written before rooms
136
+ // said theirs).
137
+ export const roomsBehind = (rooms, { here, version }) => rooms.filter((one) => one.open && one.id !== here && (!isVersion(one.open.version) || compareVersions(one.open.version, version) < 0));
138
+
96
139
  // Where a person reads what a version brought. The product's own house, in the language the room
97
140
  // is speaking — a release page on a code host is written for people who already work there, and
98
141
  // whoever pressed this button only wanted to know what changed. The repository stays the fallback
@@ -0,0 +1,181 @@
1
+ // SPDX-License-Identifier: BUSL-1.1
2
+ // MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
3
+ // The picture and the title of a link an agent gave, asked for by the person (2026-11-14).
4
+ //
5
+ // An answer that lists apartments, products or articles reads better as cards: a photo, a title and
6
+ // the site it is on. The photo lives on that site, and fetching it tells that site that someone
7
+ // looked; so nothing is fetched while an answer is drawn. The person presses «Show photos», and only
8
+ // then does MADRE ask each page for its preview (og:image, og:title, og:site_name) and the picture
9
+ // itself, which travels back to the page as a data: address — the page's own rules forbid pictures
10
+ // from anywhere else, and that stays so.
11
+ //
12
+ // Two locks. Only http and https, and never an address on this computer or its network: a link
13
+ // in an answer must not become a way to read the router's page or a port on the Mac. And what comes
14
+ // back is bounded: so much of a page, so big a picture, so long a wait.
15
+
16
+ import { lookup } from 'node:dns/promises';
17
+ import { isIP } from 'node:net';
18
+
19
+ const PAGE_BYTES = 768 * 1024;
20
+ const IMAGE_BYTES = 4 * 1024 * 1024;
21
+ const WAIT_MS = 9000;
22
+ const HOPS = 4;
23
+ const IMAGE_TYPES = /^image\/(png|jpe?g|gif|webp|avif)\b/i;
24
+ // A browser's way of asking: many sites answer a plain script with an error page.
25
+ const HEADERS = {
26
+ 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15',
27
+ accept: 'text/html,application/xhtml+xml,image/avif,image/webp,image/*;q=0.9,*/*;q=0.8',
28
+ 'accept-language': 'es-MX,es;q=0.9,en;q=0.8',
29
+ };
30
+
31
+ // The addresses asked for by a person's press, so the log of what left the Mac names them as
32
+ // that and not as an address nobody declared (outbound.mjs, «web-page»). Held a minute.
33
+ const asked = new Map();
34
+ export function askedByPerson(rawUrl) {
35
+ try {
36
+ const href = new URL(rawUrl).href;
37
+ const until = asked.get(href);
38
+ if (!until) return false;
39
+ if (until < Date.now()) { asked.delete(href); return false; }
40
+ return true;
41
+ } catch { return false; }
42
+ }
43
+ function markAsked(href) {
44
+ asked.set(href, Date.now() + 60_000);
45
+ if (asked.size > 400) for (const [key, until] of asked) if (until < Date.now()) asked.delete(key);
46
+ }
47
+
48
+ // This computer and its network, in both families.
49
+ export function privateAddress(address) {
50
+ const ip = String(address ?? '').replace(/^\[|\]$/g, '').toLowerCase();
51
+ const v4 = ip.startsWith('::ffff:') ? ip.slice(7) : ip;
52
+ if (isIP(v4) === 4) {
53
+ const [a, b] = v4.split('.').map(Number);
54
+ return a === 0 || a === 10 || a === 127 || (a === 100 && b >= 64 && b <= 127) || (a === 169 && b === 254)
55
+ || (a === 172 && b >= 16 && b <= 31) || (a === 192 && b === 168) || (a === 198 && (b === 18 || b === 19)) || a >= 224;
56
+ }
57
+ if (isIP(ip) === 6) return ip === '::' || ip === '::1' || /^f[cd]/.test(ip) || /^fe[89ab]/.test(ip) || ip.startsWith('ff');
58
+ return true;
59
+ }
60
+
61
+ async function publicUrl(raw, resolve = lookup) {
62
+ let url;
63
+ try { url = new URL(raw); } catch { return { error: 'bad-url' }; }
64
+ if (!/^https?:$/.test(url.protocol) || url.username || url.password) return { error: 'bad-url' };
65
+ const host = url.hostname.replace(/^\[|\]$/g, '');
66
+ if (!host || /(^|\.)(localhost|local|internal|home|lan)$/i.test(host)) return { error: 'private' };
67
+ const addresses = isIP(host) ? [{ address: host }] : await resolve(host, { all: true }).catch(() => []);
68
+ if (!addresses.length) return { error: 'unreachable' };
69
+ if (addresses.some((one) => privateAddress(one.address))) return { error: 'private' };
70
+ return { url };
71
+ }
72
+
73
+ // One request, following redirects by hand so every hop passes the same lock.
74
+ async function fetchPublic(raw, { fetchImpl, resolve }) {
75
+ let next = raw;
76
+ for (let hop = 0; hop <= HOPS; hop += 1) {
77
+ const checked = await publicUrl(next, resolve);
78
+ if (checked.error) return checked;
79
+ markAsked(checked.url.href);
80
+ const response = await fetchImpl(checked.url.href, { headers: HEADERS, redirect: 'manual', signal: AbortSignal.timeout(WAIT_MS) });
81
+ if (response.status >= 300 && response.status < 400 && response.headers.get('location')) {
82
+ next = new URL(response.headers.get('location'), checked.url).href;
83
+ await response.body?.cancel?.().catch(() => {});
84
+ continue;
85
+ }
86
+ return { response, url: checked.url };
87
+ }
88
+ return { error: 'redirects' };
89
+ }
90
+
91
+ async function readCapped(response, cap) {
92
+ const declared = Number(response.headers.get('content-length'));
93
+ if (Number.isFinite(declared) && declared > cap) { await response.body?.cancel?.().catch(() => {}); return null; }
94
+ const reader = response.body?.getReader?.();
95
+ if (!reader) return Buffer.from(await response.arrayBuffer()).subarray(0, cap);
96
+ const chunks = [];
97
+ let size = 0;
98
+ for (;;) {
99
+ const { done, value } = await reader.read();
100
+ if (done) break;
101
+ size += value.byteLength;
102
+ if (size > cap) { await reader.cancel().catch(() => {}); return chunks.length ? Buffer.concat(chunks) : null; }
103
+ chunks.push(Buffer.from(value));
104
+ }
105
+ return Buffer.concat(chunks);
106
+ }
107
+
108
+ const ENTITIES = { amp: '&', lt: '<', gt: '>', quot: '"', apos: "'", nbsp: ' ' };
109
+ function decode(text) {
110
+ return String(text ?? '')
111
+ .replace(/&#x([0-9a-f]+);/gi, (_, hex) => String.fromCodePoint(Number.parseInt(hex, 16)))
112
+ .replace(/&#(\d+);/g, (_, dec) => String.fromCodePoint(Number(dec)))
113
+ .replace(/&([a-z]+);/gi, (whole, name) => ENTITIES[name.toLowerCase()] ?? whole)
114
+ .replace(/\s+/g, ' ')
115
+ .trim();
116
+ }
117
+
118
+ // What a page says about itself in its head: the preview tags, then its title.
119
+ export function readPreview(html, base) {
120
+ const head = String(html ?? '').slice(0, PAGE_BYTES);
121
+ const meta = new Map();
122
+ for (const [tag] of head.matchAll(/<meta\b[^>]*>/gi)) {
123
+ const key = tag.match(/\b(?:property|name)\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase();
124
+ const value = tag.match(/\bcontent\s*=\s*["']([^"']*)["']/i)?.[1];
125
+ if (key && value !== undefined && !meta.has(key)) meta.set(key, decode(value));
126
+ }
127
+ const title = meta.get('og:title') || meta.get('twitter:title') || decode(head.match(/<title[^>]*>([\s\S]*?)<\/title>/i)?.[1]);
128
+ let image = meta.get('og:image:secure_url') || meta.get('og:image') || meta.get('og:image:url') || meta.get('twitter:image') || meta.get('twitter:image:src') || null;
129
+ try { image = image ? new URL(image, base).href : null; } catch { image = null; }
130
+ return {
131
+ title: title ? title.slice(0, 200) : null,
132
+ site: (meta.get('og:site_name') || '').slice(0, 80) || null,
133
+ description: (meta.get('og:description') || meta.get('description') || '').slice(0, 300) || null,
134
+ image,
135
+ };
136
+ }
137
+
138
+ async function imageData(raw, options) {
139
+ const got = await fetchPublic(raw, options);
140
+ if (got.error || !got.response.ok) { await got.response?.body?.cancel?.().catch(() => {}); return null; }
141
+ const type = got.response.headers.get('content-type') ?? '';
142
+ if (!IMAGE_TYPES.test(type)) { await got.response.body?.cancel?.().catch(() => {}); return null; }
143
+ const bytes = await readCapped(got.response, IMAGE_BYTES);
144
+ return bytes?.length ? `data:${type.split(';')[0].trim().toLowerCase()};base64,${bytes.toString('base64')}` : null;
145
+ }
146
+
147
+ const cache = new Map();
148
+ // The preview of one link: its picture as a data: address, its title and its site. A link that is
149
+ // itself a picture comes back as one. Never throws: a page that does not answer is a card without
150
+ // a photo, said so.
151
+ export async function webPreview(raw, { fetchImpl = globalThis.fetch, resolve = lookup } = {}) {
152
+ const key = String(raw ?? '');
153
+ if (cache.has(key)) return cache.get(key);
154
+ const options = { fetchImpl, resolve };
155
+ let result;
156
+ try {
157
+ const got = await fetchPublic(key, options);
158
+ if (got.error) result = { ok: false, error: got.error };
159
+ else if (!got.response.ok) { await got.response.body?.cancel?.().catch(() => {}); result = { ok: false, error: 'refused', status: got.response.status }; }
160
+ else {
161
+ const type = got.response.headers.get('content-type') ?? '';
162
+ if (IMAGE_TYPES.test(type)) {
163
+ const bytes = await readCapped(got.response, IMAGE_BYTES);
164
+ result = bytes?.length ? { ok: true, image: `data:${type.split(';')[0].trim().toLowerCase()};base64,${bytes.toString('base64')}`, title: null, site: null } : { ok: false, error: 'too-big' };
165
+ } else if (/html|xml/i.test(type)) {
166
+ const page = await readCapped(got.response, PAGE_BYTES);
167
+ const preview = readPreview(page?.toString('utf8') ?? '', got.url);
168
+ const image = preview.image ? await imageData(preview.image, options).catch(() => null) : null;
169
+ result = { ok: true, title: preview.title, site: preview.site, description: preview.description, image };
170
+ } else { await got.response.body?.cancel?.().catch(() => {}); result = { ok: false, error: 'not-a-page' }; }
171
+ }
172
+ } catch (error) {
173
+ result = { ok: false, error: error?.name === 'TimeoutError' ? 'slow' : 'unreachable' };
174
+ }
175
+ // A page that did not answer may answer the next press; only what came back is kept.
176
+ if (result.ok) {
177
+ cache.set(key, result);
178
+ if (cache.size > 300) cache.delete(cache.keys().next().value);
179
+ }
180
+ return result;
181
+ }
package/src/whats-new.mjs CHANGED
@@ -31,6 +31,115 @@ const FILE = 'whats-new.json';
31
31
  export const NEWS_ACTIONS = ['settings', 'errors', 'mother', 'intents', 'permissions', 'github', 'bar', 'modules', 'nostromo', 'room', 'looks', 'finder'];
32
32
 
33
33
  export const NOTES = {
34
+ // 1.1.4 (2026-11-13, the first beta of the app): said to whoever comes from 1.1.3 — MADRE is an app
35
+ // now, and two things that change how an answer is read and how MADRE is learned. Whoever already
36
+ // reads it inside the app (`inApp`, and `introApp`) is told what the app gives them instead of being
37
+ // asked to get it. After the board, in the browser, Home asks whether to stay or download the app
38
+ // (salas-mac.js, offerApp).
39
+ '1.1.4': {
40
+ title: { es: 'MADRE ya es una app', en: 'MADRE is an app now' },
41
+ intro: {
42
+ es: 'Desde hoy MADRE se abre como cualquier app de tu computadora. Y trae dos cosas nuevas para que trabajes con tus IAs sin perderte.',
43
+ en: 'From today MADRE opens like any other app on your computer. And it brings two new things so you can work with your AIs without getting lost.',
44
+ },
45
+ introApp: {
46
+ es: 'Ya la abres como cualquier app de tu computadora. Y trae dos cosas nuevas para que trabajes con tus IAs sin perderte.',
47
+ en: 'You now open it like any other app on your computer. And it brings two new things so you can work with your AIs without getting lost.',
48
+ },
49
+ items: [
50
+ {
51
+ id: 'app',
52
+ icon: 'home',
53
+ scene: 'desktopapp',
54
+ title: { es: 'Ábrela como cualquier app', en: 'Open it like any other app' },
55
+ body: {
56
+ es: 'Sin terminal ni pestañas: la app se abre desde tus aplicaciones, te avisa cuando una IA termina y trae su propio navegador y su terminal. Así aprovechas mejor lo que MADRE puede hacer en tu sistema, y tus proyectos llegan tal como están.',
57
+ en: 'No terminal, no tabs: the app opens from your applications, tells you when an AI finishes and brings its own browser and terminal. That way you get more out of what MADRE can do on your system, and your projects come along as they are.',
58
+ },
59
+ inApp: {
60
+ title: { es: 'Ya estás en la app', en: 'You are in the app' },
61
+ body: {
62
+ es: 'La abres desde tus aplicaciones, sin terminal. Te avisa cuando una IA termina, trae su propio navegador y su terminal, y te dice cuando hay una versión nueva.',
63
+ en: 'You open it from your applications, with no terminal. It tells you when an AI finishes, brings its own browser and terminal, and tells you when there is a new version.',
64
+ },
65
+ },
66
+ where: { es: 'madre.run/app', en: 'madre.run/app' },
67
+ action: null,
68
+ },
69
+ {
70
+ id: 'changes',
71
+ icon: 'list',
72
+ scene: 'changes',
73
+ title: { es: 'Ves qué cambió en cada respuesta', en: 'You see what changed in every answer' },
74
+ body: {
75
+ es: 'Bajo cada respuesta que toca tu proyecto, una tarjeta te dice en palabras simples qué cambió, con «Ver» y «Deshacer». Y lo que una IA crea, una página, una imagen o un PDF, se abre solo al lado.',
76
+ en: 'Under every answer that touches your project, a card tells you in plain words what changed, with «View» and «Undo». And what an AI makes, a page, an image or a PDF, opens by itself beside it.',
77
+ },
78
+ where: { es: 'En cada respuesta', en: 'Under every answer' },
79
+ action: null,
80
+ },
81
+ {
82
+ id: 'steps',
83
+ icon: 'check',
84
+ scene: 'missions',
85
+ title: { es: 'Aprende haciendo', en: 'Learn by doing' },
86
+ body: {
87
+ es: 'Primeros pasos te propone cinco cosas cortas, como crear tu primera página o preguntarle lo mismo a dos IAs. Cada una toma un par de minutos y te enseña algo de verdad.',
88
+ en: 'First steps offers you five short things, like making your first page or asking two AIs the same question. Each takes a couple of minutes and teaches you something real.',
89
+ },
90
+ where: { es: 'Primeros pasos, en la barra de arriba', en: 'First steps, in the top bar' },
91
+ action: null,
92
+ },
93
+ ],
94
+ },
95
+ // 1.1.3 (borrador del 2026-11-08, por aprobar): said as a person would to someone who comes back,
96
+ // with the three things that change their day, each with its own moving picture (`scene`, drawn by
97
+ // public/welcome-scene.js) instead of a screenshot.
98
+ '1.1.3': {
99
+ title: { es: 'Qué bueno verte de nuevo', en: 'Good to see you again' },
100
+ intro: {
101
+ es: 'Mientras no estabas, MADRE aprendió tres cosas que te ahorran tiempo desde hoy.',
102
+ en: 'While you were away, MADRE learned three things that save you time from today.',
103
+ },
104
+ items: [
105
+ {
106
+ id: 'skills',
107
+ icon: 'chip',
108
+ scene: 'skills',
109
+ title: { es: 'Enséñale una vez cómo trabajas', en: 'Teach it once how you work' },
110
+ body: {
111
+ es: 'Con las habilidades, tu forma de cotizar, de escribir o de revisar queda escrita una vez y la usan todas tus IAs, sea Claude, Codex o Grok. Trae las que ya tienes, consigue más en el Mercado o compártelas.',
112
+ en: 'With skills, the way you quote, write or review is written once and all your AIs use it, be it Claude, Codex or Grok. Bring the ones you already have, get more in the Market, or share them.',
113
+ },
114
+ where: { es: 'Mercado › Habilidades', en: 'Market › Skills' },
115
+ action: null,
116
+ },
117
+ {
118
+ id: 'grok',
119
+ icon: 'ufo',
120
+ scene: 'newagent',
121
+ title: { es: 'Grok, ahora entre tus IAs', en: 'Grok, now among your AIs' },
122
+ body: {
123
+ es: 'Si pagas SuperGrok, ya lo usas en tus proyectos: se conecta desde Ajustes › Tus IAs con tu cuenta, y lee, escribe, busca en internet y hace imágenes.',
124
+ en: 'If you pay for SuperGrok, you can now use it in your projects: it connects from Settings › Your AIs with your account, and it reads, writes, looks things up on the internet and makes images.',
125
+ },
126
+ where: { es: 'Ajustes › Tus IAs', en: 'Settings › Your AIs' },
127
+ action: 'settings',
128
+ },
129
+ {
130
+ id: 'tips',
131
+ icon: 'bell',
132
+ scene: 'tips',
133
+ title: { es: 'MADRE te explica cada cosa', en: 'MADRE explains everything to you' },
134
+ body: {
135
+ es: 'La primera vez que tocas algo importante, una nota corta te dice para qué sirve. Y cada IA te enseña con barras cuánto de tu plan llevas y qué puede hacer.',
136
+ en: 'The first time you press something important, a short note tells you what it is for. And each AI shows you with bars how much of your plan you have used and what it can do.',
137
+ },
138
+ where: { es: 'En toda MADRE', en: 'All over MADRE' },
139
+ action: null,
140
+ },
141
+ ],
142
+ },
34
143
  // 1.1 (2026-10-28): said to whoever comes from 1.0.x, on Home — the first screen of `npx madre` —
35
144
  // and in a project if Home was not opened first. Few things, the ones that change how MADRE looks.
36
145
  '1.1.0': {
@@ -350,6 +459,17 @@ export const NOTES = {
350
459
  };
351
460
 
352
461
  export const notesFor = (version) => NOTES[version] ?? null;
462
+ // The notes as read inside the desktop app (1.1.4): its own intro and, for an item that has them, its
463
+ // own words; read anywhere else, those are left out.
464
+ export function notesWhere(notes, app = false) {
465
+ if (!notes || (!notes.introApp && !(notes.items ?? []).some((item) => item.inApp))) return notes;
466
+ const { introApp, ...rest } = notes;
467
+ return {
468
+ ...rest,
469
+ intro: app && introApp ? introApp : rest.intro,
470
+ items: (rest.items ?? []).map(({ inApp, ...item }) => (app && inApp ? { ...item, ...inApp } : item)),
471
+ };
472
+ }
353
473
  // The newest version that has a sheet: what a preview opens on a copy whose own version has none.
354
474
  export const newestNotes = () => Object.keys(NOTES).sort(compareVersions).at(-1) ?? null;
355
475
 
@@ -415,5 +535,5 @@ export const INVITE_ANSWERS = ['shown', 'picked', 'sample', 'later'];
415
535
  export async function whatsNew({ root, version, returning, any = false }) {
416
536
  const seen = await readSeen(root);
417
537
  const show = shouldShow({ version, seen, returning });
418
- return { version, show, notes: show || any ? notesFor(version) : null };
538
+ return { version, show, notes: show || any ? notesWhere(notesFor(version), process.env.MADRE_APP === '1') : null };
419
539
  }