@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,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 context an agent gets: the recent transcript verbatim and, when the
4
4
  // room is longer than that window, the older exchanges that match this
5
5
  // request, recalled from memory inside the same character budget.
@@ -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
  // CONTROL: one agent holds the project itself for one turn. A git checkpoint
4
4
  // is taken before, the diff is read after, writes into forbidden zones are
5
5
  // restored on the spot, and the checkpoint stays for UNDO. One holder at a time.
@@ -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
  // COPILOT: the human hands one project to whichever agent they write to, for a while (2026-10-14).
4
4
  //
5
5
  // Turned on with the #3 key, once, for up to 24 hours. While it lasts, a message sent at #3 needs no
@@ -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
  import { freshInput } from './budget.mjs';
4
4
 
5
5
  // What a turn actually costs, and where it went.
@@ -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
  // Waiting for the human: a plan step wants a mode it does not have. One clock
4
4
  // per request, a decision from the room, and a way to settle everything at
5
5
  // once when a plan stops or the room shuts down.
@@ -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
  // GHOST turns: they happen, listeners see them, the ledger never does. A turn
4
4
  // is remembered as ghost for a while so its late events stay off the record.
5
5
 
@@ -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
  // Prevention before restoration: while an agent holds CONTROL, the forbidden
4
4
  // zones that can be made read-only are made read-only. .env files and MADRE's
5
5
  // own folders lose their write bits for the turn and get them back after;
@@ -9,11 +9,13 @@
9
9
 
10
10
  import { chmod, readdir, readFile, rm, stat } from 'node:fs/promises';
11
11
  import { join, relative } from 'node:path';
12
+ import { isForbidden } from '../checkpoint.mjs';
12
13
  import { writeWhole } from '../json-file.mjs';
13
14
 
14
15
  const SKIP = new Set(['node_modules', '.git', 'dist', 'build', 'coverage']);
15
16
 
16
- // Files and folders to lock: every .env / .env.* up to four levels deep, .pulse/, .madre/ and .claude/settings.local.json.
17
+ // Files and folders to lock: every .env / .env.* up to four levels deep (not its templates:
18
+ // .env.example and the like, src/checkpoint.mjs isForbidden), .pulse/, .madre/ and .claude/settings.local.json.
17
19
  export async function forbiddenTargets(projectRoot, { maxDepth = 4 } = {}) {
18
20
  const targets = [];
19
21
  const walk = async (dir, depth) => {
@@ -26,7 +28,7 @@ export async function forbiddenTargets(projectRoot, { maxDepth = 4 } = {}) {
26
28
  if (rel === '.pulse' || rel === '.madre') { targets.push({ path, kind: 'dir' }); continue; }
27
29
  if (SKIP.has(entry.name) || depth >= maxDepth) continue;
28
30
  await walk(path, depth + 1);
29
- } else if (/^\.env(\.|$)/.test(entry.name) || rel === '.claude/settings.local.json') {
31
+ } else if (isForbidden(rel) || rel === '.claude/settings.local.json') {
30
32
  targets.push({ path, kind: 'file' });
31
33
  }
32
34
  }
@@ -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 words an agent reads at the start of a turn. Pure: everything the room
4
4
  // knows is handed in, nothing is looked up. Order matters: who you are, what
5
5
  // you may do, what the room remembers, what was said, what is asked.
@@ -124,7 +124,7 @@ export function promptParts({
124
124
  ? `Tools from MADRE's modules, attached to this turn as MCP servers:\n${mcpServers.map((server) => `- ${server.name}: ${server.brief ?? (server.tools?.length ? server.tools.join(', ') : 'see its tool list')}`).join('\n')}`
125
125
  : null },
126
126
  { id: 'bishop', text: bishop },
127
- { id: 'sdk', text: lease && sdk && wantsModule(text) ? `Building a MADRE module: MADRE is modular and the human may ask you for a module (a slash command, a tool for the agents, an integration). Read the SDK guide at ${sdk.guide} and the complete example at ${sdk.example}. If it talks to a service outside this machine, read ${sdk.connector} too: a connector is ONE file that is both the module and the MCP server it spawns, and that shape is not guessable. Then write ONE file named <id>.module.mjs (default export a plain spec object) in ${lease.scratchDir ? `${lease.outDir}/${lease.scratchDir}` : lease.outDir}. Do not touch ~/.pulse/modules or .madre/modules: MADRE shows the human an INSTALL card and they decide. A module runs inside MADRE with the human's permissions, so keep it small and honest about what it reaches. Never hardcode a credential or invent somewhere to keep one: declare 'secrets' and read them back with ctx.vault, which is where MADRE keeps them and the only place that is safe.` : null },
127
+ { id: 'sdk', text: lease && sdk && wantsModule(text) ? `Building a MADRE module: MADRE is modular and the human may ask you for a module (a slash command, a tool for the agents, an integration). Read the SDK guide at ${sdk.guide} and the complete example at ${sdk.example}. If it talks to a service outside this machine, read ${sdk.connector} too: a connector is ONE file that is both the module and the MCP server it spawns, and that shape is not guessable. Then write ONE file named <id>.module.mjs (default export a plain spec object) in ${lease.scratchDir ? `${lease.outDir}/${lease.scratchDir}` : lease.outDir}. Do not touch ~/.pulse/modules or .madre/modules: MADRE shows the human an INSTALL card and they decide. A module runs inside MADRE with the human's permissions, so keep it small and honest about what it reaches. Never hardcode a credential or invent somewhere to keep one: declare 'secrets' and read them back with ctx.vault, which is where MADRE keeps them and the only place that is safe. Give it its own icon, as part of the module: 'icon: { svg, color }', a simple drawing of what it does (lines or shapes, any grid) and a #rrggbb color; MADRE fits it to its tile and draws it in one color, so keep it to one clear idea.` : null },
128
128
  { id: 'lease', text: lease ? leaseInstructions({ outDir: lease.outDir, agentId: agent.id, scopes: lease.scopes, capable: scopesFor(agent.id), imageStudio, control: Boolean(lease.control), create: Boolean(lease.create), airlock: Boolean(lease.airlock), scratchDir: lease.scratchDir ?? null }) : null },
129
129
  { id: 'copilot', text: copilot },
130
130
  { id: 'control-held', text: !lease?.control && controlHolder && controlHolder !== agent.id ? `Heads-up: @${controlHolder} currently holds CONTROL and may be changing project files while you work; cite the state you actually read.` : null },
@@ -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
  // When the commands an agent asked for have run, the agent hears how they went (2026-10-14).
4
4
  //
5
5
  // Before this a ```pulse-run card ran its lines and the room stopped there: each output went into
package/src/room/runs.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
  // The human's hands for a command an agent asked for, in the project root, with no shell: the
4
4
  // argv the parser split is the argv that runs (see src/runs.mjs).
5
5
  //
@@ -62,12 +62,14 @@ export class RunDesk {
62
62
  // Busy is a command still working toward its answer; a server that is serving is not in the way.
63
63
  get busy() { return [...this.#runs.values()].some((run) => !run.serving); }
64
64
  serving() { return [...this.#runs.entries()].filter(([, run]) => run.serving).map(([id, run]) => ({ id, ...run.serving })); }
65
+ // Every run alive, with what it is and since when (the room's «En marcha»).
66
+ live() { return [...this.#runs.entries()].map(([id, run]) => ({ id, ...(run.meta ?? {}), startedAt: run.startedAt, serving: run.serving ?? null })); }
65
67
  // Whether a line whose id starts this way is still working toward its answer.
66
68
  runningFor(prefix) { return [...this.#runs.entries()].some(([id, run]) => id.startsWith(prefix) && !run.serving); }
67
69
 
68
70
  // Resolves with what happened when the process ends; never rejects. A program that could not
69
71
  // start is an answer too. `onServing` hears, once, that the run opened a port.
70
- run({ id = 'run', argv, cwd, timeoutMs = RUN_TIMEOUT_MS, env = process.env, onServing = null }) {
72
+ run({ id = 'run', argv, cwd, timeoutMs = RUN_TIMEOUT_MS, env = process.env, onServing = null, meta = null }) {
71
73
  return new Promise((resolve) => {
72
74
  const started = Date.now();
73
75
  // 'error' and 'close' can both arrive for one failed spawn; the first one is the answer.
@@ -95,7 +97,7 @@ export class RunDesk {
95
97
  done({ ok: false, exitCode: null, text: couldNotRun(argv[0], error) });
96
98
  return;
97
99
  }
98
- const record = { child, stoppedBy: null, serving: null };
100
+ const record = { child, stoppedBy: null, serving: null, meta, startedAt: started };
99
101
  this.#runs.set(id, record);
100
102
  let output = '';
101
103
  // Bounded while it runs, not only at the end: a program that prints without stopping must
@@ -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
  // Vectors are filled shortly after indexing, one batch at a time, never on a
4
4
  // turn's critical path. A backlog drains batch by batch; a failing embedder
5
5
  // pauses and tries again later. The room does not depend on vectors.
package/src/room.mjs CHANGED
@@ -1,8 +1,9 @@
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 { invokeCodex, buildCodexArgs } from './adapters/codex.mjs';
4
4
  import { t } from './i18n.mjs';
5
5
  import { invokeClaude, buildClaudeArgs } from './adapters/claude.mjs';
6
+ import { keptSubagents } from './adapters/subagents.mjs';
6
7
  import { invokeGemini, buildGeminiArgs } from './adapters/gemini.mjs';
7
8
  import { invokeOpenCode, buildOpenCodeArgs } from './adapters/opencode.mjs';
8
9
  import { invokeCursor, buildCursorArgs } from './adapters/cursor.mjs';
@@ -11,7 +12,7 @@ import { randomUUID } from 'node:crypto';
11
12
  import { basename } from 'node:path';
12
13
  import { homedir } from 'node:os';
13
14
  import { UsageSentinel } from './usage-sentinel.mjs';
14
- import { BLOCK_SOURCES, buildPrompt, promptParts, sparedChars } from './room/prompt.mjs';
15
+ import { BLOCK_SOURCES, buildPrompt, promptParts, sparedChars, wantsModule } from './room/prompt.mjs';
15
16
  import { turnCost, observedRate } from './room/economy.mjs';
16
17
  import { contextFor } from './room/context.mjs';
17
18
  import { VERDICTS, travels } from './memory.mjs';
@@ -34,8 +35,9 @@ import { parseDirectives } from './directives.mjs';
34
35
  import { isValidModelName, isValidEffort, belongsElsewhere, MODEL_NOT_FOUND, codexTakes, readCodexEfforts } from './models.mjs';
35
36
  import { withListPrice } from './prices.mjs';
36
37
  import { MODES, SCOPES, SCOPE_LABELS, capabilitySummary, normalizeMode, resolveScopes } from './capabilities.mjs';
37
- import { createLease, diffSnapshots, namedPaths, snapshot } from './lease.mjs';
38
- import { stat as statFile, readdir, copyFile, readFile as readFileBytes } from 'node:fs/promises';
38
+ import { clip } from './activity.mjs';
39
+ import { createLease, diffSnapshots, namedPaths, snapshot, subagentsAllowed } from './lease.mjs';
40
+ import { stat as statFile, readdir, copyFile, mkdir as mkdirPath, readFile as readFileBytes } from 'node:fs/promises';
39
41
  import { basename as baseName, join as joinPath } from 'node:path';
40
42
  import { declaredTypeFor, filesChangedSince } from './files.mjs';
41
43
  import { isModuleFile, sdkPaths } from './modules/index.mjs';
@@ -351,6 +353,13 @@ export class Room {
351
353
  return event;
352
354
  }
353
355
 
356
+ // What the server learns outside a turn and the page must hear now, never written down: which
357
+ // agents have a session, once the probe that runs at start comes back (QA 1.1.0, NUE-11).
358
+ announce(type, payload) {
359
+ if (!['sessions.updated'].includes(type)) throw new Error(`Not a live announcement: ${type}`);
360
+ return this.#say(type, payload);
361
+ }
362
+
354
363
  // Whoever is watching the room right now. Separate from the ghost channel, which carries turns
355
364
  // that happened off the record: these never happened at all, they are only being reported.
356
365
  subscribeLive(listener) {
@@ -618,7 +627,7 @@ export class Room {
618
627
  }
619
628
  if (which === 'match') {
620
629
  const invoke = this.#invokers[MADRE_ADAPTER];
621
- if (!invoke) return { error: 'The local model is not running. Start Ollama, or open Ollama in Modules.' };
630
+ if (!invoke) return { error: 'The local model is not running. Start Ollama, or set up Local AI in Settings.' };
622
631
  this.#examRunning = 'match';
623
632
  this.#examProgress = { done: 0, total: 0 };
624
633
  // Answered in the background: the human keeps the room while it runs.
@@ -925,7 +934,7 @@ export class Room {
925
934
  // answers the press at once and keeps running; its output card comes when it is stopped.
926
935
  let opened = () => {};
927
936
  const serving = new Promise((resolve) => { opened = resolve; });
928
- const finished = this.#runDesk.run({ id: `${responseMessageId}:${index}`, argv: expandHome(command), cwd: this.#projectRoot, onServing: (where) => opened(where) })
937
+ const finished = this.#runDesk.run({ id: `${responseMessageId}:${index}`, argv: expandHome(command), cwd: this.#projectRoot, onServing: (where) => opened(where), meta: { line: command.line, agent: request.agent, responseMessageId, index } })
929
938
  .then(async (result) => {
930
939
  const changes = checkpoint ? await this.#controlDesk.changesSince(checkpoint).catch(() => null) : null;
931
940
  // What git cannot see — a folder the project ignores — found by its time on disk.
@@ -1079,8 +1088,8 @@ export class Room {
1079
1088
 
1080
1089
  // A slash command's result, shared with everyone (and with agents through
1081
1090
  // the transcript) as a fact card.
1082
- async recordCommand({ name, title, text, ok, args = [] }) {
1083
- return this.#emit('command.output', { name, title, text: String(text ?? '').slice(0, 20000), ok: ok !== false, args });
1091
+ async recordCommand({ name, title, text, ok, args = [], link = null }) {
1092
+ return this.#emit('command.output', { name, title, text: String(text ?? '').slice(0, 20000), ok: ok !== false, args, ...(link ? { link } : {}) });
1084
1093
  }
1085
1094
 
1086
1095
  // Live settings changes from the room UI. Only the fields present change.
@@ -1154,8 +1163,10 @@ export class Room {
1154
1163
  this.#vectors.stop();
1155
1164
  }
1156
1165
 
1166
+ // Counted as work from the first moment: a message is read, checked and written down before its
1167
+ // turn exists, and a room that looked idle all that while was let go under it (2026-10-21).
1157
1168
  async send(options = {}) {
1158
- await this.#accept(options, null);
1169
+ await this.#track(this.#accept(options, null));
1159
1170
  }
1160
1171
 
1161
1172
  // An order from BISHOP (docs/MACROVERSO.md, S-028, D-S11). The same door as the human's message
@@ -1167,14 +1178,14 @@ export class Room {
1167
1178
  async order({ text, target, mode = 1 } = {}) {
1168
1179
  const wanted = Number(mode);
1169
1180
  if (!Number.isInteger(wanted) || wanted < 0 || wanted > 2) throw new Error('An order comes in at #2 at most; #3 and #4 are armed by the human in this room.');
1170
- const accepted = await this.#accept({ text, target, mode: wanted }, { via: 'bishop', depth: 1 });
1181
+ const accepted = await this.#track(this.#accept({ text, target, mode: wanted }, { via: 'bishop', depth: 1 }));
1171
1182
  const events = await this.#store.readAll();
1172
1183
  const reply = accepted?.responseMessageId ? events.find((event) => event.type === 'message.created' && event.payload?.messageId === accepted.responseMessageId)?.payload : null;
1173
1184
  const failed = accepted?.messageId ? events.findLast((event) => event.type === 'message.failed' && event.payload?.messageId === accepted.messageId)?.payload : null;
1174
1185
  return { messageId: accepted?.messageId ?? null, responseMessageId: accepted?.responseMessageId ?? null, text: reply?.text ?? null, error: reply ? null : failed?.error ?? 'The turn ended without a reply.' };
1175
1186
  }
1176
1187
 
1177
- async #accept({ text, target, model = null, effort = null, attachments = [], create = false, ash = false, mode = undefined, draft = false, via = null, followUp = null, copilot = false }, order) {
1188
+ async #accept({ text, target, model = null, effort = null, attachments = [], create = false, ash = false, mode = undefined, draft = false, via = null, followUp = null, copilot = false, together = null }, order) {
1178
1189
  const parsed = parseMessage(text, target);
1179
1190
  const requestedMode = normalizeMode(mode, create === true ? 2 : 1);
1180
1191
  // This is the decision the human made when pressing Send. Capture it before modeCheck() —
@@ -1247,6 +1258,9 @@ export class Room {
1247
1258
  auto: followUp?.kind ?? undefined,
1248
1259
  returns: followUp?.returns ?? undefined,
1249
1260
  copilot: asCopilot || undefined,
1261
+ // One question to several agents at once (2026-10-29): each gets its own turn, and the page
1262
+ // shows the question once, with every agent it went to (app.js, renderUserMessage).
1263
+ together: typeof together === 'string' && /^[A-Za-z0-9_-]{6,40}$/.test(together) ? together : undefined,
1250
1264
  });
1251
1265
  // The human may say what they like; the room only says so, because every agent will read it.
1252
1266
  const exposed = this.#privacy?.hits(text2) ?? 0;
@@ -1278,9 +1292,21 @@ export class Room {
1278
1292
  } else {
1279
1293
  // `/module` asks for less than #2: one file in its own draft folder. Only a #2 message can
1280
1294
  // narrow itself this way; a default-#2 lease stays what it is.
1281
- lease = draft === true && create === true
1282
- ? await this.#draftLease({ leaseId: randomUUID(), messageId })
1283
- : await this.#projectLease({ leaseId: randomUUID(), messageId });
1295
+ // The folder it writes in could not be made (a project folder left read-only, a full disk):
1296
+ // the message says so, instead of being accepted and then answered by nothing (2026-10-28).
1297
+ try {
1298
+ lease = draft === true && create === true
1299
+ ? await this.#draftLease({ leaseId: randomUUID(), messageId })
1300
+ : await this.#projectLease({ leaseId: randomUUID(), messageId });
1301
+ } catch (error) {
1302
+ const said = String(error?.message ?? error ?? '').split('\n')[0].slice(0, 300);
1303
+ const text = t('MADRE could not prepare the folder where @{agent} writes, so nothing was started: {error}', { agent: parsed.target, error: said });
1304
+ await this.#emit('message.failed', { messageId, target: parsed.target, error: this.#privacy ? this.#privacy.redact(text).text : text });
1305
+ return { messageId, responseMessageId: null };
1306
+ }
1307
+ // A module asked for, with any #2 lease (the draft folder or the project): the guide goes
1308
+ // inside the project for the agent to read.
1309
+ if (draft === true || wantsModule(text2)) lease.sdk = await this.#sdkInProject();
1284
1310
  // CREATE authorizes the plan to use each delegate's enabled creation
1285
1311
  // scopes; a default-#2 lease authorizes files only.
1286
1312
  lease.scopeCeiling = { write: true, imageGen: !standing, web: true };
@@ -1334,6 +1360,23 @@ export class Room {
1334
1360
  const draft = await createLease({ projectRoot: this.#projectRoot, leaseId });
1335
1361
  return { ...draft, messageId, draft: true };
1336
1362
  }
1363
+ // The SDK guide `/module` asks the agent to read, copied inside the project (.pulse/sdk/): a CLI
1364
+ // that may read only its project — OpenCode denies any other directory — refused to write a module
1365
+ // it could not read the guide for (2026-10-29). MADRE's own copy is the fallback.
1366
+ async #sdkInProject() {
1367
+ const from = sdkPaths();
1368
+ const dir = joinPath(this.#projectRoot, '.pulse', 'sdk');
1369
+ try {
1370
+ await mkdirPath(dir, { recursive: true });
1371
+ const copied = {};
1372
+ for (const [key, path] of Object.entries(from)) {
1373
+ const target = joinPath(dir, baseName(path));
1374
+ await copyFile(path, target);
1375
+ copied[key] = target;
1376
+ }
1377
+ return copied;
1378
+ } catch { return from; }
1379
+ }
1337
1380
 
1338
1381
  // Artifacts from a #2 turn: the files the checkpoint saw appear, as the room shows them.
1339
1382
  // Said once, when a writing turn has to wait for the one already writing in the project.
@@ -1404,6 +1447,22 @@ export class Room {
1404
1447
  return [...this.#turns.entries()].map(([messageId, turn]) => ({ messageId, agent: turn.agent, planId: turn.planId, startedAt: turn.startedAt }));
1405
1448
  }
1406
1449
 
1450
+ // What this room is doing now, for «En marcha» (2026-10-30): each turn with what it was asked,
1451
+ // its limit and its subagents; each plan with its steps; each command it keeps alive. Read only.
1452
+ activity() {
1453
+ const turns = [...this.#turns.entries()].map(([messageId, turn]) => ({
1454
+ kind: 'turn', messageId, agent: turn.agent, planId: turn.planId ?? null, startedAt: turn.startedAt,
1455
+ timeoutMs: turn.timeoutMs ?? null, text: turn.text ?? '', mode: turn.mode ?? null,
1456
+ subagents: (turn.subagents ?? []).map(({ kind, task, status, seconds }) => ({ kind, task, status, seconds })),
1457
+ }));
1458
+ const plans = [...this.#plans.values()].map((plan) => ({
1459
+ kind: 'plan', planId: plan.planId, orchestrator: plan.orchestrator, step: plan.step, total: plan.steps.length + (plan.closing ? 1 : 0),
1460
+ startedAt: plan.startedAt, steps: plan.steps.map((one) => ({ agent: one.agent, text: clip(one.text, 160) })),
1461
+ }));
1462
+ const runs = this.#runDesk.live().map((one) => ({ kind: 'run', ...one }));
1463
+ return [...plans, ...turns, ...runs];
1464
+ }
1465
+
1407
1466
  // Master brake: every plan and every in-flight turn, recorded as one event.
1408
1467
  async stopAll(reason = t('STOPALL by the human')) {
1409
1468
  const plans = this.#plans.size;
@@ -1471,7 +1530,7 @@ export class Room {
1471
1530
  // @madre is not a CLI to install: it is the room's local agent, here while Ollama runs with a
1472
1531
  // chat model. Saying "not installed" sent people to install something that does not exist.
1473
1532
  const error = agent?.local || targetId === 'madre'
1474
- ? `@${targetId} left the project: Ollama is not running. Start Ollama, or open Local AI in Modules.`
1533
+ ? `@${targetId} left the project: Ollama is not running. Start Ollama, or set up Local AI in Settings.`
1475
1534
  : `${targetId} is not installed on this computer.`;
1476
1535
  await this.#emit('message.failed', { messageId, target: targetId, planId, error });
1477
1536
  return null;
@@ -1525,11 +1584,15 @@ export class Room {
1525
1584
  }
1526
1585
  // The limit this turn will be held to, said with its start so the room counts down from the
1527
1586
  // real number and not from a default it guessed.
1528
- await this.#emit('agent.started', { messageId, agent: agent.id, handoffId, planId, timeoutMs: this.timeoutFor(agent.id, { writing: Number(mode) >= 2 || Boolean(lease) }) });
1587
+ const timeoutMs = this.timeoutFor(agent.id, { writing: Number(mode) >= 2 || Boolean(lease) || subagentsAllowed(agent.id, { airlock: Number(mode) === 4 }) });
1588
+ await this.#emit('agent.started', { messageId, agent: agent.id, handoffId, planId, timeoutMs });
1529
1589
  const controller = new AbortController();
1530
- const turn = { controller, promise: null, planId, agent: agent.id, startedAt: Date.now() };
1531
- turn.promise = this.#runTurn({ messageId, agent, text, requester, depth, planId, allowDelegation, context, recall, memories, handoffId, signal: controller.signal, model, effort, attachments, references, lease, ash, mode, escalation, returned, copilot });
1590
+ // What it was asked and its limit ride with it, for «En marcha» (activity, below).
1591
+ const turn = { controller, promise: null, planId, agent: agent.id, startedAt: Date.now(), timeoutMs, text: clip(text, 200), mode: Number(mode), subagents: [] };
1592
+ // Held before it starts: with nothing to wait for, a turn reaches its CLI before this line runs
1593
+ // again, and what the CLI reports at once (its subagents) found no turn to ride on.
1532
1594
  this.#turns.set(messageId, turn);
1595
+ turn.promise = this.#runTurn({ messageId, agent, text, requester, depth, planId, allowDelegation, context, recall, memories, handoffId, signal: controller.signal, model, effort, attachments, references, lease, ash, mode, escalation, returned, copilot });
1533
1596
  let outcome = null;
1534
1597
  try {
1535
1598
  outcome = await turn.promise;
@@ -1641,25 +1704,25 @@ export class Room {
1641
1704
  const scopes = this.scopesFor(agent.id);
1642
1705
  const ceiling = Math.min(mode, scopes.maxMode ?? 0);
1643
1706
  const mcpServers = this.#toolsForTurn ? await this.#toolsForTurn({ agent: agent.id, mode: ceiling, lease: null, scratchDir: null }).catch(() => []) : [];
1644
- const prompt = '<the briefing above>';
1707
+ const prompt = t('<the briefing above>');
1645
1708
  const shared = { projectRoot: this.#projectRoot, prompt, model: null, attachments: [], lease: null, scopes: { web: scopes.web.enabled && scopes.web.wired, imageGen: scopes.imageGen.enabled && scopes.imageGen.wired }, memoryServer: this.#memoryServer, mcpServers };
1646
1709
  const args = agent.id === 'codex' ? buildCodexArgs(shared)
1647
1710
  : agent.id === 'claude' ? buildClaudeArgs({ ...shared, attachmentsDir: null, imageStudio: null })
1648
- : agent.id === 'gemini' ? buildGeminiArgs({ ...shared, policyPath: '<written for this turn, deleted after it>', attachmentsDir: null })
1711
+ : agent.id === 'gemini' ? buildGeminiArgs({ ...shared, policyPath: t('<written for this turn, deleted after it>'), attachmentsDir: null })
1649
1712
  : agent.id === 'opencode' ? buildOpenCodeArgs(shared)
1650
1713
  : agent.id === 'cursor' ? buildCursorArgs(shared)
1651
1714
  : null;
1652
- if (!args) return { agent: agent.id, label: agent.label, local: false, says: `MADRE has no adapter for @${agent.id}.`, mcpServers: [], env: [], isolation: [] };
1715
+ if (!args) return { agent: agent.id, label: agent.label, local: false, says: t('MADRE has no adapter for @{agent}.', { agent: agent.id }), mcpServers: [], env: [], isolation: [] };
1653
1716
  const isolation = {
1654
- codex: ['--ephemeral: the run keeps no session of its own, so nothing said here reaches another project.'],
1655
- claude: ['--no-session-persistence: the run keeps no session of its own.', 'Only the project\'s own CLAUDE.md and MADRE\'s briefing are read; hooks, plugins and outside MCP servers are not.'],
1656
- gemini: ['GEMINI_CLI_HOME points at a temporary home made for this turn and removed after it, so settings, hooks and extensions come from there and not from yours.', 'GEMINI_CLI_NO_RELAUNCH keeps the launcher from spawning a second process MADRE could not stop.'],
1657
- opencode: ['The run is given the model you chose and nothing else of your session.'],
1658
- cursor: ['--mode ask: Cursor\'s read-only mode, whatever its own settings say; no edits and no commands.', 'CURSOR_CONFIG_DIR points at a configuration made for this turn and removed after it: every command and every write denied. The sign-in stays in the system keychain.'],
1717
+ codex: [t('--ephemeral: the run keeps no session of its own, so nothing said here reaches another project.')],
1718
+ claude: [t('--no-session-persistence: the run keeps no session of its own.'), t('Only the project\'s own CLAUDE.md and MADRE\'s briefing are read; hooks, plugins and outside MCP servers are not.')],
1719
+ gemini: [t('GEMINI_CLI_HOME points at a temporary home made for this turn and removed after it, so settings, hooks and extensions come from there and not from yours.'), t('GEMINI_CLI_NO_RELAUNCH keeps the launcher from spawning a second process MADRE could not stop.')],
1720
+ opencode: [t('The run is given the model you chose and nothing else of your session.')],
1721
+ cursor: [t('#0 and #1: --mode ask, Cursor\'s read-only mode, whatever its own settings say; no edits and no commands. #2 and #3: its agent mode with --force, writing allowed and every command denied. #4: commands allowed too. The places nobody writes stay denied at every mode, and MADRE locks and puts them back itself.'), t('CURSOR_CONFIG_DIR points at a configuration made for this turn and removed after it, with only what the mode you chose allows. The sign-in stays in the system keychain.')],
1659
1722
  }[agent.id] ?? [];
1660
1723
  const env = {
1661
- gemini: [{ name: 'GEMINI_CLI_HOME', note: 'the temporary home for this turn' }, { name: 'GEMINI_CLI_NO_RELAUNCH', note: 'so the launcher stays killable' }],
1662
- cursor: [{ name: 'CURSOR_CONFIG_DIR', note: 'the configuration for this turn: read only' }, { name: 'NO_OPEN_BROWSER', note: 'a turn never opens a page' }],
1724
+ gemini: [{ name: 'GEMINI_CLI_HOME', note: t('the temporary home for this turn') }, { name: 'GEMINI_CLI_NO_RELAUNCH', note: t('so the launcher stays killable') }],
1725
+ cursor: [{ name: 'CURSOR_CONFIG_DIR', note: t('the configuration for this turn, from the mode you chose') }, { name: 'NO_OPEN_BROWSER', note: t('a turn never opens a page') }],
1663
1726
  }[agent.id] ?? [];
1664
1727
  return {
1665
1728
  agent: agent.id, label: agent.label, local: false,
@@ -1698,11 +1761,21 @@ export class Room {
1698
1761
  memoryServer: this.#memoryServer,
1699
1762
  controlHolder: this.#controlDesk.holder?.agent ?? null,
1700
1763
  privacyMarker: this.#privacy?.marker ?? '[ENTIDAD-ORG]',
1701
- sdk: sdkPaths(),
1764
+ sdk: input.lease?.sdk ?? sdkPaths(),
1702
1765
  madreModel: this.#agents.find((agent) => agent.id === 'madre' && agent.ready)?.version ?? null,
1703
1766
  });
1704
1767
  }
1705
1768
 
1769
+ // The photograph before writing could not be taken (2026-10-28: a project with a broken .git
1770
+ // folder). Nothing was written: the turn says so and ends, instead of waiting forever above the
1771
+ // try that reports failures, with the room showing «writing…» until MADRE was closed.
1772
+ async #couldNotSeat({ messageId, agent, planId, error }) {
1773
+ const said = String(error?.message ?? error ?? '').split('\n').filter(Boolean).slice(0, 2).join(' ').slice(0, 300);
1774
+ const text = t('MADRE could not take the restore point before @{agent} writes, so nothing was changed: {error}', { agent: agent.id, error: said });
1775
+ await this.#emit('message.failed', { messageId, target: agent.id, planId, error: this.#privacy ? this.#privacy.redact(text).text : text });
1776
+ return null;
1777
+ }
1778
+
1706
1779
  async #runTurn({ messageId, agent, text, requester, depth, planId, allowDelegation, context, recall = null, memories = null, handoffId, signal, model = null, effort = null, attachments = [], references = [], lease: sharedLease = null, ash = false, mode = 1, escalation = null, returned = null, copilot = false }) {
1707
1780
  // The lease is the human's; what each agent may do inside it is that
1708
1781
  // agent's own enabled scopes. A delegate without file creation runs
@@ -1726,8 +1799,9 @@ export class Room {
1726
1799
  await this.#alert('control-busy', `@${this.#controlDesk.holder.agent} still holds EDIT; @${agent.id} answers read-only this turn.`, `control-busy:${agent.id}`);
1727
1800
  } else {
1728
1801
  await this.#sayWaitingToWrite({ messageId, agent });
1729
- const seat = await this.#controlDesk.begin({ agent, messageId, enabledScopes: enabled, mode, signal }).catch((error) => (error?.code === 'ABORT_ERR' ? null : Promise.reject(error)));
1802
+ const seat = await this.#controlDesk.begin({ agent, messageId, enabledScopes: enabled, mode, signal }).catch((error) => (error?.code === 'ABORT_ERR' ? null : { failed: error }));
1730
1803
  if (!seat) { await this.#emit('message.failed', { messageId, target: agent.id, planId, error: `Stopped while waiting for the project: another turn was writing in it.`, stopped: true }); return null; }
1804
+ if (seat.failed) return this.#couldNotSeat({ messageId, agent, planId, error: seat.failed });
1731
1805
  controlRun = seat.run;
1732
1806
  // A copilot does not delete: what it removes is put back when the turn settles.
1733
1807
  if (asCopilot) controlRun.noDeletes = true;
@@ -1761,8 +1835,9 @@ export class Room {
1761
1835
  // CREATE: photograph the project now; after the turn only what appeared stays. Another turn
1762
1836
  // writing in the project, in this conversation or another, is waited for first.
1763
1837
  await this.#sayWaitingToWrite({ messageId, agent });
1764
- const seat = await this.#controlDesk.begin({ agent, messageId, enabledScopes: enabled, mode: 2, signal }).catch((error) => (error?.code === 'ABORT_ERR' ? null : Promise.reject(error)));
1838
+ const seat = await this.#controlDesk.begin({ agent, messageId, enabledScopes: enabled, mode: 2, signal }).catch((error) => (error?.code === 'ABORT_ERR' ? null : { failed: error }));
1765
1839
  if (!seat) { await this.#emit('message.failed', { messageId, target: agent.id, planId, error: `Stopped while waiting for the project: another turn was writing in it.`, stopped: true }); return null; }
1840
+ if (seat.failed) return this.#couldNotSeat({ messageId, agent, planId, error: seat.failed });
1766
1841
  createRun = seat.run;
1767
1842
  // The folder this turn was told to draft in, so settling it does not undo what it was
1768
1843
  // invited to write. Only this turn's own folder; every other `.pulse` path stays forbidden.
@@ -1791,6 +1866,11 @@ export class Room {
1791
1866
  : null;
1792
1867
  // The turn's effective mode: #0 for ghosts, #3 in control, #2 only while it holds a lease.
1793
1868
  const turnMode = mode === 0 ? 0 : controlRun ? controlRun.mode : lease ? 2 : 1;
1869
+ // A turn whose agent may hand work to its own subagents gets the longer clock (QA 1.1.0,
1870
+ // NUE-23): OpenCode on its free models with two subagents took three minutes in #1 and was cut
1871
+ // at 180 s with nothing kept. What the subagents reported is kept for the failure too.
1872
+ const helperClock = Boolean(lease) || subagentsAllowed(agent.id, { airlock: Number(turnMode) === 4 });
1873
+ let helpersSeen = null;
1794
1874
  try {
1795
1875
  const invoke = this.#invokers[agent.adapter];
1796
1876
  if (!invoke) throw new Error(`${agent.label} does not have a supported MADRE adapter.`);
@@ -1823,7 +1903,22 @@ export class Room {
1823
1903
  // around it, so a CLI that hands over one blob at the end honestly reports nothing until
1824
1904
  // then rather than a number that means the shape of its own output format.
1825
1905
  let told = 0;
1826
- const onProgress = ({ chars }) => {
1906
+ // And its own subagents, as the CLI reports them (src/adapters/subagents.mjs): said again only
1907
+ // when what they are doing changes, through the same privacy guard as the answer.
1908
+ let helpersSaid = '';
1909
+ const keepHelpers = (list) => keptSubagents(list, { redact: (said) => (this.#privacy ? this.#privacy.redact(said).text : said) });
1910
+ const onProgress = ({ chars, subagents }) => {
1911
+ if (Array.isArray(subagents) && subagents.length) {
1912
+ const kept = keepHelpers(subagents);
1913
+ const key = JSON.stringify(kept);
1914
+ if (key !== helpersSaid) {
1915
+ helpersSaid = key;
1916
+ helpersSeen = kept;
1917
+ const held = this.#turns.get(messageId);
1918
+ if (held) held.subagents = kept;
1919
+ this.#say('turn.subagents', { messageId, agent: agent.id, mode: turnMode, subagents: kept });
1920
+ }
1921
+ }
1827
1922
  if (!Number.isFinite(chars) || chars <= told) return;
1828
1923
  told = chars;
1829
1924
  this.#say('turn.reading', { messageId, agent: agent.id, ...reading, out: chars, outTokens: this.#rate ? Math.round(chars / this.#rate) : null });
@@ -1834,7 +1929,7 @@ export class Room {
1834
1929
  projectRoot: this.#projectRoot,
1835
1930
  text,
1836
1931
  prompt: shaped.text,
1837
- timeoutMs: this.timeoutFor(agent.id, { writing: Boolean(lease) }),
1932
+ timeoutMs: this.timeoutFor(agent.id, { writing: helperClock }),
1838
1933
  signal,
1839
1934
  model,
1840
1935
  effort,
@@ -1853,6 +1948,9 @@ export class Room {
1853
1948
  // And for its closing turn of a round: what each agent asked actually said, with its number.
1854
1949
  round: agent.id === MADRE_AGENT_ID && planId && /this is your closing turn/i.test(text) ? await this.#roundAnswers(planId) : undefined,
1855
1950
  });
1951
+ // STOP was pressed while the agent answered: whatever comes back late is not said (2026-10-20).
1952
+ // An adapter that does not hear the signal still cannot post an answer the person stopped.
1953
+ signal?.throwIfAborted();
1856
1954
  // Privacy: a private term in a reply is replaced before the ledger, the plan parser,
1857
1955
  // the archivist or any other agent can see it. The reply says how many, not which.
1858
1956
  const guarded = this.#privacy?.redact(result.text ?? '') ?? { text: result.text, hits: 0 };
@@ -1938,6 +2036,8 @@ export class Room {
1938
2036
  leaseId: lease?.leaseId,
1939
2037
  artifacts: artifacts.length ? artifacts : undefined,
1940
2038
  delegates: directives.steps.length ? directives.steps.map((step) => step.agent) : undefined,
2039
+ // Who helped, from the CLI's own subagents: folded under the answer («Helped by…»).
2040
+ subagents: keepHelpers(result.subagents),
1941
2041
  });
1942
2042
  if (ash && turnMode !== 0) {
1943
2043
  const validation = validateAshReply({ request: text, response: result.text });
@@ -1981,7 +2081,10 @@ export class Room {
1981
2081
  await this.#recordUsage(agent.id, result.usage, { messageId, responseMessageId });
1982
2082
  await this.#recordCost(agent.id, responseMessageId, result.usage, turnMode);
1983
2083
  this.#liveTurns.delete(responseMessageId);
1984
- await this.#emit('agent.completed', { messageId, agent: agent.id, handoffId, planId });
2084
+ // Which model the turn ran on, when the room knows it (the one asked for, or the agent's
2085
+ // default): what answered is what MADRE can offer again when another model fails.
2086
+ const ranOn = await this.#pricedModel(agent.id, model).catch(() => null);
2087
+ await this.#emit('agent.completed', { messageId, agent: agent.id, handoffId, planId, ...(ranOn ? { ranOn } : {}) });
1985
2088
  return { responseMessageId, directives };
1986
2089
  } catch (error) {
1987
2090
  if (responseMessageId) this.#liveTurns.delete(responseMessageId);
@@ -2014,12 +2117,17 @@ export class Room {
2014
2117
  }
2015
2118
  }
2016
2119
  const cutByClock = ['TIMEOUT', 'IDLE'].includes(error?.code);
2120
+ const failedOn = await this.#pricedModel(agent.id, model).catch(() => null);
2017
2121
  await this.#emit('message.failed', {
2018
2122
  messageId, target: agent.id, planId,
2123
+ ...(failedOn ? { ranOn: failedOn } : {}),
2019
2124
  error: this.#privacy ? this.#privacy.redact(plain).text : plain,
2020
2125
  ...(this.#turns.get(messageId)?.stoppedByHuman ? { stopped: true } : {}),
2021
- ...(cutByClock ? { timeout: { ms: this.timeoutFor(agent.id, { writing: Boolean(lease) }), writing: Boolean(lease), idle: error.code === 'IDLE' } } : {}),
2126
+ // Cut because MADRE is closing: nothing went wrong in the turn, so nobody files it as a fault.
2127
+ ...(this.#shuttingDown ? { closing: true } : {}),
2128
+ ...(cutByClock ? { timeout: { ms: this.timeoutFor(agent.id, { writing: helperClock }), writing: Boolean(lease), idle: error.code === 'IDLE' } } : {}),
2022
2129
  ...(partial ? { partial } : {}),
2130
+ ...(helpersSeen?.length ? { subagents: helpersSeen } : {}),
2023
2131
  });
2024
2132
  return null;
2025
2133
  } finally {
package/src/router.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
  const supported = new Set(['codex', 'claude', 'gemini', 'opencode', 'cursor']);
4
4
 
5
5
  export function parseMessage(text, fallbackTarget = null) {
package/src/runs.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
  // An agent asking the human to run a command.
4
4
  //
5
5
  // Below #4 AIRLOCK no agent runs anything: it reads, it writes where its mode allows, and that is