@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
  // RIPLEY: the file viewer renders HTML, SVG and Markdown inside a sealed frame.
4
4
  // A switch in config.json, read live by the preview route.
5
5
 
@@ -9,7 +9,7 @@ import { t } from '../i18n.mjs';
9
9
  export default defineModule({
10
10
  id: 'ripley',
11
11
  name: 'Preview',
12
- vendor: 'MADRE · PREVIEW',
12
+ vendor: 'MADRE · Preview',
13
13
  version: '1.0.0',
14
14
  summary: 'Renders HTML, SVG and Markdown from the project in the file viewer, inside a sealed frame, and opens a browser on the servers answering on this computer.',
15
15
  creates: ['nothing in the project', 'a switch in ~/.pulse/config.json', 'scripts run in the frame \u00b7 nothing leaves, nothing is stored, nothing reaches MADRE'],
@@ -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
  // Runs: letting an agent ask the human to run a command instead of asking them to copy it.
4
4
  //
5
5
  // Below #4 AIRLOCK an agent cannot run anything, and some answers turn on a command anyway: 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
  // 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
@@ -20,6 +20,7 @@
20
20
  import { readFile, stat } from 'node:fs/promises';
21
21
  import { forgetSecret, readSecret, summary as vaultSummary, writeSecret } from '../vault.mjs';
22
22
  import { moduleOnIn, roomsOf, scopeIn, settingsIn, switchIn } from '../module-scope.mjs';
23
+ import { isBilingual } from '../i18n.mjs';
23
24
 
24
25
  const camel = (id) => id.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
25
26
 
@@ -68,7 +69,20 @@ export function dependencies(runs) {
68
69
  return list.filter((dep) => dep && dep.name).map((dep) => ({ name: String(dep.name), version: dep.version ?? null, target: dep.target ?? null }));
69
70
  }
70
71
 
71
- // 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
72
86
  // generous until you misspell one: `sumary` used to install without a word and leave a card with
73
87
  // an empty summary. A key MADRE does not know is not fatal — a module written for a newer MADRE
74
88
  // may carry fields this one has not learned yet — so it is said out loud instead of refused.
@@ -77,7 +91,7 @@ export const MODULE_FIELDS = new Set([
77
91
  'requires', 'models', 'commands', 'card', 'configKey', 'settings', 'controls', 'routes', 'reaches',
78
92
  'conditions', 'slash', 'status', 'preflight', 'detect', 'confirm', 'installCommand', 'secrets',
79
93
  'updatePlan', 'toolsForTurn', 'toggle', 'onToggle', 'onSettings', 'onEvent', 'toggledEvent',
80
- 'toggledBody', 'describe', 'ready', 'footer',
94
+ 'toggledBody', 'describe', 'ready', 'footer', 'credit', 'sdk', 'icon',
81
95
  ]);
82
96
  export const unknownFields = (spec) => Object.keys(spec ?? {}).filter((key) => !MODULE_FIELDS.has(key));
83
97
 
@@ -102,14 +116,34 @@ function footerKeys(spec) {
102
116
  });
103
117
  }
104
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
+
105
131
  export function defineModule(spec) {
106
132
  if (!spec?.id || !/^[a-z][a-z0-9-]*$/.test(spec.id)) throw new Error(`Module id must be kebab-case: ${spec?.id}`);
107
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.`);
108
137
  const kind = spec.kind ?? 'builtin';
109
138
  const configKey = spec.configKey ?? camel(spec.id);
139
+ // Its name and what it does may come in both languages, { es, en } (2026-10-20): MADRE keeps one
140
+ // word for its own records (English, else Spanish) and shows the room's (describe, /api/commands).
141
+ const oneWord = (value) => (isBilingual(value) ? value.en ?? value.es : value);
142
+ const nameText = oneWord(spec.name);
110
143
  const defaults = { ...(kind === 'builtin' ? { enabled: false } : {}), ...(spec.settings ?? {}) };
111
144
  const base = {
112
- id: spec.id, kind, name: spec.name, 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,
146
+ words: { name: isBilingual(spec.name) ? spec.name : null, summary: isBilingual(spec.summary) ? spec.summary : null },
113
147
  // Keys this contract does not answer to. Carried so whoever installs the module is told.
114
148
  unknown: unknownFields(spec),
115
149
  // What this module's version follows, when it is not its own: { name, npm } or { name, github }.
@@ -121,7 +155,11 @@ export function defineModule(spec) {
121
155
  updates: spec.updates?.url && /^https:\/\//.test(String(spec.updates.url)) ? { url: String(spec.updates.url) } : null,
122
156
  // Keys beside MADRE's version, drawn by MADRE while the module is on (footerKeys).
123
157
  footer: footerKeys(spec),
124
- summary: 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),
158
+ // Its own icon, kept to its size (moduleIconOf).
159
+ icon: moduleIconOf(spec),
160
+ // Whose idea it was (2026-10-20, Reminders): said on its card and in the Market.
161
+ credit: typeof spec.credit === 'string' && spec.credit.trim() ? spec.credit.trim().slice(0, 80) : null,
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),
125
163
  card: spec.card ?? (kind === 'builtin' ? 'switch' : 'installer'),
126
164
  // The settings floor of the card, declared instead of drawn: MADRE renders these and saves
127
165
  // them into the module's own block of ~/.pulse/config.json.
@@ -136,7 +174,12 @@ export function defineModule(spec) {
136
174
  const options = control.options ?? choices?.map((choice) => choice.value) ?? [];
137
175
  if (type === 'select' && !options.length) throw new Error(`Module ${spec.id}: control ${control.key} is a select with no options.`);
138
176
  if (choices && choices.some((choice) => !options.includes(choice.value))) throw new Error(`Module ${spec.id}: control ${control.key} has a choice that is not one of its options.`);
139
- return { key: control.key, label: control.label ?? control.key.toUpperCase(), type, options, ...(choices ? { choices } : {}), note: control.note ?? '', invert: Boolean(control.invert) };
177
+ // What a switch says the moment it is turned on or off (`said: { on, off }`), for a change
178
+ // nothing shows at once: the person is told what will happen and when (2026-10-20).
179
+ const said = type === 'switch' && control.said && typeof control.said === 'object'
180
+ ? Object.fromEntries(['on', 'off'].filter((side) => typeof control.said[side] === 'string' && control.said[side].trim()).map((side) => [side, control.said[side]]))
181
+ : null;
182
+ return { key: control.key, label: control.label ?? control.key.toUpperCase(), type, options, ...(choices ? { choices } : {}), note: control.note ?? '', invert: Boolean(control.invert), ...(said && Object.keys(said).length ? { said } : {}) };
140
183
  }),
141
184
  // Where this module's traffic goes, in the same four answers `src/outbound.mjs` demands of
142
185
  // MADRE's own destinations. Without it a connector's traffic reads in the log as «an address
@@ -147,7 +190,7 @@ export function defineModule(spec) {
147
190
  for (const answer of ['to', 'what', 'when']) {
148
191
  if (!reach[answer]) throw new Error(`Module ${spec.id}: destination ${reach.host} does not say ${answer}.`);
149
192
  }
150
- return { id: reach.id ?? reach.host, host: reach.host, to: reach.to, what: reach.what, when: reach.when, where: reach.where ?? `MODULES → ${spec.name}`, ...(typeof reach.match === 'function' ? { match: reach.match } : {}) };
193
+ return { id: reach.id ?? reach.host, host: reach.host, to: reach.to, what: reach.what, when: reach.when, where: reach.where ?? `MODULES → ${nameText}`, ...(typeof reach.match === 'function' ? { match: reach.match } : {}) };
151
194
  }),
152
195
  // Secrets this module needs to do its job: declared, not drawn. MADRE renders a paste field
153
196
  // per entry and keeps the value in its vault under this module's name. The card only ever
@@ -170,7 +213,9 @@ export function defineModule(spec) {
170
213
  configKey,
171
214
  defaults,
172
215
  settingsFrom,
173
- 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 })),
174
219
  onEvent: spec.onEvent ?? null,
175
220
  conditions: spec.conditions ?? [],
176
221
  // Slash commands the human types in the composer; they run on the server with the module's
@@ -205,6 +250,9 @@ export function defineModule(spec) {
205
250
  const stamp = await versionOf(this, { declared: spec.version ?? null, tracked });
206
251
  return {
207
252
  ...base,
253
+ // The room's words when the module wrote both (translate() picks them on the way out).
254
+ ...(base.words.name ? { name: base.words.name } : {}),
255
+ ...(base.words.summary ? { summary: base.words.summary } : {}),
208
256
  ...(this.external ? { external: true, origin: this.origin, file: this.file } : {}),
209
257
  ...own,
210
258
  version: stamp.version,
@@ -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
@@ -10,7 +10,7 @@
10
10
 
11
11
  import { createCipheriv, createDecipheriv, createHash, randomBytes } from 'node:crypto';
12
12
  import { mkdir, readFile, writeFile } from 'node:fs/promises';
13
- import { dirname } from 'node:path';
13
+ import { dirname, join } from 'node:path';
14
14
 
15
15
  export const CODE000_LOCK_MS = 10 * 60 * 1000;
16
16
  export const CODE000_STRIKES = 8;
@@ -96,6 +96,8 @@ export class MotherChannel {
96
96
  return { n: Number(key.slice('MOTHER_ALERT_'.length)), at, kind, code: code.join('|') };
97
97
  }).sort((a, b) => a.n - b.n);
98
98
  if (!known) this.#meta?.set('mother_seal', fingerprint(this.#seal));
99
+ // A seal born on an older MADRE had no line keeping it out of git: it gets one on opening.
100
+ await this.#ignoredByGit();
99
101
  } else if (known) {
100
102
  // She existed and now her seal is gone or wrong.
101
103
  outcome = env ? 'altered' : 'deleted';
@@ -119,8 +121,16 @@ export class MotherChannel {
119
121
  this.#meta?.set('mother_seal', fingerprint(this.#seal));
120
122
  }
121
123
 
124
+ // The seal lives in the person's repository: `.pulse/` ignores itself, so a `git add .` never
125
+ // carries it (nor the turns' drafts beside it) to a commit or a public remote (2026-10-19).
126
+ // Written once and never over one the person changed.
127
+ async #ignoredByGit() {
128
+ await writeFile(join(dirname(this.#file), '.gitignore'), '*\n', { flag: 'wx' }).catch(() => {});
129
+ }
130
+
122
131
  async save() {
123
132
  await mkdir(dirname(this.#file), { recursive: true });
133
+ await this.#ignoredByGit();
124
134
  const lines = [
125
135
  '# MU/TH/UR 6000 · PRIVATE CHANNEL TO THE CREW · DO NOT EDIT, DO NOT DELETE',
126
136
  '# Deleting this file silences MOTHER\'s past messages and she will know.',
@@ -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
@@ -96,12 +96,12 @@ export function ollamaEmbedder({ host = ollamaHost(), model, fetchImpl = globalT
96
96
  }
97
97
 
98
98
  // One answer from a local model. `json: true` asks Ollama for a JSON object.
99
- export async function ollamaGenerate({ host = ollamaHost(), model, prompt, system = null, json = false, fetchImpl = globalThis.fetch, timeoutMs = 180000, temperature = 0.2, numCtx = DEFAULT_NUM_CTX } = {}) {
99
+ export async function ollamaGenerate({ host = ollamaHost(), model, prompt, system = null, json = false, fetchImpl = globalThis.fetch, timeoutMs = 180000, temperature = 0.2, numCtx = DEFAULT_NUM_CTX, signal = null } = {}) {
100
100
  const started = Date.now();
101
101
  const messages = [...(system ? [{ role: 'system', content: system }] : []), { role: 'user', content: prompt }];
102
102
  // A model that takes longer than the turn allows says so in the room's words, as any agent does:
103
103
  // the bare «The operation was aborted due to timeout» reached the person, in English.
104
- const response = await fetchImpl(`${host}/api/chat`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ model, messages, stream: false, options: { temperature, num_ctx: numCtx }, ...(json ? { format: 'json' } : {}) }), signal: AbortSignal.timeout(timeoutMs) })
104
+ const response = await fetchImpl(`${host}/api/chat`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ model, messages, stream: false, options: { temperature, num_ctx: numCtx }, ...(json ? { format: 'json' } : {}) }), signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(timeoutMs)]) : AbortSignal.timeout(timeoutMs) })
105
105
  .catch((error) => { throw error?.name === 'TimeoutError' ? new Error(t('{label} did not respond before the timeout ({seconds}s).', { label: `Ollama (${model})`, seconds: Math.round(timeoutMs / 1000) })) : error; });
106
106
  if (!response.ok) throw new Error(`Ollama HTTP ${response.status}: ${(await response.text().catch(() => '')).slice(0, 200)}`);
107
107
  const payload = await response.json();
@@ -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();
@@ -0,0 +1,83 @@
1
+ // SPDX-License-Identifier: BUSL-1.1
2
+ // MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
3
+ // What OpenCode can answer with on this computer (2026-10-19). OpenCode sends each turn to the
4
+ // provider of its model, and a provider can stop answering on its own: an API key with no credit
5
+ // left, or one that is no longer valid. A person met it as a red card in English on every turn,
6
+ // and had to find out alone which model would work and where to change it. MADRE now remembers,
7
+ // per person (~/.pulse/opencode-health.json), the last model that answered and the providers that failed
8
+ // and why, so the failure itself can offer the way out: retry on a model that works, or keep it.
9
+ // A provider's mark goes away the next time a turn on it answers.
10
+
11
+ import { mkdir, readFile, rename, unlink, writeFile } from 'node:fs/promises';
12
+ import { join } from 'node:path';
13
+ import { diagnose } from '../public/troubleshooting.js';
14
+
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
+ };
37
+ async function keep(stateRoot, data) {
38
+ await mkdir(stateRoot, { recursive: true });
39
+ const temp = `${file(stateRoot)}.${process.pid}.${Date.now()}.tmp`;
40
+ await writeFile(temp, JSON.stringify(data, null, 2));
41
+ await rename(temp, file(stateRoot));
42
+ }
43
+
44
+ const OPENCODE_PICK = 'opencode/big-pickle';
45
+ export const providerOf = (model) => (typeof model === 'string' && model.includes('/') ? model.split('/')[0] : null);
46
+
47
+ // Which of MADRE's known conditions this failure is, said as what the provider needs.
48
+ const KINDS = { 'provider-credit-exhausted': 'no-credit', 'opencode-default-provider': 'bad-key' };
49
+ export function problemOf(error) {
50
+ for (const condition of diagnose(error, 'opencode')) if (KINDS[condition.id]) return KINDS[condition.id];
51
+ return null;
52
+ }
53
+
54
+ // One turn of OpenCode that ended: what answered is remembered, what failed for its provider too.
55
+ export async function noteOpenCodeTurn(stateRoot, { ok, model = null, error = null, now = new Date() }) {
56
+ const provider = providerOf(model);
57
+ const data = await read(stateRoot);
58
+ data.problems ??= {};
59
+ if (ok) {
60
+ if (model) data.worked = { model, at: now.toISOString() };
61
+ if (provider && data.problems[provider]) delete data.problems[provider];
62
+ } else {
63
+ const kind = problemOf(error);
64
+ if (!kind || !provider) return data;
65
+ data.problems[provider] = { kind, model, at: now.toISOString() };
66
+ }
67
+ await keep(stateRoot, data);
68
+ return data;
69
+ }
70
+
71
+ export const openCodeHealth = async (stateRoot) => { const data = await read(stateRoot); return { worked: data.worked ?? null, problems: data.problems ?? {} }; };
72
+
73
+ // The model to offer instead of one that failed: the last one that answered, if its provider is
74
+ // not the one in trouble; otherwise one of OpenCode's own free models, which need no account.
75
+ export function suggestOpenCodeModel(health, { failed = null, own = [] } = {}) {
76
+ const bad = new Set([providerOf(failed), ...Object.keys(health?.problems ?? {})].filter(Boolean));
77
+ const worked = health?.worked?.model;
78
+ if (worked && worked !== failed && !bad.has(providerOf(worked))) return { model: worked, why: 'worked' };
79
+ // OpenCode's own pick when it is told no model (`opencode run` answers on big-pickle) goes first;
80
+ // the rest in the order the CLI lists them.
81
+ const free = [...own].sort((a, b) => Number(b === OPENCODE_PICK) - Number(a === OPENCODE_PICK)).find((model) => !bad.has(providerOf(model)));
82
+ return free ? { model: free, why: 'free' } : null;
83
+ }
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
@@ -56,6 +56,15 @@ export const DESTINATIONS = [
56
56
  where: 'Settings › Memory › Smart search · Ollama keeps it on this computer, off drops back to words',
57
57
  inside: true,
58
58
  },
59
+ {
60
+ // The models a Gemini key opens, for the chooser under the box (models.mjs, 2026-10-21). The key
61
+ // travels in a header, never in the address.
62
+ id: 'gemini-models', host: 'generativelanguage.googleapis.com', match: (url) => /\/models\/?$/.test(url.pathname), to: 'Google · the models of your Gemini key',
63
+ what: 'Your Gemini API key, so Google says which of its models the key opens. Nothing about you or your project.',
64
+ when: 'when the model chooser of Gemini opens, at most once every ten minutes',
65
+ where: 'Settings › Agents › Gemini · without a key it is never asked',
66
+ inside: true,
67
+ },
59
68
  {
60
69
  id: 'image', host: 'generativelanguage.googleapis.com', match: (url) => /generateContent/.test(url.pathname), to: 'Google · Gemini image model',
61
70
  what: 'The prompt an agent wrote for an image.',
@@ -87,6 +96,14 @@ export const DESTINATIONS = [
87
96
  where: 'Always on: it is how the author knows how many people use MADRE',
88
97
  inside: true,
89
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
+ },
90
107
  {
91
108
  // The Market (src/market-remote.mjs): a signed catalog, and the file of a module you get from it.
92
109
  id: 'market', host: 'madre.run', match: (url) => url.pathname.startsWith('/mercado/'), to: "madre.run · the Market",
@@ -95,6 +112,14 @@ export const DESTINATIONS = [
95
112
  where: 'Settings › Version and reports › Look for new versions · or PULSE_MARKET=0',
96
113
  inside: true,
97
114
  },
115
+ {
116
+ // A paid module's license (src/market-license.mjs): asked when the person activates or releases it.
117
+ id: 'license', host: 'api.lemonsqueezy.com', match: (url) => url.pathname.startsWith('/v1/licenses/'), to: 'Lemon Squeezy · licenses of paid modules',
118
+ what: 'The license key you pasted and a name for this computer made from MADRE\'s random install id. Not your name, not your email, nothing from your projects.',
119
+ when: 'only when you press Activate or Release on a paid module of the Market',
120
+ where: 'Market › the paid module\'s page',
121
+ inside: true,
122
+ },
98
123
  {
99
124
  id: 'usage', host: 'madre.run', match: (url) => url.pathname === '/api/usage', to: "madre.run · the author's usage figures",
100
125
  what: "The author's token, to read how many copies are on. Only in the author's own copy, run from source.",
@@ -120,7 +145,7 @@ export const DESTINATIONS = [
120
145
  id: 'ollama', host: null, local: true, to: 'Ollama, on this computer',
121
146
  what: 'Memories to embed, exchanges to distil, and whatever you ask @madre. It goes to a port on this machine and stops there.',
122
147
  when: 'while Ollama is running',
123
- where: 'Modules › Local AI',
148
+ where: 'Settings › Local AI',
124
149
  inside: true,
125
150
  },
126
151
  ];
@@ -325,6 +350,13 @@ export class OutboundLog {
325
350
  }
326
351
 
327
352
  async drain() { await this.#writes; }
353
+ // The room that keeps this log closed: what is written down from here on stays in memory. A
354
+ // request still out when the room closed was written after it, and made its folder again while
355
+ // that folder was being removed (2026-10-21).
356
+ async close() {
357
+ this.#file = null;
358
+ await this.#writes;
359
+ }
328
360
  }
329
361
 
330
362
  // The declaration with today's answer filled in: is this one on, and what has it done.
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.