@jossuealcala/madre 1.0.4 → 1.1.0

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 (273) hide show
  1. package/ADDITIONAL-TERMS.md +7 -2
  2. package/CHANGELOG.en.md +152 -1
  3. package/CHANGELOG.md +152 -1
  4. package/CONTRIBUTING.md +2 -2
  5. package/LICENSE +111 -661
  6. package/NOTICE +59 -24
  7. package/README.en.md +36 -204
  8. package/README.md +36 -210
  9. package/SECURITY.md +1 -0
  10. package/TRADEMARKS.en.md +13 -14
  11. package/TRADEMARKS.md +42 -26
  12. package/bin/madre.cjs +2 -2
  13. package/bin/madre.mjs +114 -42
  14. package/docs/REFERENCE.md +53 -6
  15. package/docs/SDK.md +44 -5
  16. package/docs/en/REFERENCE.md +53 -6
  17. package/docs/en/SDK.md +43 -4
  18. package/docs/madre-banner.png +0 -0
  19. package/docs/sdk/hello-module.mjs +3 -0
  20. package/package.json +3 -2
  21. package/public/abduction.js +6 -6
  22. package/public/activity.js +425 -0
  23. package/public/app.js +3519 -647
  24. package/public/assets/abduction-cat-blink.webp +0 -0
  25. package/public/assets/abduction-cat-control-left.webp +0 -0
  26. package/public/assets/abduction-cat-control-right.webp +0 -0
  27. package/public/assets/abduction-cat.webp +0 -0
  28. package/public/assets/manual/shots/en-agents.webp +0 -0
  29. package/public/assets/manual/shots/en-chats.webp +0 -0
  30. package/public/assets/manual/shots/en-code.webp +0 -0
  31. package/public/assets/manual/shots/en-composer.webp +0 -0
  32. package/public/assets/manual/shots/en-connectors.webp +0 -0
  33. package/public/assets/manual/shots/en-continuity.webp +0 -0
  34. package/public/assets/manual/shots/en-coordinator.webp +0 -0
  35. package/public/assets/manual/shots/en-copilot.webp +0 -0
  36. package/public/assets/manual/shots/en-diagnostics.webp +0 -0
  37. package/public/assets/manual/shots/en-home.webp +0 -0
  38. package/public/assets/manual/shots/en-local.webp +0 -0
  39. package/public/assets/manual/shots/en-market.webp +0 -0
  40. package/public/assets/manual/shots/en-memory.webp +0 -0
  41. package/public/assets/manual/shots/en-modes.webp +0 -0
  42. package/public/assets/manual/shots/en-notes.webp +0 -0
  43. package/public/assets/manual/shots/en-settings.webp +0 -0
  44. package/public/assets/manual/shots/en-welcome.webp +0 -0
  45. package/public/assets/manual/shots/en-windows.webp +0 -0
  46. package/public/assets/manual/shots/es-agents.webp +0 -0
  47. package/public/assets/manual/shots/es-chats.webp +0 -0
  48. package/public/assets/manual/shots/es-code.webp +0 -0
  49. package/public/assets/manual/shots/es-composer.webp +0 -0
  50. package/public/assets/manual/shots/es-connectors.webp +0 -0
  51. package/public/assets/manual/shots/es-continuity.webp +0 -0
  52. package/public/assets/manual/shots/es-coordinator.webp +0 -0
  53. package/public/assets/manual/shots/es-copilot.webp +0 -0
  54. package/public/assets/manual/shots/es-diagnostics.webp +0 -0
  55. package/public/assets/manual/shots/es-home.webp +0 -0
  56. package/public/assets/manual/shots/es-local.webp +0 -0
  57. package/public/assets/manual/shots/es-market.webp +0 -0
  58. package/public/assets/manual/shots/es-memory.webp +0 -0
  59. package/public/assets/manual/shots/es-modes.webp +0 -0
  60. package/public/assets/manual/shots/es-notes.webp +0 -0
  61. package/public/assets/manual/shots/es-settings.webp +0 -0
  62. package/public/assets/manual/shots/es-welcome.webp +0 -0
  63. package/public/assets/manual/shots/es-windows.webp +0 -0
  64. package/public/assets/news/1.1/en/chats.webp +0 -0
  65. package/public/assets/news/1.1/en/home.webp +0 -0
  66. package/public/assets/news/1.1/en/maps.webp +0 -0
  67. package/public/assets/news/1.1/en/market.webp +0 -0
  68. package/public/assets/news/1.1/en/permissions.webp +0 -0
  69. package/public/assets/news/1.1/en/privacy.webp +0 -0
  70. package/public/assets/news/1.1/en/welcome.webp +0 -0
  71. package/public/assets/news/1.1/es/chats.webp +0 -0
  72. package/public/assets/news/1.1/es/home.webp +0 -0
  73. package/public/assets/news/1.1/es/maps.webp +0 -0
  74. package/public/assets/news/1.1/es/market.webp +0 -0
  75. package/public/assets/news/1.1/es/permissions.webp +0 -0
  76. package/public/assets/news/1.1/es/privacy.webp +0 -0
  77. package/public/assets/news/1.1/es/welcome.webp +0 -0
  78. package/public/attribution.js +15 -16
  79. package/public/brands.js +2 -2
  80. package/public/code-tools.js +2 -2
  81. package/public/editor.js +13 -13
  82. package/public/en.js +483 -0
  83. package/public/es.js +1817 -598
  84. package/public/hardware.js +2 -2
  85. package/public/i18n.js +47 -9
  86. package/public/icons.js +158 -0
  87. package/public/index.html +68 -51
  88. package/public/inquiry.js +2 -2
  89. package/public/loader.js +271 -2
  90. package/public/macroverso.js +60 -21
  91. package/public/manual-content.js +900 -0
  92. package/public/manual-shots.js +47 -0
  93. package/public/manual.css +246 -0
  94. package/public/manual.html +15 -0
  95. package/public/manual.js +427 -0
  96. package/public/market-art.js +99 -41
  97. package/public/market-view.js +243 -47
  98. package/public/market.js +139 -26
  99. package/public/mcp-catalog.js +62 -0
  100. package/public/neural.js +64 -8
  101. package/public/nostromo-engine.js +709 -40
  102. package/public/page-errors.js +29 -0
  103. package/public/power.js +350 -11
  104. package/public/remedy.js +89 -0
  105. package/public/resay.js +4 -2
  106. package/public/review-ask.js +12 -7
  107. package/public/routing.js +3 -3
  108. package/public/salas-mac.css +875 -48
  109. package/public/salas-mac.html +27 -15
  110. package/public/salas-mac.js +1668 -338
  111. package/public/salas.css +2 -2
  112. package/public/salas.html +3 -3
  113. package/public/salas.js +3 -3
  114. package/public/styles.css +2694 -323
  115. package/public/syntax.js +2 -2
  116. package/public/terms.js +152 -0
  117. package/public/touch.js +2 -2
  118. package/public/tour-chapters.js +100 -92
  119. package/public/tour.js +118 -28
  120. package/public/troubleshooting.js +327 -21
  121. package/public/wallpaper.js +4 -3
  122. package/public/welcome.js +923 -0
  123. package/src/activity.mjs +85 -0
  124. package/src/adapters/claude.mjs +61 -35
  125. package/src/adapters/codex.mjs +18 -5
  126. package/src/adapters/cursor.mjs +60 -9
  127. package/src/adapters/gemini.mjs +17 -4
  128. package/src/adapters/madre.mjs +30 -9
  129. package/src/adapters/opencode.mjs +73 -10
  130. package/src/adapters/process.mjs +19 -15
  131. package/src/adapters/subagents.mjs +159 -0
  132. package/src/asking.mjs +8 -2
  133. package/src/auth-probe.mjs +47 -11
  134. package/src/bridge/devices.mjs +2 -2
  135. package/src/bridge/handoff.mjs +2 -2
  136. package/src/bridge/host.mjs +2 -2
  137. package/src/bridge/network.mjs +2 -2
  138. package/src/bridge/policy.mjs +3 -3
  139. package/src/bridge/qr.mjs +2 -2
  140. package/src/bridge/server.mjs +3 -3
  141. package/src/builtin-updates.mjs +87 -0
  142. package/src/capabilities.mjs +5 -5
  143. package/src/chats.mjs +51 -2
  144. package/src/checkpoint.mjs +67 -9
  145. package/src/choices.mjs +2 -2
  146. package/src/cli-args.mjs +2 -2
  147. package/src/cold.mjs +2 -2
  148. package/src/commands.mjs +2 -2
  149. package/src/config.mjs +2 -2
  150. package/src/conversation-context.mjs +2 -2
  151. package/src/credentials.mjs +80 -18
  152. package/src/dataset.mjs +2 -2
  153. package/src/directives.mjs +2 -2
  154. package/src/distiller.mjs +2 -2
  155. package/src/embeddings.mjs +2 -2
  156. package/src/enlaces.mjs +2 -2
  157. package/src/environment.mjs +147 -0
  158. package/src/event-store.mjs +2 -2
  159. package/src/exam.mjs +2 -2
  160. package/src/extensions.mjs +2 -2
  161. package/src/eyecat-watch.mjs +2 -2
  162. package/src/eyecat.mjs +2 -2
  163. package/src/file-ops.mjs +2 -2
  164. package/src/files.mjs +2 -2
  165. package/src/github.mjs +2 -2
  166. package/src/heartbeat.mjs +2 -2
  167. package/src/history.mjs +76 -0
  168. package/src/i18n.mjs +32 -3
  169. package/src/image-studio.mjs +2 -2
  170. package/src/install-metrics.mjs +109 -0
  171. package/src/json-file.mjs +2 -2
  172. package/src/launch.mjs +2 -2
  173. package/src/lease.mjs +15 -4
  174. package/src/lobby-work.mjs +11 -4
  175. package/src/local-ai.mjs +12 -4
  176. package/src/looks.mjs +19 -7
  177. package/src/market-check.mjs +165 -0
  178. package/src/market-key.mjs +10 -2
  179. package/src/market-license.mjs +104 -0
  180. package/src/market-remote.mjs +71 -13
  181. package/src/maturity.mjs +2 -2
  182. package/src/mcp/connect.mjs +2 -2
  183. package/src/mcp/github-server.mjs +2 -2
  184. package/src/mcp/image-server.mjs +2 -2
  185. package/src/mcp/memory-server.mjs +2 -2
  186. package/src/mcp/proxy.mjs +16 -5
  187. package/src/mcp/smtp-server.mjs +2 -2
  188. package/src/memory-dashboard.mjs +2 -2
  189. package/src/memory-tools.mjs +2 -2
  190. package/src/memory.mjs +2 -2
  191. package/src/models.mjs +115 -12
  192. package/src/module-scope.mjs +2 -2
  193. package/src/modules/ahp.mjs +2 -2
  194. package/src/modules/ash-policy.mjs +2 -2
  195. package/src/modules/ash.mjs +2 -2
  196. package/src/modules/bishop-exam.mjs +2 -2
  197. package/src/modules/bishop-plan.mjs +2 -2
  198. package/src/modules/bishop.mjs +9 -3
  199. package/src/modules/choices.mjs +2 -2
  200. package/src/modules/correo.mjs +2 -2
  201. package/src/modules/enlaces.mjs +2 -2
  202. package/src/modules/git-pulse.mjs +2 -2
  203. package/src/modules/github.mjs +2 -2
  204. package/src/modules/helpers.mjs +2 -2
  205. package/src/modules/image-studio.mjs +2 -2
  206. package/src/modules/index.mjs +92 -5
  207. package/src/modules/intents-calibration.mjs +2 -2
  208. package/src/modules/intents-desk.mjs +4 -3
  209. package/src/modules/intents-observe.mjs +2 -2
  210. package/src/modules/intents-policy.mjs +2 -2
  211. package/src/modules/intents-try.mjs +2 -2
  212. package/src/modules/intents.mjs +2 -2
  213. package/src/modules/local-models.mjs +41 -10
  214. package/src/modules/mcp-connect.mjs +2 -2
  215. package/src/modules/notes.mjs +281 -0
  216. package/src/modules/ollama.mjs +48 -13
  217. package/src/modules/playwright.mjs +16 -5
  218. package/src/modules/reminders.mjs +664 -0
  219. package/src/modules/ripley.mjs +3 -3
  220. package/src/modules/runs.mjs +2 -2
  221. package/src/modules/sdk.mjs +57 -9
  222. package/src/modules/updates.mjs +2 -2
  223. package/src/mother.mjs +13 -3
  224. package/src/npm-launch.mjs +2 -2
  225. package/src/ollama.mjs +8 -6
  226. package/src/opencode-health.mjs +83 -0
  227. package/src/outbound.mjs +35 -3
  228. package/src/override.mjs +27 -22
  229. package/src/ports.mjs +2 -2
  230. package/src/prices.mjs +2 -2
  231. package/src/privacy.mjs +2 -2
  232. package/src/quota-monitor.mjs +2 -2
  233. package/src/quota-sources.mjs +2 -2
  234. package/src/request-guard.mjs +2 -2
  235. package/src/review-ask.mjs +4 -3
  236. package/src/room/archivist.mjs +2 -2
  237. package/src/room/attachments.mjs +2 -2
  238. package/src/room/budget.mjs +2 -2
  239. package/src/room/context.mjs +2 -2
  240. package/src/room/control.mjs +2 -2
  241. package/src/room/copilot.mjs +2 -2
  242. package/src/room/economy.mjs +2 -2
  243. package/src/room/escalation.mjs +2 -2
  244. package/src/room/ghost.mjs +2 -2
  245. package/src/room/guard.mjs +6 -4
  246. package/src/room/prompt.mjs +3 -3
  247. package/src/room/returns.mjs +2 -2
  248. package/src/room/runs.mjs +6 -4
  249. package/src/room/vectors.mjs +2 -2
  250. package/src/room.mjs +144 -36
  251. package/src/router.mjs +2 -2
  252. package/src/runs.mjs +2 -2
  253. package/src/runtime-detection.mjs +36 -6
  254. package/src/salas.mjs +31 -6
  255. package/src/sentinel-errors.mjs +17 -7
  256. package/src/server-sentinel.mjs +2 -2
  257. package/src/server.mjs +980 -139
  258. package/src/setup-trouble.mjs +33 -0
  259. package/src/setup.mjs +4 -4
  260. package/src/smtp.mjs +2 -2
  261. package/src/telemetry.mjs +266 -0
  262. package/src/terms.mjs +43 -0
  263. package/src/tour.mjs +60 -7
  264. package/src/uninstall.mjs +225 -0
  265. package/src/updates.mjs +2 -2
  266. package/src/usage-sentinel.mjs +2 -2
  267. package/src/vault.mjs +2 -2
  268. package/src/verdict.mjs +13 -10
  269. package/src/whats-new.mjs +97 -3
  270. package/public/assets/abduction-cat-blink.png +0 -0
  271. package/public/assets/abduction-cat-control-left.png +0 -0
  272. package/public/assets/abduction-cat-control-right.png +0 -0
  273. package/public/assets/abduction-cat.png +0 -0
@@ -1,12 +1,14 @@
1
- // SPDX-License-Identifier: AGPL-3.0-only
2
- // MADRE · © 2026 Jossue Alcalá · GNU AGPL v3 with additional terms (Section 7): ADDITIONAL-TERMS.md
1
+ // SPDX-License-Identifier: BUSL-1.1
2
+ // MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
3
3
  import { constants } from 'node:fs';
4
- import { access } from 'node:fs/promises';
5
- import { homedir } from 'node:os';
4
+ import { access, readFile, realpath, stat, writeFile, rename } from 'node:fs/promises';
5
+ import { homedir, tmpdir, userInfo } from 'node:os';
6
6
  import { delimiter, join } from 'node:path';
7
7
  import { execFile } from 'node:child_process';
8
8
  import { promisify } from 'node:util';
9
9
 
10
+ const accountHome = () => { try { return userInfo().homedir || homedir(); } catch { return homedir(); } };
11
+
10
12
  const execFileAsync = promisify(execFile);
11
13
 
12
14
  const definitions = [
@@ -43,7 +45,9 @@ const definitions = [
43
45
  // on the PATH a room is started with.
44
46
  id: 'cursor',
45
47
  label: 'Cursor',
46
- candidates: ['cursor-agent', join(homedir(), '.local', 'bin', 'cursor-agent')],
48
+ // Also the account's own home, as the system knows it (2026-10-20): a MADRE started with
49
+ // another HOME (a test home, a launcher) still finds the CLI the person installed.
50
+ candidates: [...new Set(['cursor-agent', join(homedir(), '.local', 'bin', 'cursor-agent'), join(accountHome(), '.local', 'bin', 'cursor-agent')])],
47
51
  versionArgs: ['--version'],
48
52
  adapter: 'cursor-readonly',
49
53
  },
@@ -113,6 +117,11 @@ const extensions = (env = process.env) => (process.platform === 'win32'
113
117
  ? (env.PATHEXT ?? '.COM;.EXE;.BAT;.CMD').split(';').filter(Boolean).map((extension) => extension.toLowerCase())
114
118
  : ['']);
115
119
 
120
+ // Inside WSL the PATH also carries Windows' own folders (/mnt/c/…/AppData/Roaming/npm): every file
121
+ // there looks runnable, so a CLI installed on Windows counted as installed here, «install» said it
122
+ // already was, and every turn failed for want of the Linux one. Those folders are Windows', not WSL's.
123
+ const windowsSide = (directory, env) => process.platform === 'linux' && Boolean(env.WSL_DISTRO_NAME || env.WSL_INTEROP) && /^\/mnt\/[a-z]\//i.test(directory);
124
+
116
125
  export async function findExecutable(candidates, envPath = process.env.PATH ?? '', env = process.env) {
117
126
  const suffixes = extensions(env);
118
127
  const runnable = async (path) => (process.platform === 'win32' ? access(path).then(() => true, () => false) : executable(path));
@@ -122,6 +131,7 @@ export async function findExecutable(candidates, envPath = process.env.PATH ?? '
122
131
  continue;
123
132
  }
124
133
  for (const directory of envPath.split(delimiter).filter(Boolean)) {
134
+ if (windowsSide(directory, env)) continue;
125
135
  for (const suffix of suffixes) {
126
136
  const path = join(directory, `${candidate}${suffix}`);
127
137
  if (await runnable(path)) return path;
@@ -131,10 +141,30 @@ export async function findExecutable(candidates, envPath = process.env.PATH ?? '
131
141
  return null;
132
142
  }
133
143
 
144
+ // What each CLI answered to --version, kept per binary (its real path, size and date) for every
145
+ // MADRE of this user (QA 1.1.0, ACT-15): each project used to run `gemini --version` as it came up,
146
+ // and several coming up together left Gemini's half-written projects.json.<uuid>.tmp behind in
147
+ // ~/.gemini. A binary that changes is asked again.
148
+ const versionsFile = () => join(tmpdir(), `madre-versions-${process.getuid?.() ?? 'user'}.json`);
149
+ async function rememberedVersions() { try { return JSON.parse(await readFile(versionsFile(), 'utf8')) ?? {}; } catch { return {}; } }
134
150
  async function readVersion(path, args) {
151
+ let key = null;
152
+ try {
153
+ const real = await realpath(path);
154
+ const found = await stat(real);
155
+ key = `${real}:${found.size}:${Math.round(found.mtimeMs)}:${args.join(' ')}`;
156
+ const kept = (await rememberedVersions())[key];
157
+ if (typeof kept === 'string' && kept) return kept;
158
+ } catch { /* asked below */ }
135
159
  try {
136
160
  const { stdout, stderr } = await execFileAsync(path, args, { timeout: 3000 });
137
- return (stdout || stderr).trim().split('\n')[0] || null;
161
+ const version = (stdout || stderr).trim().split('\n')[0] || null;
162
+ if (version && key) {
163
+ const all = { ...(await rememberedVersions()), [key]: version };
164
+ const temp = `${versionsFile()}.${process.pid}.tmp`;
165
+ await writeFile(temp, JSON.stringify(Object.fromEntries(Object.entries(all).slice(-40)))).then(() => rename(temp, versionsFile())).catch(() => {});
166
+ }
167
+ return version;
138
168
  } catch {
139
169
  return null;
140
170
  }
package/src/salas.mjs CHANGED
@@ -1,5 +1,5 @@
1
- // SPDX-License-Identifier: AGPL-3.0-only
2
- // MADRE · © 2026 Jossue Alcalá · GNU AGPL v3 with additional terms (Section 7): ADDITIONAL-TERMS.md
1
+ // SPDX-License-Identifier: BUSL-1.1
2
+ // MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
3
3
  // Salas on the Mac (docs/MACROVERSO.md, phase 1): every room this Mac knows, open or asleep, and
4
4
  // what one room may ask of another — to open, to close. The list is read from what each room
5
5
  // leaves beside its record; nothing here touches a room's ledger or its memory.
@@ -14,6 +14,7 @@ import { spawn } from 'node:child_process';
14
14
  import { createHash } from 'node:crypto';
15
15
  import { closeSync, openSync, realpathSync } from 'node:fs';
16
16
  import { mkdir, readdir, readFile, rename, stat } from 'node:fs/promises';
17
+ import * as nodePath from 'node:path';
17
18
  import { basename, dirname, join, resolve } from 'node:path';
18
19
  import { fileURLToPath } from 'node:url';
19
20
  import { oneAtATime, writeWhole } from './json-file.mjs';
@@ -108,7 +109,17 @@ const NOT_PROJECTS = new Set(['node_modules', 'Library', 'Applications', 'Pictur
108
109
  // Escritorio).
109
110
  export const PROJECT_HOMES = ['', 'Projects', 'projects', 'Proyectos', 'proyectos', 'Developer', 'dev', 'Dev', 'code', 'Code', 'src', 'repos', 'Repos', 'GitHub', 'git', 'work', 'Work', 'Sites', 'Documents', 'Documentos', 'Desktop', 'Escritorio'];
110
111
 
111
- const inside = (child, parent) => child === parent || child.startsWith(parent.endsWith('/') ? parent : `${parent}/`);
112
+ // Whether a folder is the other one or inside it (WIN-028, 2026-10-28). Asked of the path module of
113
+ // the system it runs on, not of a '/': on Windows a path is written with '\' and its letters' case
114
+ // does not tell two folders apart, and comparing text with '/' refused every folder there, the
115
+ // home's own included («Only folders inside your home folder»). `path` is a parameter so the
116
+ // Windows rule can be checked anywhere.
117
+ export function insideFolder(child, parent, path = nodePath) {
118
+ const rel = path.relative(parent, child);
119
+ return rel === '' || (rel !== '..' && !rel.startsWith(`..${path.sep}`) && !path.isAbsolute(rel));
120
+ }
121
+ export const sameFolder = (one, other, path = nodePath) => path.relative(one, other) === '';
122
+ const inside = (child, parent) => insideFolder(child, parent);
112
123
  async function looksLikeProject(folder) {
113
124
  for (const mark of PROJECT_MARKS) if (await stat(join(folder, mark)).then(() => true, () => false)) return true;
114
125
  return false;
@@ -140,7 +151,7 @@ export async function listFolders({ path = null, home, stateRoot }) {
140
151
  entries.push({ name: entry.name, path: full, project: await looksLikeProject(full), known: known.has(full) });
141
152
  }
142
153
  entries.sort((a, b) => Number(b.project) - Number(a.project) || a.name.localeCompare(b.name));
143
- return { path: here, home: top, parent: here === top ? null : dirname(here), entries: entries.slice(0, 400) };
154
+ return { path: here, home: top, parent: sameFolder(here, top) ? null : dirname(here), entries: entries.slice(0, 400) };
144
155
  }
145
156
 
146
157
  // Folders that look like projects in the places people keep them, newest first, none already here.
@@ -173,7 +184,7 @@ export async function suggestProjects({ home, stateRoot, limit = 24 }) {
173
184
  export async function associateProject({ root, home, stateRoot, now = new Date() }) {
174
185
  const folder = realFolder(String(root ?? ''));
175
186
  const top = realFolder(home);
176
- if (!root || !inside(folder, top) || folder === top) return { error: 'outside' };
187
+ if (!root || !inside(folder, top) || sameFolder(folder, top)) return { error: 'outside' };
177
188
  if (inside(folder, realFolder(stateRoot))) return { error: 'madre' };
178
189
  const info = await stat(folder).catch(() => null);
179
190
  if (!info?.isDirectory()) return { error: 'missing' };
@@ -201,11 +212,22 @@ export function projectNameProblem(name) {
201
212
  if (/[<>:"/\\|?*\u0000-\u001f]/.test(text) || text !== text.trim() || /[. ]$/.test(text) || text.startsWith('.') || DEVICE_NAMES.test(text)) return 'name';
202
213
  return null;
203
214
  }
215
+ // Where a new project goes when nobody chose (QA 1.1.0, NUE-09): the folder this person already
216
+ // keeps projects in, when there is one, rather than the top of their home folder.
217
+ const NEW_PROJECT_HOMES = ['Proyectos', 'Projects', 'proyectos', 'projects', 'Developer', 'Code', 'code', 'dev', 'src'];
218
+ export async function defaultProjectsFolder(home) {
219
+ for (const name of NEW_PROJECT_HOMES) {
220
+ const found = await stat(join(home, name)).catch(() => null);
221
+ if (found?.isDirectory()) return join(home, name);
222
+ }
223
+ return home;
224
+ }
225
+
204
226
  export async function createProject({ name, parent = null, home, stateRoot, now = new Date() }) {
205
227
  const problem = projectNameProblem(name);
206
228
  if (problem) return { error: problem };
207
229
  const top = realFolder(home);
208
- const place = realFolder(parent || home);
230
+ const place = realFolder(parent || await defaultProjectsFolder(home));
209
231
  if (!inside(place, top)) return { error: 'outside' };
210
232
  if (inside(place, realFolder(stateRoot))) return { error: 'madre' };
211
233
  if (!(await stat(place).catch(() => null))?.isDirectory()) return { error: 'missing' };
@@ -299,6 +321,7 @@ export async function roomComesUp(stateRoot, id, { timeoutMs = 60000, everyMs =
299
321
  // `full`, no memory's words leave their room: a far universe is drawn from kinds, zones, how much
300
322
  // ledger each memory covers, how often it was reached for, and the links between them. Only the
301
323
  // chosen universe asks for the words, and only the Mac may ask (the route refuses a phone).
324
+ const wordCount = (text) => (typeof text === 'string' ? (text.match(/\S+/g) ?? []).length : 0);
302
325
  export function universeOf(research, { full = false } = {}) {
303
326
  const memories = (research?.memories ?? []).map((memory) => ({
304
327
  id: memory.id,
@@ -307,6 +330,8 @@ export function universeOf(research, { full = false } = {}) {
307
330
  fromSequence: memory.fromSequence ?? 0,
308
331
  throughSequence: memory.throughSequence ?? 0,
309
332
  sourcesCount: Array.isArray(memory.sources) ? memory.sources.length : 0,
333
+ // How much it holds, as a count: its size on the map (2026-10-28). The words stay in their room.
334
+ words: wordCount(memory.text),
310
335
  recalled: memory.recalled ?? 0,
311
336
  lastRecalled: memory.lastRecalled ?? null,
312
337
  cold: memory.cold ?? null,
@@ -1,12 +1,12 @@
1
- // SPDX-License-Identifier: AGPL-3.0-only
2
- // MADRE · © 2026 Jossue Alcalá · GNU AGPL v3 with additional terms (Section 7): ADDITIONAL-TERMS.md
1
+ // SPDX-License-Identifier: BUSL-1.1
2
+ // MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
3
3
  // The error sentinel: what MADRE tells its author when something goes wrong
4
4
  // that MU/TH/UR cannot explain. A failure that matches no known condition, or a
5
5
  // crash of the process, becomes a report: the error redacted (no home paths,
6
6
  // no user names, no keys, no emails), the versions involved, the platform.
7
7
  // Reports stay in the room ledger (sentinel.report) and can be sent two ways:
8
8
  // by hand as a prefilled GitHub issue, or automatically to a collector the
9
- // author runs, only when the human switched AUTO-REPORT on. Off by default.
9
+ // author runs, while AUTO-REPORT is on: on by default since 1.1.0, with the anonymous diagnostics, and the human turns it off.
10
10
  // Nothing leaves the machine otherwise.
11
11
 
12
12
  import { createHash } from 'node:crypto';
@@ -69,14 +69,17 @@ export class ErrorSentinel {
69
69
  #fetch;
70
70
  #emit;
71
71
  #save;
72
+ #told;
72
73
 
73
- constructor({ pkg = {}, agents = [], settings = {}, fetchImpl = globalThis.fetch, emit = async () => {}, save = async () => {} } = {}) {
74
+ // `told`: every failure, known or not, for the anonymous diagnostics (src/telemetry.mjs).
75
+ constructor({ pkg = {}, agents = [], settings = {}, fetchImpl = globalThis.fetch, emit = async () => {}, save = async () => {}, told = () => {} } = {}) {
74
76
  this.#pkg = pkg;
75
77
  this.#agents = agents;
76
78
  this.#settings = { autoReport: Boolean(settings.autoReport), reportUrl: String(settings.reportUrl ?? '').trim() };
77
79
  this.#fetch = fetchImpl;
78
80
  this.#emit = emit;
79
81
  this.#save = save;
82
+ this.#told = told;
80
83
  }
81
84
 
82
85
  settings() { return { ...this.#settings, canSend: Boolean(this.#settings.reportUrl), repo: repoFromPackage(this.#pkg), home: HOME_SITE }; }
@@ -102,13 +105,19 @@ export class ErrorSentinel {
102
105
  // A room event goes by: a failure MU/TH/UR cannot classify is worth a report.
103
106
  async observe(event) {
104
107
  if (event?.type !== 'message.failed') return null;
105
- const { target, error, stopped } = event.payload ?? {};
108
+ const { target, error, stopped, closing } = event.payload ?? {};
106
109
  if (typeof error !== 'string' || !error.trim()) return null;
107
110
  // A turn the human stopped is not a condition. It ends exactly like a failure because the
108
111
  // process really was killed, but nothing went wrong and there is nothing for anyone to
109
- // diagnose — filing it would be reporting the brake as a fault.
110
- if (stopped) return null;
112
+ // diagnose — filing it would be reporting the brake as a fault. A turn cut because MADRE was
113
+ // closing is the same: every room closed mid-turn filed «MADRE is shutting down» (2026-10-21).
114
+ if (stopped || closing) return null;
111
115
  const known = diagnose(error, target ?? null);
116
+ const agentVersion = this.#agents.find((one) => one.id === target)?.version ?? null;
117
+ // Known or not, the author hears of it (2026-10-28): how often each known condition happens is
118
+ // as useful as the conditions nobody catalogued.
119
+ // A known one goes by its code alone: the agent's own words can repeat what the person wrote.
120
+ try { this.#told({ kind: 'agent', code: known[0]?.code ?? null, agent: target ?? null, agentVersion, message: known.length ? '' : error }); } catch { /* never in the way */ }
112
121
  if (known.length) return null;
113
122
  return this.record({ kind: 'unknown', agent: target ?? null, error, at: event.timestamp });
114
123
  }
@@ -116,6 +125,7 @@ export class ErrorSentinel {
116
125
  // The process itself failed somewhere the room did not catch.
117
126
  async crash(error, origin = 'uncaughtException') {
118
127
  const text = error instanceof Error ? `${error.stack ?? error.message}` : String(error);
128
+ try { this.#told({ kind: 'crash', where: origin, message: error instanceof Error ? error.message : text, stack: error instanceof Error ? error.stack : null }); } catch { /* never in the way */ }
119
129
  return this.record({ kind: 'crash', agent: null, error: `${origin}: ${text}` });
120
130
  }
121
131
 
@@ -1,5 +1,5 @@
1
- // SPDX-License-Identifier: AGPL-3.0-only
2
- // MADRE · © 2026 Jossue Alcalá · GNU AGPL v3 with additional terms (Section 7): ADDITIONAL-TERMS.md
1
+ // SPDX-License-Identifier: BUSL-1.1
2
+ // MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
3
3
  // The servers sentinel: what this project has listening, kept watch over while the room is open.
4
4
  //
5
5
  // RIPLEY opens a project's own dev server; this is what knows which servers those are. Only the