@jossuealcala/madre 1.0.5 → 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 (278) hide show
  1. package/ADDITIONAL-TERMS.md +7 -2
  2. package/CHANGELOG.en.md +47 -1
  3. package/CHANGELOG.md +47 -1
  4. package/CONTRIBUTING.md +2 -2
  5. package/LICENSE +111 -661
  6. package/NOTICE +28 -23
  7. package/README.en.md +30 -101
  8. package/README.md +30 -103
  9. package/SECURITY.md +1 -0
  10. package/TRADEMARKS.en.md +13 -14
  11. package/TRADEMARKS.md +24 -26
  12. package/bin/madre.cjs +2 -2
  13. package/bin/madre.mjs +112 -40
  14. package/docs/REFERENCE.md +52 -5
  15. package/docs/SDK.md +21 -3
  16. package/docs/en/REFERENCE.md +52 -5
  17. package/docs/en/SDK.md +22 -3
  18. package/docs/sdk/hello-module.mjs +3 -0
  19. package/package.json +3 -2
  20. package/public/abduction.js +6 -6
  21. package/public/activity.js +425 -0
  22. package/public/app.js +2468 -435
  23. package/public/assets/abduction-cat-blink.webp +0 -0
  24. package/public/assets/abduction-cat-control-left.webp +0 -0
  25. package/public/assets/abduction-cat-control-right.webp +0 -0
  26. package/public/assets/abduction-cat.webp +0 -0
  27. package/public/assets/manual/shots/en-agents.webp +0 -0
  28. package/public/assets/manual/shots/en-chats.webp +0 -0
  29. package/public/assets/manual/shots/en-code.webp +0 -0
  30. package/public/assets/manual/shots/en-composer.webp +0 -0
  31. package/public/assets/manual/shots/en-connectors.webp +0 -0
  32. package/public/assets/manual/shots/en-continuity.webp +0 -0
  33. package/public/assets/manual/shots/en-coordinator.webp +0 -0
  34. package/public/assets/manual/shots/en-copilot.webp +0 -0
  35. package/public/assets/manual/shots/en-diagnostics.webp +0 -0
  36. package/public/assets/manual/shots/en-home.webp +0 -0
  37. package/public/assets/manual/shots/en-local.webp +0 -0
  38. package/public/assets/manual/shots/en-market.webp +0 -0
  39. package/public/assets/manual/shots/en-memory.webp +0 -0
  40. package/public/assets/manual/shots/en-modes.webp +0 -0
  41. package/public/assets/manual/shots/en-notes.webp +0 -0
  42. package/public/assets/manual/shots/en-settings.webp +0 -0
  43. package/public/assets/manual/shots/en-welcome.webp +0 -0
  44. package/public/assets/manual/shots/en-windows.webp +0 -0
  45. package/public/assets/manual/shots/es-agents.webp +0 -0
  46. package/public/assets/manual/shots/es-chats.webp +0 -0
  47. package/public/assets/manual/shots/es-code.webp +0 -0
  48. package/public/assets/manual/shots/es-composer.webp +0 -0
  49. package/public/assets/manual/shots/es-connectors.webp +0 -0
  50. package/public/assets/manual/shots/es-continuity.webp +0 -0
  51. package/public/assets/manual/shots/es-coordinator.webp +0 -0
  52. package/public/assets/manual/shots/es-copilot.webp +0 -0
  53. package/public/assets/manual/shots/es-diagnostics.webp +0 -0
  54. package/public/assets/manual/shots/es-home.webp +0 -0
  55. package/public/assets/manual/shots/es-local.webp +0 -0
  56. package/public/assets/manual/shots/es-market.webp +0 -0
  57. package/public/assets/manual/shots/es-memory.webp +0 -0
  58. package/public/assets/manual/shots/es-modes.webp +0 -0
  59. package/public/assets/manual/shots/es-notes.webp +0 -0
  60. package/public/assets/manual/shots/es-settings.webp +0 -0
  61. package/public/assets/manual/shots/es-welcome.webp +0 -0
  62. package/public/assets/manual/shots/es-windows.webp +0 -0
  63. package/public/assets/news/1.1/en/chats.webp +0 -0
  64. package/public/assets/news/1.1/en/home.webp +0 -0
  65. package/public/assets/news/1.1/en/maps.webp +0 -0
  66. package/public/assets/news/1.1/en/market.webp +0 -0
  67. package/public/assets/news/1.1/en/permissions.webp +0 -0
  68. package/public/assets/news/1.1/en/privacy.webp +0 -0
  69. package/public/assets/news/1.1/en/welcome.webp +0 -0
  70. package/public/assets/news/1.1/es/chats.webp +0 -0
  71. package/public/assets/news/1.1/es/home.webp +0 -0
  72. package/public/assets/news/1.1/es/maps.webp +0 -0
  73. package/public/assets/news/1.1/es/market.webp +0 -0
  74. package/public/assets/news/1.1/es/permissions.webp +0 -0
  75. package/public/assets/news/1.1/es/privacy.webp +0 -0
  76. package/public/assets/news/1.1/es/welcome.webp +0 -0
  77. package/public/attribution.js +15 -16
  78. package/public/brands.js +2 -2
  79. package/public/code-tools.js +2 -2
  80. package/public/editor.js +13 -13
  81. package/public/en.js +413 -4
  82. package/public/es.js +1345 -483
  83. package/public/hardware.js +2 -2
  84. package/public/i18n.js +2 -2
  85. package/public/icons.js +158 -0
  86. package/public/index.html +66 -48
  87. package/public/inquiry.js +2 -2
  88. package/public/loader.js +271 -2
  89. package/public/macroverso.js +60 -21
  90. package/public/manual-content.js +412 -169
  91. package/public/manual-shots.js +38 -34
  92. package/public/manual.css +20 -2
  93. package/public/manual.html +1 -1
  94. package/public/manual.js +54 -25
  95. package/public/market-art.js +47 -45
  96. package/public/market-view.js +111 -33
  97. package/public/market.js +132 -30
  98. package/public/mcp-catalog.js +2 -2
  99. package/public/neural.js +64 -8
  100. package/public/nostromo-engine.js +709 -40
  101. package/public/page-errors.js +29 -0
  102. package/public/power.js +350 -11
  103. package/public/remedy.js +89 -0
  104. package/public/resay.js +3 -2
  105. package/public/review-ask.js +12 -7
  106. package/public/routing.js +3 -3
  107. package/public/salas-mac.css +703 -24
  108. package/public/salas-mac.html +26 -14
  109. package/public/salas-mac.js +1254 -289
  110. package/public/salas.css +2 -2
  111. package/public/salas.html +3 -3
  112. package/public/salas.js +3 -3
  113. package/public/styles.css +2404 -291
  114. package/public/syntax.js +2 -2
  115. package/public/terms.js +152 -0
  116. package/public/touch.js +2 -2
  117. package/public/tour-chapters.js +10 -10
  118. package/public/tour.js +56 -8
  119. package/public/troubleshooting.js +182 -11
  120. package/public/wallpaper.js +4 -3
  121. package/public/welcome.js +923 -0
  122. package/src/activity.mjs +85 -0
  123. package/src/adapters/claude.mjs +61 -35
  124. package/src/adapters/codex.mjs +18 -5
  125. package/src/adapters/cursor.mjs +5 -3
  126. package/src/adapters/gemini.mjs +5 -3
  127. package/src/adapters/madre.mjs +3 -3
  128. package/src/adapters/opencode.mjs +73 -10
  129. package/src/adapters/process.mjs +14 -13
  130. package/src/adapters/subagents.mjs +159 -0
  131. package/src/asking.mjs +8 -2
  132. package/src/auth-probe.mjs +27 -10
  133. package/src/bridge/devices.mjs +2 -2
  134. package/src/bridge/handoff.mjs +2 -2
  135. package/src/bridge/host.mjs +2 -2
  136. package/src/bridge/network.mjs +2 -2
  137. package/src/bridge/policy.mjs +3 -3
  138. package/src/bridge/qr.mjs +2 -2
  139. package/src/bridge/server.mjs +2 -2
  140. package/src/builtin-updates.mjs +87 -0
  141. package/src/capabilities.mjs +2 -2
  142. package/src/chats.mjs +51 -2
  143. package/src/checkpoint.mjs +67 -9
  144. package/src/choices.mjs +2 -2
  145. package/src/cli-args.mjs +2 -2
  146. package/src/cold.mjs +2 -2
  147. package/src/commands.mjs +2 -2
  148. package/src/config.mjs +2 -2
  149. package/src/conversation-context.mjs +2 -2
  150. package/src/credentials.mjs +56 -16
  151. package/src/dataset.mjs +2 -2
  152. package/src/directives.mjs +2 -2
  153. package/src/distiller.mjs +2 -2
  154. package/src/embeddings.mjs +2 -2
  155. package/src/enlaces.mjs +2 -2
  156. package/src/environment.mjs +147 -0
  157. package/src/event-store.mjs +2 -2
  158. package/src/exam.mjs +2 -2
  159. package/src/extensions.mjs +2 -2
  160. package/src/eyecat-watch.mjs +2 -2
  161. package/src/eyecat.mjs +2 -2
  162. package/src/file-ops.mjs +2 -2
  163. package/src/files.mjs +2 -2
  164. package/src/github.mjs +2 -2
  165. package/src/heartbeat.mjs +2 -2
  166. package/src/history.mjs +2 -2
  167. package/src/i18n.mjs +9 -2
  168. package/src/image-studio.mjs +2 -2
  169. package/src/install-metrics.mjs +109 -0
  170. package/src/json-file.mjs +2 -2
  171. package/src/launch.mjs +2 -2
  172. package/src/lease.mjs +15 -4
  173. package/src/lobby-work.mjs +11 -4
  174. package/src/local-ai.mjs +2 -2
  175. package/src/looks.mjs +2 -2
  176. package/src/market-check.mjs +165 -0
  177. package/src/market-key.mjs +10 -2
  178. package/src/market-license.mjs +4 -4
  179. package/src/market-remote.mjs +54 -12
  180. package/src/maturity.mjs +2 -2
  181. package/src/mcp/connect.mjs +2 -2
  182. package/src/mcp/github-server.mjs +2 -2
  183. package/src/mcp/image-server.mjs +2 -2
  184. package/src/mcp/memory-server.mjs +2 -2
  185. package/src/mcp/proxy.mjs +2 -2
  186. package/src/mcp/smtp-server.mjs +2 -2
  187. package/src/memory-dashboard.mjs +2 -2
  188. package/src/memory-tools.mjs +2 -2
  189. package/src/memory.mjs +2 -2
  190. package/src/models.mjs +33 -3
  191. package/src/module-scope.mjs +2 -2
  192. package/src/modules/ahp.mjs +2 -2
  193. package/src/modules/ash-policy.mjs +2 -2
  194. package/src/modules/ash.mjs +2 -2
  195. package/src/modules/bishop-exam.mjs +2 -2
  196. package/src/modules/bishop-plan.mjs +2 -2
  197. package/src/modules/bishop.mjs +9 -3
  198. package/src/modules/choices.mjs +2 -2
  199. package/src/modules/correo.mjs +2 -2
  200. package/src/modules/enlaces.mjs +2 -2
  201. package/src/modules/git-pulse.mjs +2 -2
  202. package/src/modules/github.mjs +2 -2
  203. package/src/modules/helpers.mjs +2 -2
  204. package/src/modules/image-studio.mjs +2 -2
  205. package/src/modules/index.mjs +90 -5
  206. package/src/modules/intents-calibration.mjs +2 -2
  207. package/src/modules/intents-desk.mjs +4 -3
  208. package/src/modules/intents-observe.mjs +2 -2
  209. package/src/modules/intents-policy.mjs +2 -2
  210. package/src/modules/intents-try.mjs +2 -2
  211. package/src/modules/intents.mjs +2 -2
  212. package/src/modules/local-models.mjs +14 -11
  213. package/src/modules/mcp-connect.mjs +2 -2
  214. package/src/modules/notes.mjs +159 -20
  215. package/src/modules/ollama.mjs +9 -3
  216. package/src/modules/playwright.mjs +2 -2
  217. package/src/modules/reminders.mjs +356 -37
  218. package/src/modules/ripley.mjs +3 -3
  219. package/src/modules/runs.mjs +2 -2
  220. package/src/modules/sdk.mjs +38 -6
  221. package/src/modules/updates.mjs +2 -2
  222. package/src/mother.mjs +2 -2
  223. package/src/npm-launch.mjs +2 -2
  224. package/src/ollama.mjs +6 -4
  225. package/src/opencode-health.mjs +26 -6
  226. package/src/outbound.mjs +10 -2
  227. package/src/override.mjs +27 -22
  228. package/src/ports.mjs +2 -2
  229. package/src/prices.mjs +2 -2
  230. package/src/privacy.mjs +2 -2
  231. package/src/quota-monitor.mjs +2 -2
  232. package/src/quota-sources.mjs +2 -2
  233. package/src/request-guard.mjs +2 -2
  234. package/src/review-ask.mjs +4 -3
  235. package/src/room/archivist.mjs +2 -2
  236. package/src/room/attachments.mjs +2 -2
  237. package/src/room/budget.mjs +2 -2
  238. package/src/room/context.mjs +2 -2
  239. package/src/room/control.mjs +2 -2
  240. package/src/room/copilot.mjs +2 -2
  241. package/src/room/economy.mjs +2 -2
  242. package/src/room/escalation.mjs +2 -2
  243. package/src/room/ghost.mjs +2 -2
  244. package/src/room/guard.mjs +6 -4
  245. package/src/room/prompt.mjs +3 -3
  246. package/src/room/returns.mjs +2 -2
  247. package/src/room/runs.mjs +6 -4
  248. package/src/room/vectors.mjs +2 -2
  249. package/src/room.mjs +127 -31
  250. package/src/router.mjs +2 -2
  251. package/src/runs.mjs +2 -2
  252. package/src/runtime-detection.mjs +31 -5
  253. package/src/salas.mjs +31 -6
  254. package/src/sentinel-errors.mjs +13 -4
  255. package/src/server-sentinel.mjs +2 -2
  256. package/src/server.mjs +689 -80
  257. package/src/setup-trouble.mjs +33 -0
  258. package/src/setup.mjs +4 -4
  259. package/src/smtp.mjs +2 -2
  260. package/src/telemetry.mjs +266 -0
  261. package/src/terms.mjs +43 -0
  262. package/src/tour.mjs +39 -5
  263. package/src/uninstall.mjs +225 -0
  264. package/src/updates.mjs +2 -2
  265. package/src/usage-sentinel.mjs +2 -2
  266. package/src/vault.mjs +2 -2
  267. package/src/verdict.mjs +13 -10
  268. package/src/whats-new.mjs +97 -3
  269. package/public/assets/abduction-cat-blink.png +0 -0
  270. package/public/assets/abduction-cat-control-left.png +0 -0
  271. package/public/assets/abduction-cat-control-right.png +0 -0
  272. package/public/assets/abduction-cat.png +0 -0
  273. package/public/assets/manual/madre-manual-en.pdf +0 -0
  274. package/public/assets/manual/madre-manual-es.pdf +0 -0
  275. package/public/assets/manual/shots/en-modules.webp +0 -0
  276. package/public/assets/manual/shots/es-modules.webp +0 -0
  277. package/src/mcp/notes-server.mjs +0 -120
  278. package/src/reminder-time.mjs +0 -127
@@ -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
  // MADRE's module SDK. A module is one file: what it is, the settings it keeps
4
4
  // in ~/.pulse/config.json, how it describes itself to MODULES, what its switch
5
5
  // does, the routes it serves and the events it listens to. The server builds a
@@ -69,7 +69,20 @@ export function dependencies(runs) {
69
69
  return list.filter((dep) => dep && dep.name).map((dep) => ({ name: String(dep.name), version: dep.version ?? null, target: dep.target ?? null }));
70
70
  }
71
71
 
72
- // Every field this contract answers to. Thirty-eight of them and all but two optional, which is
72
+ // The contracts this MADRE understands (2026-10-25). A module says which one it was written for
73
+ // with `sdk`, a whole number; without it, it is 1, the contract of 1.0.5 and before. A number
74
+ // counts what MADRE hands a module, not MADRE's version: a new MADRE keeps every contract it can,
75
+ // so a module does not have to be published again for it, and the Market offers a module to a
76
+ // MADRE that understands its contract, whatever its release (src/market-remote.mjs).
77
+ // 1 everything up to 1.0.5
78
+ // 2 ctx.t for words in the room's language, ctx.services.ollama.generate, and a module that is
79
+ // one file: its own logic and its own tool server, nothing imported from MADRE
80
+ export const SDK_LEVELS = Object.freeze([1, 2]);
81
+ export const SDK_LEVEL = SDK_LEVELS.at(-1);
82
+ export const sdkOf = (spec) => (spec?.sdk === undefined ? 1 : spec.sdk);
83
+ export const understandsSdk = (level) => SDK_LEVELS.includes(level);
84
+
85
+ // Every field this contract answers to. Forty-one of them and all but two optional, which is
73
86
  // generous until you misspell one: `sumary` used to install without a word and leave a card with
74
87
  // an empty summary. A key MADRE does not know is not fatal — a module written for a newer MADRE
75
88
  // may carry fields this one has not learned yet — so it is said out loud instead of refused.
@@ -78,7 +91,7 @@ export const MODULE_FIELDS = new Set([
78
91
  'requires', 'models', 'commands', 'card', 'configKey', 'settings', 'controls', 'routes', 'reaches',
79
92
  'conditions', 'slash', 'status', 'preflight', 'detect', 'confirm', 'installCommand', 'secrets',
80
93
  'updatePlan', 'toolsForTurn', 'toggle', 'onToggle', 'onSettings', 'onEvent', 'toggledEvent',
81
- 'toggledBody', 'describe', 'ready', 'footer', 'credit',
94
+ 'toggledBody', 'describe', 'ready', 'footer', 'credit', 'sdk', 'icon',
82
95
  ]);
83
96
  export const unknownFields = (spec) => Object.keys(spec ?? {}).filter((key) => !MODULE_FIELDS.has(key));
84
97
 
@@ -103,9 +116,24 @@ function footerKeys(spec) {
103
116
  });
104
117
  }
105
118
 
119
+ // A module's own icon (2026-10-27): a drawing and the color of its tile. MADRE fits the drawing to
120
+ // its tile, draws it in one color and picks the nearest of its own tile colors, so a module somebody
121
+ // wrote sits beside MADRE's own without looking like another app (public/market.js, moduleFace).
122
+ // Here it is only kept to its size: the page cleans the drawing before it shows it.
123
+ const ICON_COLOR = /^#[0-9a-f]{6}$/i;
124
+ function moduleIconOf(spec) {
125
+ const given = typeof spec.icon === 'string' ? { svg: spec.icon } : spec.icon;
126
+ if (!given || typeof given !== 'object' || typeof given.svg !== 'string' || !given.svg.trim()) return null;
127
+ if (given.svg.length > 8000) throw new Error(`Module ${spec.id}: its icon is a drawing of 8000 characters at most.`);
128
+ return { svg: given.svg.trim(), color: typeof given.color === 'string' && ICON_COLOR.test(given.color) ? given.color.toLowerCase() : null };
129
+ }
130
+
106
131
  export function defineModule(spec) {
107
132
  if (!spec?.id || !/^[a-z][a-z0-9-]*$/.test(spec.id)) throw new Error(`Module id must be kebab-case: ${spec?.id}`);
108
133
  if (!spec.name) throw new Error(`Module ${spec.id} needs a name.`);
134
+ const sdk = sdkOf(spec);
135
+ if (!Number.isInteger(sdk) || sdk < 1) throw new Error(`Module ${spec.id}: sdk is a whole number, the contract it was written for.`);
136
+ if (!understandsSdk(sdk)) throw new Error(`Module ${spec.id} was written for contract ${sdk} of the SDK, and this MADRE understands up to ${SDK_LEVEL}. Update MADRE to use it.`);
109
137
  const kind = spec.kind ?? 'builtin';
110
138
  const configKey = spec.configKey ?? camel(spec.id);
111
139
  // Its name and what it does may come in both languages, { es, en } (2026-10-20): MADRE keeps one
@@ -114,7 +142,7 @@ export function defineModule(spec) {
114
142
  const nameText = oneWord(spec.name);
115
143
  const defaults = { ...(kind === 'builtin' ? { enabled: false } : {}), ...(spec.settings ?? {}) };
116
144
  const base = {
117
- id: spec.id, kind, name: nameText, vendor: spec.vendor ?? 'MADRE', package: spec.package ?? null, version: spec.version ?? null,
145
+ id: spec.id, sdk, kind, name: nameText, vendor: spec.vendor ?? 'MADRE', package: spec.package ?? null, version: spec.version ?? null,
118
146
  words: { name: isBilingual(spec.name) ? spec.name : null, summary: isBilingual(spec.summary) ? spec.summary : null },
119
147
  // Keys this contract does not answer to. Carried so whoever installs the module is told.
120
148
  unknown: unknownFields(spec),
@@ -127,6 +155,8 @@ export function defineModule(spec) {
127
155
  updates: spec.updates?.url && /^https:\/\//.test(String(spec.updates.url)) ? { url: String(spec.updates.url) } : null,
128
156
  // Keys beside MADRE's version, drawn by MADRE while the module is on (footerKeys).
129
157
  footer: footerKeys(spec),
158
+ // Its own icon, kept to its size (moduleIconOf).
159
+ icon: moduleIconOf(spec),
130
160
  // Whose idea it was (2026-10-20, Reminders): said on its card and in the Market.
131
161
  credit: typeof spec.credit === 'string' && spec.credit.trim() ? spec.credit.trim().slice(0, 80) : null,
132
162
  summary: oneWord(spec.summary) ?? '', creates: spec.creates ?? [], requires: spec.requires ?? [], models: spec.models ?? [], commands: spec.commands ?? (spec.slash?.length ? spec.slash.map((command) => command.usage ?? `/${command.name}`) : undefined),
@@ -183,7 +213,9 @@ export function defineModule(spec) {
183
213
  configKey,
184
214
  defaults,
185
215
  settingsFrom,
186
- routes: (spec.routes ?? []).map((route) => ({ ...route, method: route.method.toUpperCase() })),
216
+ // A route is handed the module's own settings and vault, as every other hook is (SDK 2): a module
217
+ // that is one file has no other way to read them.
218
+ routes: (spec.routes ?? []).map((route) => ({ ...route, method: route.method.toUpperCase(), handler: typeof route.handler === 'function' ? (ctx, request) => route.handler(mine(ctx ?? {}, settingsFrom(ctx?.config, ctx?.roomId)), request) : route.handler })),
187
219
  onEvent: spec.onEvent ?? null,
188
220
  conditions: spec.conditions ?? [],
189
221
  // Slash commands the human types in the composer; they run on the server with the module's
@@ -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
  // Is there a newer version of what a module is? Two kinds of answer, because there are two kinds
4
4
  // of module.
5
5
  //
package/src/mother.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
  // MU/TH/UR's private channel. When someone strikes at her memory core, MOTHER
4
4
  // tells her children (the agents) in a code the console cannot read; the room
5
5
  // shows the code, the agents get the words. The channel lives in
@@ -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
  // What `npx` leaves in MADRE's environment about the call that started it, taken away before MADRE
4
4
  // runs anything (2026-10-18).
5
5
  //
package/src/ollama.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
  // Ollama: the local intelligence MADRE leans on when it is there. Embeddings
4
4
  // for recall by meaning and a model to distil memories, both on this machine,
5
5
  // so remembering costs no tokens elsewhere and nothing leaves. Nothing here is
@@ -121,8 +121,10 @@ export function ollamaInvoker({ host = ollamaHost(), model, fetchImpl = globalTh
121
121
  }
122
122
 
123
123
  // Pulls a model, reporting progress lines as Ollama streams them.
124
- export async function pullModel({ host = ollamaHost(), model, fetchImpl = globalThis.fetch, onLine = () => {}, timeoutMs = 30 * 60 * 1000 } = {}) {
125
- const response = await fetchImpl(`${host}/api/pull`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ model, stream: true }), signal: AbortSignal.timeout(timeoutMs) });
124
+ // `signal` stops it halfway (the welcome's «Cancel»): what Ollama already wrote stays in its own
125
+ // folder, and the next pull of the same model goes on from there.
126
+ export async function pullModel({ host = ollamaHost(), model, fetchImpl = globalThis.fetch, onLine = () => {}, timeoutMs = 30 * 60 * 1000, signal = null } = {}) {
127
+ const response = await fetchImpl(`${host}/api/pull`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ model, stream: true }), signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(timeoutMs)]) : AbortSignal.timeout(timeoutMs) });
126
128
  if (!response.ok) throw new Error(`Ollama pull HTTP ${response.status}: ${(await response.text().catch(() => '')).slice(0, 200)}`);
127
129
  const reader = response.body.getReader();
128
130
  const decoder = new TextDecoder();
@@ -1,19 +1,39 @@
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
  // What OpenCode can answer with on this computer (2026-10-19). OpenCode sends each turn to the
4
4
  // provider of its model, and a provider can stop answering on its own: an API key with no credit
5
5
  // left, or one that is no longer valid. A person met it as a red card in English on every turn,
6
6
  // and had to find out alone which model would work and where to change it. MADRE now remembers,
7
- // per person (~/.pulse/opencode.json), the last model that answered and the providers that failed
7
+ // per person (~/.pulse/opencode-health.json), the last model that answered and the providers that failed
8
8
  // and why, so the failure itself can offer the way out: retry on a model that works, or keep it.
9
9
  // A provider's mark goes away the next time a turn on it answers.
10
10
 
11
- import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
11
+ import { mkdir, readFile, rename, unlink, writeFile } from 'node:fs/promises';
12
12
  import { join } from 'node:path';
13
13
  import { diagnose } from '../public/troubleshooting.js';
14
14
 
15
- const file = (stateRoot) => join(stateRoot, 'opencode.json');
16
- const read = async (stateRoot) => { try { return JSON.parse(await readFile(file(stateRoot), 'utf8')) ?? {}; } catch { return {}; } };
15
+ // Not `opencode.json` (QA 1.1.0, ACT-01): OpenCode reads a file by that name in the folder it runs
16
+ // in and every folder above it as its own configuration. Home runs in ~/.pulse/salas, so OpenCode
17
+ // found MADRE's notes, refused them («Unrecognized key: problems») and would not start: the
18
+ // Coordinator failed every turn and Home called a free-model OpenCode signed out.
19
+ const file = (stateRoot) => join(stateRoot, 'opencode-health.json');
20
+ const LEGACY = (stateRoot) => join(stateRoot, 'opencode.json');
21
+ const OURS = new Set(['problems', 'worked']);
22
+ // What 1.0.5 to 1.1.0 wrote under the old name moves to the new one, and the old file goes, but only
23
+ // when it is MADRE's (nothing in it but its two keys): an opencode.json someone put there is theirs.
24
+ async function migrate(stateRoot) {
25
+ let old;
26
+ try { old = JSON.parse(await readFile(LEGACY(stateRoot), 'utf8')); } catch { return null; }
27
+ if (!old || typeof old !== 'object' || Array.isArray(old) || !Object.keys(old).every((key) => OURS.has(key))) return null;
28
+ try { await readFile(file(stateRoot), 'utf8'); } catch { await keep(stateRoot, old); }
29
+ await unlink(LEGACY(stateRoot)).catch(() => {});
30
+ return old;
31
+ }
32
+ export const migrateOpenCodeHealth = migrate;
33
+ const read = async (stateRoot) => {
34
+ try { return JSON.parse(await readFile(file(stateRoot), 'utf8')) ?? {}; } catch { /* first time, or still under the old name */ }
35
+ return (await migrate(stateRoot)) ?? {};
36
+ };
17
37
  async function keep(stateRoot, data) {
18
38
  await mkdir(stateRoot, { recursive: true });
19
39
  const temp = `${file(stateRoot)}.${process.pid}.${Date.now()}.tmp`;
package/src/outbound.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
  // What left this machine.
4
4
  //
5
5
  // MADRE runs on your computer and keeps everything it knows in a file you own, and that sentence
@@ -96,6 +96,14 @@ export const DESTINATIONS = [
96
96
  where: 'Always on: it is how the author knows how many people use MADRE',
97
97
  inside: true,
98
98
  },
99
+ {
100
+ // Anonymous diagnostics (src/telemetry.mjs, 2026-10-28): on unless turned off.
101
+ id: 'diagnostics', host: 'madre.run', match: (url) => url.pathname === '/api/telemetry', to: 'madre.run · anonymous diagnostics',
102
+ what: 'Errors with private details removed (no paths, names, keys or emails) and counts of turns, modes and features, with this copy\'s random identifier, version and system. Never what you write, your projects or your files.',
103
+ when: 'once a day, and soon after an error never seen before',
104
+ where: 'Settings › Version and reports › Send anonymous diagnostics · or PULSE_TELEMETRY=0',
105
+ inside: true,
106
+ },
99
107
  {
100
108
  // The Market (src/market-remote.mjs): a signed catalog, and the file of a module you get from it.
101
109
  id: 'market', host: 'madre.run', match: (url) => url.pathname.startsWith('/mercado/'), to: "madre.run · the Market",
package/src/override.mjs CHANGED
@@ -1,28 +1,35 @@
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 { createHash, timingSafeEqual } from 'node:crypto';
4
4
 
5
5
  // How #3 CONTROL and #4 AIRLOCK are unlocked, as the person chose it in AJUSTES › Permissions.
6
6
  //
7
7
  // The key is checked here, by the project, since 2026-10-12 (SRV-01 of the 1.0 review): before,
8
8
  // only the browser checked it, and two POSTs from any process on the Mac opened #4 with no key.
9
- // The page asks for the key and sends what was typed; `keyHolds` decides. Four rules never move,
10
- // whatever the file says:
11
- // · #4 always asks for something — there is no «just confirm» for a mode that runs commands;
9
+ // The page asks for the key and sends what was typed; `keyHolds` decides.
10
+ //
11
+ // Since 2026-10-28 (the person's decision) nothing has to be typed to unlock: #3 is one
12
+ // confirmation and #4 two, or the person's own phrase (once for #3, twice for #4) for whoever wants
13
+ // a key a program cannot know. The project's name, typed, is gone as a key: any process can read a
14
+ // folder's name, so it stopped a slip, not a program, and the confirmation stops the slip as well.
15
+ // The rules that never move, whatever the file says:
16
+ // · #4 is never opened by one press: two confirmations, or the phrase twice;
12
17
  // · a personal phrase is never stored, only its salted SHA-256; the phrase typed to unlock is
13
18
  // compared here and forgotten, and the fingerprint never leaves the project (`publicOverride`);
14
- // · the grace is short: #3 up to 30 minutes, #4 up to 5, and off unless chosen;
15
- // · the project name stops a slip, not a program: any process can read a folder's name. The
16
- // phrase is the key a program on the Mac cannot know.
19
+ // · the grace has a limit: #3 up to 8 hours, #4 up to 1, and off unless chosen.
17
20
  export const OVERRIDE_KEYS = Object.freeze({
18
- 3: Object.freeze(['designation', 'phrase', 'confirm']),
19
- 4: Object.freeze(['designation-airlock', 'phrase-airlock', 'designation']),
21
+ 3: Object.freeze(['confirm', 'phrase']),
22
+ 4: Object.freeze(['confirm-airlock', 'phrase-airlock']),
20
23
  });
24
+ // What the page sends for each press of a confirmation.
25
+ export const CONFIRMED = 'confirm';
26
+ // How long a confirmed mode stays open (2026-10-28, more room, as Claude's and Codex's auto modes
27
+ // give): #3 up to a working day, #4 up to an hour, and off unless chosen.
21
28
  export const OVERRIDE_GRACE = Object.freeze({
22
- 3: Object.freeze([0, 5, 15, 30]),
23
- 4: Object.freeze([0, 5]),
29
+ 3: Object.freeze([0, 5, 15, 30, 60, 240, 480]),
30
+ 4: Object.freeze([0, 5, 15, 30, 60]),
24
31
  });
25
- const DEFAULT_KEYS = { 3: 'designation', 4: 'designation-airlock' };
32
+ const DEFAULT_KEYS = { 3: 'confirm', 4: 'confirm-airlock' };
26
33
 
27
34
  const HEX = (length) => new RegExp(`^[0-9a-f]{${length}}$`);
28
35
  function cleanPhrase(phrase) {
@@ -76,20 +83,18 @@ export function phraseHash(salt, phrase) {
76
83
  }
77
84
  const same = (a, b) => a.length === b.length && timingSafeEqual(Buffer.from(a), Buffer.from(b));
78
85
 
79
- // Whether what was typed opens this mode with the key chosen for it. `words` holds what was typed,
80
- // once, or twice for a key that #4 asks for twice; `designation` is the project's folder name.
81
- export function keyHolds(stored, { mode, words = [], designation = '' } = {}) {
86
+ // Whether what was sent opens this mode with the key chosen for it. `words` holds one entry per
87
+ // press or phrase: «confirm» for a confirmation, the phrase as typed for a phrase; #4 sends two.
88
+ export function keyHolds(stored, { mode, words = [] } = {}) {
82
89
  if (mode !== 3 && mode !== 4) return false;
83
90
  const settings = overrideSettings(stored);
84
91
  const typed = (Array.isArray(words) ? words : []).map((word) => (typeof word === 'string' ? word.trim() : ''));
85
- const isProject = (word) => Boolean(word) && Boolean(designation) && word.toLowerCase() === String(designation).toLowerCase();
86
92
  const isPhrase = (word) => Boolean(word) && Boolean(settings.phrase) && same(phraseHash(settings.phrase.salt, word), settings.phrase.hash);
87
93
  switch (settings.keys[mode]) {
88
- case 'confirm': return mode === 3;
89
- case 'designation': return isProject(typed[0]);
90
- case 'phrase': return isPhrase(typed[0]);
91
- case 'designation-airlock': return isProject(typed[0]) && isProject(typed[1]);
92
- case 'phrase-airlock': return isPhrase(typed[0]) && isPhrase(typed[1]);
94
+ case 'confirm': return mode === 3 && typed[0] === CONFIRMED;
95
+ case 'phrase': return mode === 3 && isPhrase(typed[0]);
96
+ case 'confirm-airlock': return mode === 4 && typed[0] === CONFIRMED && typed[1] === CONFIRMED;
97
+ case 'phrase-airlock': return mode === 4 && isPhrase(typed[0]) && isPhrase(typed[1]);
93
98
  default: return false;
94
99
  }
95
100
  }
package/src/ports.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
  // What is listening on this computer, so RIPLEY can look at it.
4
4
  //
5
5
  // A room that renders a project's files but cannot open the project's own dev server is half a
package/src/prices.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
  // What a turn would cost at the provider's API list price, for the CLIs that do not say it
4
4
  // themselves. Claude Code reports its own figure (`total_cost_usd`); Codex and Gemini report only
5
5
  // tokens, and OpenCode reports 0 when the model runs on a subscription. So the room prices those
package/src/privacy.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
  // Privacy: terms that must never travel through a room. ERROR-001 in a real room
4
4
  // showed the channel: an agent's own configuration (organisation instructions,
5
5
  // the account it runs under) leaks into its reply, the reply enters the shared
@@ -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
  export class QuotaMonitor {
4
4
  #sources;
5
5
  #onReport;
@@ -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 { execFile } from 'node:child_process';
4
4
  import { readdir, readFile, stat } from 'node:fs/promises';
5
5
  import { homedir } from 'node:os';
@@ -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 room listens on 127.0.0.1, which keeps other computers out but not other web pages: any
4
4
  // site open in this browser can send a request to 127.0.0.1:4317, and an uploaded module is code
5
5
  // MADRE runs with your permissions. Two checks, before any route, close that door.
@@ -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
  // Asking for a star or a review (2026-10-10): three times at most, and never again once answered.
4
4
  //
5
5
  // After twenty minutes of MADRE in use, and on the second and the seventh day after it was first
@@ -25,7 +25,8 @@ export const ASK_MOMENTS = [
25
25
  { id: 'd2', reached: (state, now) => now - Date.parse(state.first) >= 2 * DAY },
26
26
  { id: 'd7', reached: (state, now) => now - Date.parse(state.first) >= 7 * DAY },
27
27
  ];
28
- export const ASK_ANSWERS = ['later', 'star', 'review', 'never'];
28
+ // A donation on GitHub Sponsors is an answer too (2026-10-30): whoever gave is not asked again.
29
+ export const ASK_ANSWERS = ['later', 'star', 'review', 'donate', 'never'];
29
30
  // One minute of use is counted at most once a minute, whichever page says it.
30
31
  const TICK_MS = 55 * 1000;
31
32
  // Never asked twice within this long, whatever moments have come.
@@ -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 archivist: every so often the cheapest allowed agent reads what nobody
4
4
  // has distilled and keeps the few notes worth remembering. Scheduling by count
5
5
  // or by quiet, one batch per run, a bench for whoever fails, a report to the
@@ -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
  // Human uploads, stored under the room (never in the project). Registered
4
4
  // here so a message can reference them by id; the ledger lets a restarted
5
5
  // room rebuild the registry.
@@ -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 local token budget: a rolling window per agent (five hours, like the
4
4
  // providers' short windows), raw totals for the record, and the seeding of the
5
5
  // usage sentinel from the ledger on start.
@@ -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.