@jossuealcala/madre 1.0.4 → 1.0.5

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 (104) hide show
  1. package/CHANGELOG.en.md +106 -1
  2. package/CHANGELOG.md +106 -1
  3. package/NOTICE +30 -0
  4. package/README.en.md +59 -156
  5. package/README.md +60 -161
  6. package/TRADEMARKS.md +18 -0
  7. package/bin/madre.mjs +2 -2
  8. package/docs/REFERENCE.md +1 -1
  9. package/docs/SDK.md +25 -4
  10. package/docs/en/REFERENCE.md +1 -1
  11. package/docs/en/SDK.md +22 -2
  12. package/docs/madre-banner.png +0 -0
  13. package/package.json +1 -1
  14. package/public/app.js +1078 -239
  15. package/public/assets/manual/madre-manual-en.pdf +0 -0
  16. package/public/assets/manual/madre-manual-es.pdf +0 -0
  17. package/public/assets/manual/shots/en-agents.webp +0 -0
  18. package/public/assets/manual/shots/en-code.webp +0 -0
  19. package/public/assets/manual/shots/en-composer.webp +0 -0
  20. package/public/assets/manual/shots/en-connectors.webp +0 -0
  21. package/public/assets/manual/shots/en-continuity.webp +0 -0
  22. package/public/assets/manual/shots/en-coordinator.webp +0 -0
  23. package/public/assets/manual/shots/en-copilot.webp +0 -0
  24. package/public/assets/manual/shots/en-diagnostics.webp +0 -0
  25. package/public/assets/manual/shots/en-home.webp +0 -0
  26. package/public/assets/manual/shots/en-local.webp +0 -0
  27. package/public/assets/manual/shots/en-memory.webp +0 -0
  28. package/public/assets/manual/shots/en-modes.webp +0 -0
  29. package/public/assets/manual/shots/en-modules.webp +0 -0
  30. package/public/assets/manual/shots/en-notes.webp +0 -0
  31. package/public/assets/manual/shots/en-settings.webp +0 -0
  32. package/public/assets/manual/shots/en-windows.webp +0 -0
  33. package/public/assets/manual/shots/es-agents.webp +0 -0
  34. package/public/assets/manual/shots/es-code.webp +0 -0
  35. package/public/assets/manual/shots/es-composer.webp +0 -0
  36. package/public/assets/manual/shots/es-connectors.webp +0 -0
  37. package/public/assets/manual/shots/es-continuity.webp +0 -0
  38. package/public/assets/manual/shots/es-coordinator.webp +0 -0
  39. package/public/assets/manual/shots/es-copilot.webp +0 -0
  40. package/public/assets/manual/shots/es-diagnostics.webp +0 -0
  41. package/public/assets/manual/shots/es-home.webp +0 -0
  42. package/public/assets/manual/shots/es-local.webp +0 -0
  43. package/public/assets/manual/shots/es-memory.webp +0 -0
  44. package/public/assets/manual/shots/es-modes.webp +0 -0
  45. package/public/assets/manual/shots/es-modules.webp +0 -0
  46. package/public/assets/manual/shots/es-notes.webp +0 -0
  47. package/public/assets/manual/shots/es-settings.webp +0 -0
  48. package/public/assets/manual/shots/es-windows.webp +0 -0
  49. package/public/en.js +74 -0
  50. package/public/es.js +493 -136
  51. package/public/i18n.js +45 -7
  52. package/public/index.html +2 -3
  53. package/public/manual-content.js +657 -0
  54. package/public/manual-shots.js +43 -0
  55. package/public/manual.css +228 -0
  56. package/public/manual.html +15 -0
  57. package/public/manual.js +398 -0
  58. package/public/market-art.js +56 -0
  59. package/public/market-view.js +140 -22
  60. package/public/market.js +25 -14
  61. package/public/mcp-catalog.js +62 -0
  62. package/public/resay.js +1 -0
  63. package/public/salas-mac.css +178 -30
  64. package/public/salas-mac.html +5 -5
  65. package/public/salas-mac.js +432 -67
  66. package/public/styles.css +300 -42
  67. package/public/tour-chapters.js +98 -90
  68. package/public/tour.js +63 -21
  69. package/public/troubleshooting.js +145 -10
  70. package/src/adapters/cursor.mjs +56 -7
  71. package/src/adapters/gemini.mjs +12 -1
  72. package/src/adapters/madre.mjs +27 -6
  73. package/src/adapters/process.mjs +5 -2
  74. package/src/auth-probe.mjs +22 -3
  75. package/src/bridge/policy.mjs +1 -1
  76. package/src/bridge/server.mjs +1 -1
  77. package/src/capabilities.mjs +3 -3
  78. package/src/credentials.mjs +24 -2
  79. package/src/history.mjs +76 -0
  80. package/src/i18n.mjs +23 -1
  81. package/src/local-ai.mjs +10 -2
  82. package/src/looks.mjs +17 -5
  83. package/src/market-license.mjs +104 -0
  84. package/src/market-remote.mjs +17 -1
  85. package/src/mcp/notes-server.mjs +120 -0
  86. package/src/mcp/proxy.mjs +14 -3
  87. package/src/models.mjs +82 -9
  88. package/src/modules/index.mjs +3 -1
  89. package/src/modules/local-models.mjs +28 -0
  90. package/src/modules/notes.mjs +142 -0
  91. package/src/modules/ollama.mjs +39 -10
  92. package/src/modules/playwright.mjs +14 -3
  93. package/src/modules/reminders.mjs +345 -0
  94. package/src/modules/sdk.mjs +21 -5
  95. package/src/mother.mjs +11 -1
  96. package/src/ollama.mjs +2 -2
  97. package/src/opencode-health.mjs +63 -0
  98. package/src/outbound.mjs +25 -1
  99. package/src/reminder-time.mjs +127 -0
  100. package/src/room.mjs +19 -7
  101. package/src/runtime-detection.mjs +6 -2
  102. package/src/sentinel-errors.mjs +4 -3
  103. package/src/server.mjs +302 -70
  104. package/src/tour.mjs +24 -5
@@ -0,0 +1,345 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // MADRE · © 2026 Jossue Alcalá · GNU AGPL v3 with additional terms (Section 7): ADDITIONAL-TERMS.md
3
+ // Reminders (0.1, 2026-10-20). An idea by Daniel Castillo.
4
+ //
5
+ // What a person says they still have to do gets lost in a conversation: «mañana reviso el PR»,
6
+ // «recuérdame llamar a Daniel el lunes», the same request made every morning. This hears the
7
+ // person's own messages and, when one holds something pending or something they keep doing, puts
8
+ // a card under it — «¿Te lo recuerdo?» with the time already chosen — so a reminder takes one press.
9
+ // Nothing is set without that press.
10
+ //
11
+ // Two ways to notice, the cheap one first:
12
+ // · pending words that mean «later» or «remember» (src/reminder-time.mjs reads the when);
13
+ // · frequent the same request on three different days: offered as a daily reminder.
14
+ // When the project has the local AI, @madre's model reads a candidate before it is offered: it
15
+ // drops what is not a task and writes the task short, in the person's language. Without it the
16
+ // person's own words are offered as they are. No provider's agent is asked: a reminder costs
17
+ // no tokens.
18
+ //
19
+ // Reminders are kept for the whole computer, in ~/.pulse/reminders.json, each with the project and
20
+ // the conversation it came from: when it is due, Home shows it in «Needs you», and the project it
21
+ // came from shows it the moment it opens. A repeating one, marked done, comes back at its next time.
22
+
23
+ import { readFile } from 'node:fs/promises';
24
+ import { basename, join } from 'node:path';
25
+ import { randomUUID } from 'node:crypto';
26
+ import { defineModule } from './sdk.mjs';
27
+ import { oneAtATime, writeWhole } from '../json-file.mjs';
28
+ import { ollamaGenerate } from '../ollama.mjs';
29
+ import { REPEATS, nextOccurrence, parseWhen, tomorrowMorning } from '../reminder-time.mjs';
30
+ import { fileURLToPath } from 'node:url';
31
+ import { language, t } from '../i18n.mjs';
32
+
33
+ const NOTES_SERVER = fileURLToPath(new URL('../mcp/notes-server.mjs', import.meta.url));
34
+ // A message that asks for a reminder (2026-10-20): «/recordatorios …», «/reminders …», «recuérdame».
35
+ export const ASKS_FOR_REMINDER = /(^|\s)\/(recordatorios?|reminders?|remind)\b|recu[eé]rd(ame|anos|ale)|\brecordatorios?\b|\bremind(er|ers)?\b/i;
36
+
37
+ export const REMINDERS_MAX = 500;
38
+ export const REMINDER_TEXT_MAX = 200;
39
+ const ID = /^[a-z0-9-]{6,64}$/i;
40
+ const remindersFile = (stateRoot) => join(stateRoot, 'reminders.json');
41
+ const habitsFile = (roomDir) => join(roomDir, 'reminder-habits.json');
42
+ const iso = (value) => (typeof value === 'string' && !Number.isNaN(Date.parse(value)) ? new Date(value).toISOString() : null);
43
+ const fold = (text) => String(text ?? '').normalize('NFD').replace(/\p{M}/gu, '').toLowerCase();
44
+
45
+ function reminderOf(raw) {
46
+ if (!raw || typeof raw !== 'object' || !ID.test(String(raw.id ?? '')) || !iso(raw.due)) return null;
47
+ const text = String(raw.text ?? '').trim().slice(0, REMINDER_TEXT_MAX);
48
+ if (!text) return null;
49
+ return {
50
+ id: raw.id,
51
+ text,
52
+ due: iso(raw.due),
53
+ repeat: REPEATS.includes(raw.repeat) ? raw.repeat : null,
54
+ room: typeof raw.room === 'string' && raw.room.length <= 200 ? raw.room : null,
55
+ project: typeof raw.project === 'string' ? raw.project.slice(0, 120) : null,
56
+ chat: typeof raw.chat === 'string' && raw.chat.length <= 120 ? raw.chat : null,
57
+ why: ['pending', 'frequent', 'asked', 'manual'].includes(raw.why) ? raw.why : 'manual',
58
+ done: iso(raw.done),
59
+ at: iso(raw.at) ?? new Date(0).toISOString(),
60
+ };
61
+ }
62
+ export async function readReminders(stateRoot) {
63
+ if (!stateRoot) return [];
64
+ const raw = await readFile(remindersFile(stateRoot), 'utf8').then((text) => JSON.parse(text)).catch(() => null);
65
+ return (Array.isArray(raw?.reminders) ? raw.reminders : []).map(reminderOf).filter(Boolean).slice(0, REMINDERS_MAX);
66
+ }
67
+ const writeReminders = (stateRoot, reminders) => writeWhole(remindersFile(stateRoot), `${JSON.stringify({ reminders }, null, 2)}\n`);
68
+ const change = (stateRoot, work) => oneAtATime(remindersFile(stateRoot), async () => {
69
+ const reminders = await readReminders(stateRoot);
70
+ const answer = await work(reminders);
71
+ if (answer?.write !== false) await writeReminders(stateRoot, reminders.filter((one) => !one.drop).map(({ drop, ...one }) => one));
72
+ return answer;
73
+ });
74
+
75
+ export function addReminder(stateRoot, { text, due, repeat = null, room = null, project = null, chat = null, why = 'manual' }, now = new Date()) {
76
+ const made = reminderOf({ id: randomUUID(), text, due, repeat, room, project, chat, why, at: new Date(now).toISOString() });
77
+ if (!made) return Promise.resolve({ error: 'reminder' });
78
+ return change(stateRoot, (reminders) => {
79
+ // Done ones go first when the file is full: they are only history.
80
+ const open = reminders.filter((one) => !one.done);
81
+ if (open.length >= REMINDERS_MAX) return { error: 'full', write: false };
82
+ if (reminders.length >= REMINDERS_MAX) reminders.splice(reminders.findIndex((one) => one.done), 1);
83
+ reminders.push(made);
84
+ return { reminder: made };
85
+ });
86
+ }
87
+ // Done: a repeating one moves to its next time; any other is kept as done.
88
+ export function doneReminder(stateRoot, id, now = new Date()) {
89
+ return change(stateRoot, (reminders) => {
90
+ const one = reminders.find((item) => item.id === id);
91
+ if (!one) return { error: 'unknown', write: false };
92
+ if (one.repeat) one.due = nextOccurrence(one.due, one.repeat, now).toISOString();
93
+ else one.done = new Date(now).toISOString();
94
+ return { reminder: one };
95
+ });
96
+ }
97
+ export function snoozeReminder(stateRoot, id, until) {
98
+ return change(stateRoot, (reminders) => {
99
+ const one = reminders.find((item) => item.id === id);
100
+ if (!one || !iso(until)) return { error: 'unknown', write: false };
101
+ one.due = iso(until);
102
+ one.done = null;
103
+ return { reminder: one };
104
+ });
105
+ }
106
+ export function clearDone(stateRoot, room = null) {
107
+ return change(stateRoot, (reminders) => {
108
+ let cleared = 0;
109
+ for (const one of reminders) if (one.done && (!room || one.room === room)) { one.drop = true; cleared += 1; }
110
+ return { cleared };
111
+ });
112
+ }
113
+ export function deleteReminder(stateRoot, id) {
114
+ return change(stateRoot, (reminders) => {
115
+ const one = reminders.find((item) => item.id === id);
116
+ if (!one) return { error: 'unknown', write: false };
117
+ one.drop = true;
118
+ return { deleted: id };
119
+ });
120
+ }
121
+
122
+ // PENDING: words that mean «later», «remember», «I still have to». Strong ones only: «luego» and
123
+ // «después» are how half the sentences of a conversation begin.
124
+ const PENDING = /\b(recuerd(a|ame|anos|ale)|recordarme|no (me )?(dejes|deje) olvidar|que no se me olvide|no olvides|no olvidar|pendiente|tengo que|tenemos que|manana|pasado manana|el (lunes|martes|miercoles|jueves|viernes|sabado|domingo)|la proxima semana|mas tarde|esta tarde|esta noche|cada (dia|semana|lunes|martes|miercoles|jueves|viernes|manana)|todos los (dias|lunes|martes|miercoles|jueves|viernes)|remind me|don'?t (let me )?forget|to-?do|tomorrow|next week|later today|this afternoon|tonight|every (day|week|morning|monday|tuesday|wednesday|thursday|friday)|follow up|dar seguimiento)\b/;
125
+ // When it is due is the card's to say: «mañana a las 5», «el lunes», «tomorrow at 9am» at the head
126
+ // of the sentence are taken off what the reminder says.
127
+ const LEADING_WHEN = /^(?:(?:pasado\s+)?ma[nñ]ana|hoy|esta\s+(?:tarde|noche)|(?:el|este|el\s+pr[oó]ximo)\s+(?:lunes|martes|mi[eé]rcoles|jueves|viernes|s[aá]bado|domingo)|la\s+pr[oó]xima\s+semana|en\s+\d+\s+(?:minutos?|horas?|d[ií]as?)|tomorrow|today|tonight|next\s+week|(?:on\s+)?(?:monday|tuesday|wednesday|thursday|friday|saturday|sunday)|in\s+\d+\s+(?:minutes?|hours?|days?))?\s*(?:(?:a\s+las?|at)\s+\d{1,2}(?::\d{2})?\s*(?:am|pm|de\s+la\s+(?:ma[nñ]ana|tarde|noche))?)?\s*(?:,\s*)?(?:que\s+|to\s+)?/i;
128
+ // What a reminder says, from the message: the cue words taken off its head, the rest as it was.
129
+ export function taskFromWords(text) {
130
+ const line = String(text ?? '').split('\n').map((one) => one.trim()).find(Boolean) ?? '';
131
+ const bare = line
132
+ .replace(/^(oye|hey|ok|vale|bueno|porfa|por favor|please)[,\s]+/i, '')
133
+ .replace(/^(recu[eé]rd(ame|anos|ale|a)|remind me|no (me )?(dejes|deje) olvidar|no olvides|don'?t (let me )?forget)\s*(?:(?:que|de|to|that)\b)?\s*/i, '')
134
+ .replace(LEADING_WHEN, '')
135
+ .replace(LEADING_WHEN, '')
136
+ .replace(/[.!?¿¡]+$/, '')
137
+ .trim();
138
+ return (bare.charAt(0).toUpperCase() + bare.slice(1)).slice(0, REMINDER_TEXT_MAX);
139
+ }
140
+ export function pendingIn(text) {
141
+ const words = fold(text);
142
+ if (words.length < 6 || words.length > 600 || !PENDING.test(words)) return null;
143
+ const asked = /\b(recuerd(a|ame|anos|ale)|recordarme|remind me|no olvides|don'?t (let me )?forget|que no se me olvide)\b/.test(words);
144
+ return { why: asked ? 'asked' : 'pending', text: taskFromWords(text) };
145
+ }
146
+
147
+ // FREQUENT: a request said again and again, read as its first content words.
148
+ const STOP = new Set('a al algo como con de del el en es esa ese eso esta este esto la las le lo los me mi mis no o para pero por que se si sin su sus te tu un una uno y ya yo the a an and to of in on for is it this that be with you me my please can could would por favor puedes podrias'.split(' '));
149
+ export function habitKey(text) {
150
+ const words = fold(text).replace(/[^a-z0-9ñ\s]/g, ' ').split(/\s+/).filter((word) => word.length >= 3 && !STOP.has(word));
151
+ if (words.length < 2 || words.length > 25) return null;
152
+ return words.slice(0, 5).join(' ');
153
+ }
154
+ // Seen once more; frequent the third time on a different day. Kept per project, small.
155
+ export function noteHabit(roomDir, text, now = new Date()) {
156
+ const key = habitKey(text);
157
+ if (!key) return Promise.resolve(null);
158
+ const file = habitsFile(roomDir);
159
+ return oneAtATime(file, async () => {
160
+ const raw = await readFile(file, 'utf8').then((body) => JSON.parse(body)).catch(() => ({}));
161
+ const habits = raw && typeof raw === 'object' && !Array.isArray(raw) ? raw : {};
162
+ const day = new Date(now).toISOString().slice(0, 10);
163
+ const seen = habits[key] && Array.isArray(habits[key].days) ? habits[key] : { days: [], offered: false };
164
+ if (!seen.days.includes(day)) seen.days = [...seen.days, day].slice(-10);
165
+ seen.sample = String(text).slice(0, REMINDER_TEXT_MAX);
166
+ seen.hour = new Date(now).getHours();
167
+ habits[key] = seen;
168
+ // The newest two hundred, so the file stays small.
169
+ const kept = Object.fromEntries(Object.entries(habits).sort((a, b) => String(b[1].days?.at(-1)).localeCompare(String(a[1].days?.at(-1)))).slice(0, 200));
170
+ const frequent = seen.days.length >= 3 && !seen.offered;
171
+ if (frequent) kept[key].offered = true;
172
+ await writeWhole(file, `${JSON.stringify(kept)}\n`);
173
+ return frequent ? { why: 'frequent', text: taskFromWords(text), hour: seen.hour } : null;
174
+ });
175
+ }
176
+
177
+ // The local model's reading of a candidate: is it a task, and how would a reminder say it.
178
+ const LOCAL_SYSTEM = 'You read one message a person wrote to their AI agents about their project. Decide whether it holds something the PERSON must do or remember later: a pending task, a deadline, a follow-up, or something they asked to be reminded of. Questions, instructions for the agents to do now, and plans already done are not. Answer with JSON only: {"remind": true|false, "what": "the task as a short reminder, imperative, in the same language as the message, at most 80 characters", "when": "when it is due, in the words of the message, or empty"}.';
179
+ export async function readWithLocal({ host, model, text, fetchImpl = globalThis.fetch, timeoutMs = 45000 }) {
180
+ try {
181
+ const answer = await ollamaGenerate({ host, model, system: LOCAL_SYSTEM, prompt: String(text).slice(0, 2000), json: true, fetchImpl, timeoutMs, temperature: 0 });
182
+ const parsed = JSON.parse(answer.text);
183
+ if (typeof parsed?.remind !== 'boolean') return null;
184
+ return { remind: parsed.remind, what: typeof parsed.what === 'string' ? parsed.what.trim().replace(/[.!¡]+$/, '').slice(0, REMINDER_TEXT_MAX) : '', when: typeof parsed.when === 'string' ? parsed.when.slice(0, 120) : '' };
185
+ } catch { return null; }
186
+ }
187
+
188
+ // One offer per conversation every few minutes, unless the person asked for it in words.
189
+ const lastOffer = new Map();
190
+ const OFFER_GAP_MS = 10 * 60 * 1000;
191
+ export async function offerFor(ctx, event, { now = new Date(), fetchImpl = globalThis.fetch } = {}) {
192
+ const said = event?.payload ?? {};
193
+ if (event?.type !== 'message.created' || said.role !== 'user' || said.via || said.synthetic) return null;
194
+ const text = String(said.text ?? '');
195
+ if (!text.trim() || text.trim().startsWith('/')) return null;
196
+ const prefs = ctx.settings ?? {};
197
+ const dayHour = hourOf(prefs);
198
+ let found = prefs.offer === false ? null : pendingIn(text);
199
+ const habit = ctx.roomDir && prefs.habits !== false ? await noteHabit(ctx.roomDir, text, now).catch(() => null) : null;
200
+ if (!found && habit) found = habit;
201
+ if (!found) return null;
202
+ const chatKey = `${ctx.roomId ?? 'home'}|${ctx.chat ?? ''}`;
203
+ if (found.why !== 'asked' && Date.now() - (lastOffer.get(chatKey) ?? 0) < OFFER_GAP_MS) return null;
204
+ // The local AI, when this project has it, reads it first and says it shorter.
205
+ let what = found.text;
206
+ let whenWords = text;
207
+ let by = 'words';
208
+ const local = ctx.services?.ollama?.state?.() ?? null;
209
+ const project = await Promise.resolve(ctx.services?.ollama?.project?.()).catch(() => null);
210
+ const model = local?.madreModel ?? local?.chatModel ?? null;
211
+ if (prefs.local !== false && local?.running && model && project?.on !== false && found.why !== 'frequent') {
212
+ const read = await readWithLocal({ host: local.host, model, text, fetchImpl });
213
+ if (read && !read.remind && found.why !== 'asked') return null;
214
+ if (read?.what) { what = read.what; by = 'local'; }
215
+ if (read?.when) whenWords = `${read.when} ${text}`;
216
+ }
217
+ if (!what) return null;
218
+ const when = found.why === 'frequent'
219
+ ? { due: nextOccurrence(new Date(new Date(now).setHours(found.hour ?? 9, 0, 0, 0)), 'daily', now), repeat: 'daily' }
220
+ : parseWhen(whenWords, now, { hour: dayHour }) ?? { due: tomorrowMorning(now, dayHour), repeat: null };
221
+ lastOffer.set(chatKey, Date.now());
222
+ return { offer: randomUUID(), what, due: when.due.toISOString(), repeat: when.repeat ?? null, why: found.why, by, messageId: said.messageId ?? null };
223
+ }
224
+
225
+ const reply = (status, body) => ({ status, body });
226
+ // What the person set in Reminders' settings: the hour a day starts at, and how long «later» is.
227
+ export const HOURS = ['7', '8', '9', '10', '11', '12'];
228
+ export const SNOOZES = ['15', '30', '60', '180'];
229
+ const hourOf = (prefs) => (HOURS.includes(String(prefs?.hour)) ? Number(prefs.hour) : 9);
230
+ const snoozeOf = (prefs) => (SNOOZES.includes(String(prefs?.snooze)) ? Number(prefs.snooze) : 60);
231
+ const prefsOf = (ctx) => reminders.settingsFrom(ctx.config, ctx.roomId);
232
+ // A due time said as a person reads it, in the room's language.
233
+ export const whenWords = (due) => new Intl.DateTimeFormat(language() === 'en' ? 'en-US' : 'es-MX', { weekday: 'long', day: 'numeric', month: 'long', hour: 'numeric', minute: '2-digit' }).format(new Date(due));
234
+ const projectOf = (ctx) => (ctx.roomId ? basename(ctx.projectRoot ?? '') || null : null);
235
+ // The quick times a card offers beside the one it chose, said as data the page puts in words.
236
+ export function quickTimes(now = new Date()) {
237
+ const hour = new Date(now.getTime() + 3600000);
238
+ const evening = new Date(now); evening.setHours(18, 0, 0, 0);
239
+ const monday = parseWhen('el lunes', now).due;
240
+ return [
241
+ { id: 'hour', due: hour.toISOString(), repeat: null },
242
+ ...(evening > new Date(now.getTime() + 30 * 60000) ? [{ id: 'evening', due: evening.toISOString(), repeat: null }] : []),
243
+ { id: 'tomorrow', due: tomorrowMorning(now).toISOString(), repeat: null },
244
+ { id: 'monday', due: monday.toISOString(), repeat: null },
245
+ ];
246
+ }
247
+
248
+ const reminders = defineModule({
249
+ id: 'reminders',
250
+ name: 'Reminders',
251
+ vendor: 'MADRE',
252
+ version: '0.1.0',
253
+ credit: 'Daniel Castillo',
254
+ summary: 'Notices what you say you still have to do, or what you ask for every day, and offers to remind you with one press. Reminders show in Home and in the project they came from. Read on your computer, with the local AI when you have it; no agent is asked.',
255
+ creates: ['nothing in the project', 'a reminders.json file in ~/.pulse, one for the whole computer'],
256
+ settings: { enabled: false, offer: true, habits: true, local: true, hour: '9', snooze: '60' },
257
+ controls: [
258
+ { key: 'offer', type: 'switch', label: 'Offer a reminder when you write something pending', note: 'A card under your message, with the time already chosen. Nothing is set without your click.' },
259
+ { key: 'habits', type: 'switch', label: 'Notice what you ask for often', note: 'The same request on three different days is offered as a daily reminder.' },
260
+ { key: 'local', type: 'switch', label: 'Let the local AI read it first', note: 'When the project has it, it drops what is not a task and says it shorter. Without it, your own words are offered.' },
261
+ { key: 'hour', type: 'select', label: 'Hour when you do not say one', options: HOURS, choices: HOURS.map((hour) => ({ value: hour, label: `${hour}:00` })), note: '«Tomorrow» with no hour is tomorrow at this hour.' },
262
+ { key: 'snooze', type: 'select', label: 'Put off by', options: SNOOZES, choices: [{ value: '15', label: '15 minutes' }, { value: '30', label: '30 minutes' }, { value: '60', label: '1 hour' }, { value: '180', label: '3 hours' }], note: 'What the «later» key on a reminder that is due waits.' },
263
+ ],
264
+ async status(ctx) {
265
+ const enabled = Boolean(ctx.settings.enabled);
266
+ const list = (await readReminders(ctx.stateRoot)).filter((one) => !one.done && (!ctx.roomId || one.room === ctx.roomId));
267
+ return {
268
+ status: { installed: enabled, detail: enabled ? t('{n} reminders ahead', { n: list.length }) : t('off') },
269
+ install: { display: enabled ? 'turn off Reminders' : 'turn on Reminders', platforms: [] },
270
+ };
271
+ },
272
+ async onEvent(ctx, event) {
273
+ const offer = await offerFor(ctx, event);
274
+ if (offer) await ctx.record('reminder.offered', offer);
275
+ },
276
+ // An agent sets a reminder when the person asks for one (src/mcp/notes-server.mjs): it can only add.
277
+ async toolsForTurn(ctx, turn) {
278
+ if (turn?.text !== undefined && !ASKS_FOR_REMINDER.test(turn.text)) return [];
279
+ return [{
280
+ name: 'madre-reminders',
281
+ command: process.execPath,
282
+ args: [NOTES_SERVER],
283
+ env: { PULSE_REMINDERS_STATE: ctx.stateRoot, PULSE_ROOM_ID: ctx.roomId ?? '', PULSE_PROJECT: projectOf(ctx) ?? '', PULSE_REMINDER_HOUR: String(hourOf(ctx.settings)) },
284
+ tools: ['create_reminder'],
285
+ brief: 'When the person asks to be reminded of something (they may write /recordatorios or /reminders), set it with the create_reminder tool of server madre-reminders: what to remember, short, in their language, and when, in their own words. Then tell them when it is due.',
286
+ }];
287
+ },
288
+ routes: [
289
+ // This project's reminders, or every one in Home; the due ones first.
290
+ { method: 'GET', path: '/api/reminders', handler: async (ctx, { url }) => {
291
+ const all = !ctx.roomId || url?.searchParams?.get('all') === '1';
292
+ const mine = (await readReminders(ctx.stateRoot)).filter((one) => all || one.room === ctx.roomId);
293
+ const list = mine.filter((one) => !one.done).sort((a, b) => a.due.localeCompare(b.due));
294
+ // The done ones, newest first, only when asked: the sheet's history.
295
+ const done = url?.searchParams?.get('done') === '1' ? mine.filter((one) => one.done).sort((a, b) => b.done.localeCompare(a.done)).slice(0, 20) : undefined;
296
+ const prefs = prefsOf(ctx);
297
+ return reply(200, { reminders: list, done, room: ctx.roomId ?? null, now: new Date().toISOString(), times: quickTimes(), prefs: { hour: hourOf(prefs), snooze: snoozeOf(prefs) } });
298
+ } },
299
+ { method: 'POST', path: '/api/reminders', handler: async (ctx, { payload }) => {
300
+ const text = String(payload?.text ?? '').trim();
301
+ if (!text) return reply(400, { error: t('Write what to remember.') });
302
+ const dayHour = hourOf(prefsOf(ctx));
303
+ const when = iso(payload?.due) ? { due: new Date(payload.due), repeat: REPEATS.includes(payload?.repeat) ? payload.repeat : null } : parseWhen(`${payload?.when ?? ''} ${text}`, new Date(), { hour: dayHour }) ?? { due: tomorrowMorning(new Date(), dayHour), repeat: null };
304
+ const made = await addReminder(ctx.stateRoot, { text: taskFromWords(text), due: when.due.toISOString(), repeat: when.repeat, room: ctx.roomId ?? null, project: projectOf(ctx), why: 'manual' });
305
+ return made.error ? reply(409, { error: t('The reminder was not set.') }) : reply(200, made);
306
+ } },
307
+ // The answer to a card: yes with the time it offered or one of the quick ones, or no.
308
+ { method: 'POST', path: '/api/reminders/answer', handler: async (ctx, { payload }) => {
309
+ const offer = String(payload?.offer ?? '');
310
+ if (!ID.test(offer)) return reply(400, { error: t('That offer is not known.') });
311
+ const chat = typeof payload?.chat === 'string' ? payload.chat : null;
312
+ let made = null;
313
+ if (payload?.accept === true) {
314
+ const due = iso(payload?.due);
315
+ if (!due) return reply(400, { error: t('Say when.') });
316
+ made = await addReminder(ctx.stateRoot, { text: String(payload?.text ?? ''), due, repeat: REPEATS.includes(payload?.repeat) ? payload.repeat : null, room: ctx.roomId ?? null, project: projectOf(ctx), chat, why: ['pending', 'frequent', 'asked'].includes(payload?.why) ? payload.why : 'pending' });
317
+ if (made.error) return reply(409, { error: t('The reminder was not set.') });
318
+ }
319
+ const settled = { offer, accepted: Boolean(made), id: made?.reminder.id ?? null, due: made?.reminder.due ?? null, repeat: made?.reminder.repeat ?? null };
320
+ await ctx.services.recordIn(chat, 'reminder.answered', settled).catch(() => null);
321
+ return reply(200, { ...settled, reminder: made?.reminder ?? null });
322
+ } },
323
+ { method: 'POST', path: '/api/reminders/done', handler: async (ctx, { payload }) => {
324
+ const done = await doneReminder(ctx.stateRoot, String(payload?.id ?? ''));
325
+ return done.error ? reply(404, { error: t('That reminder is no longer here.') }) : reply(200, done);
326
+ } },
327
+ { method: 'POST', path: '/api/reminders/snooze', handler: async (ctx, { payload }) => {
328
+ const minutes = Number(payload?.minutes);
329
+ const until = iso(payload?.until) ?? (Number.isFinite(minutes) && minutes > 0 && minutes <= 60 * 24 * 30 ? new Date(Date.now() + minutes * 60000).toISOString() : null);
330
+ if (!until) return reply(400, { error: t('Say when.') });
331
+ const moved = await snoozeReminder(ctx.stateRoot, String(payload?.id ?? ''), until);
332
+ return moved.error ? reply(404, { error: t('That reminder is no longer here.') }) : reply(200, moved);
333
+ } },
334
+ // The history emptied: the done ones of this project, or of every project in Home.
335
+ { method: 'POST', path: '/api/reminders/clear-done', handler: async (ctx) => {
336
+ const cleared = await clearDone(ctx.stateRoot, ctx.roomId ?? null);
337
+ return reply(200, cleared);
338
+ } },
339
+ { method: 'POST', path: '/api/reminders/delete', handler: async (ctx, { payload }) => {
340
+ const gone = await deleteReminder(ctx.stateRoot, String(payload?.id ?? ''));
341
+ return gone.error ? reply(404, { error: t('That reminder is no longer here.') }) : reply(200, gone);
342
+ } },
343
+ ],
344
+ });
345
+ export default reminders;
@@ -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
 
@@ -77,7 +78,7 @@ export const MODULE_FIELDS = new Set([
77
78
  'requires', 'models', 'commands', 'card', 'configKey', 'settings', 'controls', 'routes', 'reaches',
78
79
  'conditions', 'slash', 'status', 'preflight', 'detect', 'confirm', 'installCommand', 'secrets',
79
80
  'updatePlan', 'toolsForTurn', 'toggle', 'onToggle', 'onSettings', 'onEvent', 'toggledEvent',
80
- 'toggledBody', 'describe', 'ready', 'footer',
81
+ 'toggledBody', 'describe', 'ready', 'footer', 'credit',
81
82
  ]);
82
83
  export const unknownFields = (spec) => Object.keys(spec ?? {}).filter((key) => !MODULE_FIELDS.has(key));
83
84
 
@@ -107,9 +108,14 @@ export function defineModule(spec) {
107
108
  if (!spec.name) throw new Error(`Module ${spec.id} needs a name.`);
108
109
  const kind = spec.kind ?? 'builtin';
109
110
  const configKey = spec.configKey ?? camel(spec.id);
111
+ // Its name and what it does may come in both languages, { es, en } (2026-10-20): MADRE keeps one
112
+ // word for its own records (English, else Spanish) and shows the room's (describe, /api/commands).
113
+ const oneWord = (value) => (isBilingual(value) ? value.en ?? value.es : value);
114
+ const nameText = oneWord(spec.name);
110
115
  const defaults = { ...(kind === 'builtin' ? { enabled: false } : {}), ...(spec.settings ?? {}) };
111
116
  const base = {
112
- id: spec.id, kind, name: spec.name, vendor: spec.vendor ?? 'MADRE', package: spec.package ?? null, version: spec.version ?? null,
117
+ id: spec.id, kind, name: nameText, vendor: spec.vendor ?? 'MADRE', package: spec.package ?? null, version: spec.version ?? null,
118
+ words: { name: isBilingual(spec.name) ? spec.name : null, summary: isBilingual(spec.summary) ? spec.summary : null },
113
119
  // Keys this contract does not answer to. Carried so whoever installs the module is told.
114
120
  unknown: unknownFields(spec),
115
121
  // What this module's version follows, when it is not its own: { name, npm } or { name, github }.
@@ -121,7 +127,9 @@ export function defineModule(spec) {
121
127
  updates: spec.updates?.url && /^https:\/\//.test(String(spec.updates.url)) ? { url: String(spec.updates.url) } : null,
122
128
  // Keys beside MADRE's version, drawn by MADRE while the module is on (footerKeys).
123
129
  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),
130
+ // Whose idea it was (2026-10-20, Reminders): said on its card and in the Market.
131
+ credit: typeof spec.credit === 'string' && spec.credit.trim() ? spec.credit.trim().slice(0, 80) : null,
132
+ 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
133
  card: spec.card ?? (kind === 'builtin' ? 'switch' : 'installer'),
126
134
  // The settings floor of the card, declared instead of drawn: MADRE renders these and saves
127
135
  // them into the module's own block of ~/.pulse/config.json.
@@ -136,7 +144,12 @@ export function defineModule(spec) {
136
144
  const options = control.options ?? choices?.map((choice) => choice.value) ?? [];
137
145
  if (type === 'select' && !options.length) throw new Error(`Module ${spec.id}: control ${control.key} is a select with no options.`);
138
146
  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) };
147
+ // What a switch says the moment it is turned on or off (`said: { on, off }`), for a change
148
+ // nothing shows at once: the person is told what will happen and when (2026-10-20).
149
+ const said = type === 'switch' && control.said && typeof control.said === 'object'
150
+ ? Object.fromEntries(['on', 'off'].filter((side) => typeof control.said[side] === 'string' && control.said[side].trim()).map((side) => [side, control.said[side]]))
151
+ : null;
152
+ 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
153
  }),
141
154
  // Where this module's traffic goes, in the same four answers `src/outbound.mjs` demands of
142
155
  // MADRE's own destinations. Without it a connector's traffic reads in the log as «an address
@@ -147,7 +160,7 @@ export function defineModule(spec) {
147
160
  for (const answer of ['to', 'what', 'when']) {
148
161
  if (!reach[answer]) throw new Error(`Module ${spec.id}: destination ${reach.host} does not say ${answer}.`);
149
162
  }
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 } : {}) };
163
+ 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
164
  }),
152
165
  // Secrets this module needs to do its job: declared, not drawn. MADRE renders a paste field
153
166
  // per entry and keeps the value in its vault under this module's name. The card only ever
@@ -205,6 +218,9 @@ export function defineModule(spec) {
205
218
  const stamp = await versionOf(this, { declared: spec.version ?? null, tracked });
206
219
  return {
207
220
  ...base,
221
+ // The room's words when the module wrote both (translate() picks them on the way out).
222
+ ...(base.words.name ? { name: base.words.name } : {}),
223
+ ...(base.words.summary ? { summary: base.words.summary } : {}),
208
224
  ...(this.external ? { external: true, origin: this.origin, file: this.file } : {}),
209
225
  ...own,
210
226
  version: stamp.version,
package/src/mother.mjs CHANGED
@@ -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.',
package/src/ollama.mjs CHANGED
@@ -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();
@@ -0,0 +1,63 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // MADRE · © 2026 Jossue Alcalá · GNU AGPL v3 with additional terms (Section 7): ADDITIONAL-TERMS.md
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.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, writeFile } from 'node:fs/promises';
12
+ import { join } from 'node:path';
13
+ import { diagnose } from '../public/troubleshooting.js';
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 {}; } };
17
+ async function keep(stateRoot, data) {
18
+ await mkdir(stateRoot, { recursive: true });
19
+ const temp = `${file(stateRoot)}.${process.pid}.${Date.now()}.tmp`;
20
+ await writeFile(temp, JSON.stringify(data, null, 2));
21
+ await rename(temp, file(stateRoot));
22
+ }
23
+
24
+ const OPENCODE_PICK = 'opencode/big-pickle';
25
+ export const providerOf = (model) => (typeof model === 'string' && model.includes('/') ? model.split('/')[0] : null);
26
+
27
+ // Which of MADRE's known conditions this failure is, said as what the provider needs.
28
+ const KINDS = { 'provider-credit-exhausted': 'no-credit', 'opencode-default-provider': 'bad-key' };
29
+ export function problemOf(error) {
30
+ for (const condition of diagnose(error, 'opencode')) if (KINDS[condition.id]) return KINDS[condition.id];
31
+ return null;
32
+ }
33
+
34
+ // One turn of OpenCode that ended: what answered is remembered, what failed for its provider too.
35
+ export async function noteOpenCodeTurn(stateRoot, { ok, model = null, error = null, now = new Date() }) {
36
+ const provider = providerOf(model);
37
+ const data = await read(stateRoot);
38
+ data.problems ??= {};
39
+ if (ok) {
40
+ if (model) data.worked = { model, at: now.toISOString() };
41
+ if (provider && data.problems[provider]) delete data.problems[provider];
42
+ } else {
43
+ const kind = problemOf(error);
44
+ if (!kind || !provider) return data;
45
+ data.problems[provider] = { kind, model, at: now.toISOString() };
46
+ }
47
+ await keep(stateRoot, data);
48
+ return data;
49
+ }
50
+
51
+ export const openCodeHealth = async (stateRoot) => { const data = await read(stateRoot); return { worked: data.worked ?? null, problems: data.problems ?? {} }; };
52
+
53
+ // The model to offer instead of one that failed: the last one that answered, if its provider is
54
+ // not the one in trouble; otherwise one of OpenCode's own free models, which need no account.
55
+ export function suggestOpenCodeModel(health, { failed = null, own = [] } = {}) {
56
+ const bad = new Set([providerOf(failed), ...Object.keys(health?.problems ?? {})].filter(Boolean));
57
+ const worked = health?.worked?.model;
58
+ if (worked && worked !== failed && !bad.has(providerOf(worked))) return { model: worked, why: 'worked' };
59
+ // OpenCode's own pick when it is told no model (`opencode run` answers on big-pickle) goes first;
60
+ // the rest in the order the CLI lists them.
61
+ const free = [...own].sort((a, b) => Number(b === OPENCODE_PICK) - Number(a === OPENCODE_PICK)).find((model) => !bad.has(providerOf(model)));
62
+ return free ? { model: free, why: 'free' } : null;
63
+ }
package/src/outbound.mjs CHANGED
@@ -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.',
@@ -95,6 +104,14 @@ export const DESTINATIONS = [
95
104
  where: 'Settings › Version and reports › Look for new versions · or PULSE_MARKET=0',
96
105
  inside: true,
97
106
  },
107
+ {
108
+ // A paid module's license (src/market-license.mjs): asked when the person activates or releases it.
109
+ id: 'license', host: 'api.lemonsqueezy.com', match: (url) => url.pathname.startsWith('/v1/licenses/'), to: 'Lemon Squeezy · licenses of paid modules',
110
+ 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.',
111
+ when: 'only when you press Activate or Release on a paid module of the Market',
112
+ where: 'Market › the paid module\'s page',
113
+ inside: true,
114
+ },
98
115
  {
99
116
  id: 'usage', host: 'madre.run', match: (url) => url.pathname === '/api/usage', to: "madre.run · the author's usage figures",
100
117
  what: "The author's token, to read how many copies are on. Only in the author's own copy, run from source.",
@@ -120,7 +137,7 @@ export const DESTINATIONS = [
120
137
  id: 'ollama', host: null, local: true, to: 'Ollama, on this computer',
121
138
  what: 'Memories to embed, exchanges to distil, and whatever you ask @madre. It goes to a port on this machine and stops there.',
122
139
  when: 'while Ollama is running',
123
- where: 'Modules › Local AI',
140
+ where: 'Settings › Local AI',
124
141
  inside: true,
125
142
  },
126
143
  ];
@@ -325,6 +342,13 @@ export class OutboundLog {
325
342
  }
326
343
 
327
344
  async drain() { await this.#writes; }
345
+ // The room that keeps this log closed: what is written down from here on stays in memory. A
346
+ // request still out when the room closed was written after it, and made its folder again while
347
+ // that folder was being removed (2026-10-21).
348
+ async close() {
349
+ this.#file = null;
350
+ await this.#writes;
351
+ }
328
352
  }
329
353
 
330
354
  // The declaration with today's answer filled in: is this one on, and what has it done.