@jossuealcala/madre 1.1.1 → 1.1.2
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.
- package/CHANGELOG.en.md +22 -1
- package/CHANGELOG.md +22 -1
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/docs/REFERENCE.md +2 -1
- package/docs/en/REFERENCE.md +2 -1
- package/package.json +1 -1
- package/public/app.js +2 -2
- package/public/en.js +1 -1
- package/public/es.js +143 -10
- package/public/manual-content.js +6 -6
- package/public/market.js +13 -2
- package/public/salas-mac.css +69 -0
- package/public/salas-mac.js +306 -1
- package/public/welcome.js +40 -12
- package/src/dataset.mjs +4 -2
- package/src/embeddings.mjs +2 -2
- package/src/file-ops.mjs +9 -3
- package/src/github.mjs +5 -3
- package/src/market-remote.mjs +35 -2
- package/src/mcp/memory-server.mjs +12 -3
- package/src/mcp/proxy.mjs +31 -8
- package/src/memory-tools.mjs +9 -2
- package/src/memory.mjs +16 -0
- package/src/modules/check-alone.mjs +25 -0
- package/src/modules/index.mjs +41 -7
- package/src/mother.mjs +6 -1
- package/src/outbound.mjs +11 -3
- package/src/room/archivist.mjs +7 -1
- package/src/room/context.mjs +6 -3
- package/src/room/copilot.mjs +22 -28
- package/src/room.mjs +4 -4
- package/src/rumbo.mjs +337 -0
- package/src/salas.mjs +103 -1
- package/src/server.mjs +111 -9
- package/src/tour.mjs +2 -2
- package/src/whats-new.mjs +23 -0
package/public/salas-mac.js
CHANGED
|
@@ -61,6 +61,8 @@ let arming = 0;
|
|
|
61
61
|
let data = null;
|
|
62
62
|
let macro = null; // the macroverse, while it is open
|
|
63
63
|
let welcomed = false; // the welcome was offered this visit (public/welcome.js)
|
|
64
|
+
// Whether this copy is owed the invitation to a first project (2026-11-01, homeInvite), asked once.
|
|
65
|
+
const inviteAsk = fetch('/api/invite/project', { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null)).catch(() => null);
|
|
64
66
|
let welcomeSeen = null; // where the welcome is (src/tour.mjs, `welcome`), as last saved
|
|
65
67
|
let agentsSeen = null; // what /api/settings said of the agents, last time it was asked
|
|
66
68
|
let localSeen = null; // what /api/salas/local-ai said: the mode and which projects use the local AI
|
|
@@ -507,7 +509,14 @@ function draw() {
|
|
|
507
509
|
// An empty Home opens the welcome where it was left, or at the project when it was finished
|
|
508
510
|
// without one; someone new meets it in place of the bonjour (public/tour.js).
|
|
509
511
|
// Not for whoever updated from before 1.1.0: they meet the news, and «Add project» is on Home (2026-10-30).
|
|
510
|
-
|
|
512
|
+
// After an update with no project yet (2026-11-01), the invitation to add one takes the welcome's place.
|
|
513
|
+
if (!all.length && !welcomed) {
|
|
514
|
+
welcomed = true;
|
|
515
|
+
void Promise.all([homeTour.loaded, inviteAsk]).then(([answer, invite]) => {
|
|
516
|
+
if (invite?.show) { void homeInvite(); return; }
|
|
517
|
+
if (!answer?.owed && !answer?.upgraded) openHomeWelcome({ at: answer?.state?.welcome?.finished ? 'project' : null });
|
|
518
|
+
});
|
|
519
|
+
}
|
|
511
520
|
welcomeHome();
|
|
512
521
|
// Home is drawn: the ground over its first frame goes (loader.js, bootDone) — unless the welcome is
|
|
513
522
|
// about to open, whose opening comes first; then it goes as the welcome opens (openHomeWelcome).
|
|
@@ -1522,6 +1531,9 @@ const WIDGETS = {
|
|
|
1522
1531
|
'w-live': { kind: 'live', owner: true, name: () => t('MADRE live'), about: () => t('How many copies of MADRE are on right now, and how many of this month\'s are off. Only you see this.'), size: 4, rows: 3 },
|
|
1523
1532
|
'w-installs': { kind: 'installs', owner: true, name: () => t('Installs'), about: () => t('Installs, updates and uninstalls of MADRE by day, the last 30 days. Only you see this.'), size: 8, rows: 3 },
|
|
1524
1533
|
'w-environments': { kind: 'environments', owner: true, name: () => t('Where MADRE runs'), about: () => t('The systems, memory, agents, projects per copy and modules of the copies this month. Only you see this.'), size: 8, rows: 5 },
|
|
1534
|
+
// MADRE's course (2026-11-01, src/rumbo.mjs): the variables that decide where the project goes,
|
|
1535
|
+
// from madre.run's funnel, GitHub and npm. Only in the author's copy run from source.
|
|
1536
|
+
'w-rumbo': { kind: 'rumbo', owner: true, name: () => t('MADRE\'s course'), about: () => t('The variables that decide where MADRE goes: from a visit to a habit, what the numbers decide, and GitHub and npm. Only you see this.'), size: 12, sizes: [12] },
|
|
1525
1537
|
'w-models': { kind: 'models', name: () => t('Local models'), about: () => t('Ollama, its models, and how close each project is to its own.'), size: 4, rows: 3 },
|
|
1526
1538
|
// Your agenda (2026-10-28): every project's reminders by when they are due — late, today, tomorrow,
|
|
1527
1539
|
// this week, later —, each settled here, and a new one written as you would say it. Read from the
|
|
@@ -1553,6 +1565,7 @@ const TILE_ICONS = {
|
|
|
1553
1565
|
'w-live': trazo('broadcast'),
|
|
1554
1566
|
'w-installs': trazo('download'),
|
|
1555
1567
|
'w-environments': trazo('globe'),
|
|
1568
|
+
'w-rumbo': trazo('trending'),
|
|
1556
1569
|
};
|
|
1557
1570
|
const tileIcon = (id) => { const box = el('span', 'sm-tile-icon'); box.innerHTML = TILE_ICONS[id] ?? ''; return box; }; // trusted: our own SVG strings
|
|
1558
1571
|
const known = (id) => Object.hasOwn(HOME_TILES, id) || Object.hasOwn(WIDGETS, id);
|
|
@@ -2153,6 +2166,255 @@ const WIDGET_PAINT = {
|
|
|
2153
2166
|
}
|
|
2154
2167
|
body.append(box);
|
|
2155
2168
|
},
|
|
2169
|
+
// MADRE's course (2026-11-01, src/rumbo.mjs): the week's north star, the funnel from a visit to a
|
|
2170
|
+
// habit with its leak marked, what the numbers decide, every variable with how sure it is, the
|
|
2171
|
+
// weeks, and the project's record on GitHub and npm. Read again every 20 s; each source keeps its
|
|
2172
|
+
// own clock on the server.
|
|
2173
|
+
rumbo(body, reading) {
|
|
2174
|
+
if (!reading.available) { body.append(el('p', 'sm-hint', reading.status ? t('madre.run answered {status}.', { status: reading.status }) : t('madre.run could not be reached.'))); return; }
|
|
2175
|
+
const n = (value) => (value === null || value === undefined ? '—' : Number(value).toLocaleString());
|
|
2176
|
+
const signed = (value) => (value === null || value === undefined ? '—' : `${value > 0 ? '+' : ''}${Math.round(value * 100)}%`);
|
|
2177
|
+
const shortDay = (day) => new Date(`${day}T12:00:00Z`).toLocaleDateString(document.documentElement.lang === 'en' ? 'en-US' : 'es-MX', { day: 'numeric', month: 'short' });
|
|
2178
|
+
const section = (title, line) => { const head = el('div', 'sm-rumbo-head'); head.append(el('b', null, title)); if (line) head.append(el('small', null, line)); return head; };
|
|
2179
|
+
const byId = Object.fromEntries((reading.variables ?? []).map((one) => [one.id, one]));
|
|
2180
|
+
|
|
2181
|
+
// The north star: copies that asked an AI something this week.
|
|
2182
|
+
const north = reading.north;
|
|
2183
|
+
if (north) {
|
|
2184
|
+
const lead = el('div', 'sm-usage-lead');
|
|
2185
|
+
const change = north.before ? (north.activated - north.before) / north.before : null;
|
|
2186
|
+
const trend = change === null ? t('the first week the diagnostics can tell') : change === 0 ? t('same as the week before') : change > 0 ? t('{n}% more than the week before', { n: Math.round(change * 100) }) : t('{n}% fewer than the week before', { n: Math.round(-change * 100) });
|
|
2187
|
+
lead.append(el('b', 'sm-w-big', n(north.activated)), el('span', null, t('copies asked an AI something this week')), el('small', `sm-usage-trend${change > 0 ? ' up' : change < 0 ? ' down' : ''}`, `${trend} · ${t('{active} copies on this week, {fresh} of them new', { active: n(north.active), fresh: n(north.new) })}`));
|
|
2188
|
+
body.append(lead);
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
const grid = el('div', 'sm-rumbo');
|
|
2192
|
+
const left = el('div', 'sm-rumbo-col');
|
|
2193
|
+
const right = el('div', 'sm-rumbo-col');
|
|
2194
|
+
grid.append(left, right);
|
|
2195
|
+
body.append(grid);
|
|
2196
|
+
|
|
2197
|
+
// THE FUNNEL: each step against the one before it; the leak in red.
|
|
2198
|
+
const LEAK = { ready: 'ready', firstProject: 'used', readyToUse: 'used', d1: 'back', habit: 'habit' };
|
|
2199
|
+
const leak = LEAK[(reading.decisions ?? []).find((one) => one.id === 'bottleneck')?.verdict] ?? null;
|
|
2200
|
+
const STAGES = {
|
|
2201
|
+
visits: [t('GitHub visitors'), t('people, 14 days')],
|
|
2202
|
+
downloads: [t('npm downloads'), t('14 days, mirrors included')],
|
|
2203
|
+
new: [t('New copies'), t('30 days')],
|
|
2204
|
+
told: [t('With diagnostics'), t('1.1.0 or newer')],
|
|
2205
|
+
ready: [t('An AI ready'), null],
|
|
2206
|
+
used: [t('Asked an AI'), null],
|
|
2207
|
+
back: [t('Came back another day'), null],
|
|
2208
|
+
habit: [t('Used it on 2 days'), null],
|
|
2209
|
+
};
|
|
2210
|
+
const funnel = el('div', 'sm-rumbo-funnel');
|
|
2211
|
+
const stages = (reading.funnel ?? []).filter((one) => one.n !== null);
|
|
2212
|
+
const top = Math.max(1, ...stages.filter((one) => !one.side).map((one) => one.n));
|
|
2213
|
+
let before = null;
|
|
2214
|
+
for (const stage of stages) {
|
|
2215
|
+
const [label, line] = STAGES[stage.id] ?? [stage.id, null];
|
|
2216
|
+
const row = el('div', `sm-rumbo-stage${stage.side ? ' side' : ''}${leak === stage.id ? ' is-leak' : ''}`);
|
|
2217
|
+
const words = el('span', 'sm-rumbo-stage-words');
|
|
2218
|
+
words.append(el('b', null, label));
|
|
2219
|
+
const of = stage.of ? t('of {n} at least a day old', { n: n(stage.of) }) : line;
|
|
2220
|
+
if (of) words.append(el('small', null, of));
|
|
2221
|
+
const base = stage.of ?? before;
|
|
2222
|
+
const share = base && !stage.side && !['visits', 'new'].includes(stage.id) ? stage.n / base : null;
|
|
2223
|
+
row.append(words, meter(stage.side ? stage.n / Math.max(stage.n, top) : stage.n / top, leak === stage.id ? 'hot' : null), el('b', 'sm-rumbo-n', n(stage.n)), el('small', 'sm-rumbo-pct', share === null ? '' : `${Math.round(share * 100)}%`));
|
|
2224
|
+
if (leak === stage.id) row.title = t('The leak to fix first');
|
|
2225
|
+
funnel.append(row);
|
|
2226
|
+
if (!stage.side && stage.id !== 'visits') before = stage.n;
|
|
2227
|
+
}
|
|
2228
|
+
left.append(section(t('From a visit to a habit'), t('% is of the step before')), funnel);
|
|
2229
|
+
|
|
2230
|
+
// WHAT THE NUMBERS DECIDE.
|
|
2231
|
+
const pctOf = (value) => (value === null || value === undefined ? '—' : `${Math.round(value * 100)}%`);
|
|
2232
|
+
const BARS = {
|
|
2233
|
+
activatedWeek: (one) => t('{value} of {need} copies asking an AI a week', { value: n(one.value), need: n(one.need) }),
|
|
2234
|
+
d7: (one) => t('{value} of {need} back after 7 days', { value: pctOf(one.value), need: pctOf(one.need) }),
|
|
2235
|
+
habit: (one) => t('{value} of {need} using it on 2 days', { value: pctOf(one.value), need: pctOf(one.need) }),
|
|
2236
|
+
heavy: (one) => t('{value} of {need} with 2 projects or more', { value: pctOf(one.value), need: pctOf(one.need) }),
|
|
2237
|
+
weeksGrowing: (one) => t('{value} of {need} weeks growing in a row', { value: n(one.value), need: n(one.need) }),
|
|
2238
|
+
};
|
|
2239
|
+
const SAYS = {
|
|
2240
|
+
bottleneck: [t('Where people are lost'), (d) => ({
|
|
2241
|
+
ready: t('Setting up an AI: only {pct} of new copies get one ready. The way to a first AI is the leak to fix first.', { pct: pctOf(d.figures.value) }),
|
|
2242
|
+
firstProject: t('Opening a project: {n} of {total} copies never opened one. Without a project there is nothing to ask; the way to a first project is the leak to fix first.', { n: n(d.figures.noProject), total: n(d.figures.projectsKnown) }),
|
|
2243
|
+
readyToUse: t('The first question: {pct} of the copies with an AI ready never asked it anything.', { pct: pctOf(1 - (d.figures.value ?? 0)) }),
|
|
2244
|
+
d1: t('Coming back: only {pct} return after the first day.', { pct: pctOf(d.figures.value) }),
|
|
2245
|
+
habit: t('Habit: only {pct} used an AI on two days or more.', { pct: pctOf(d.figures.value) }),
|
|
2246
|
+
})[d.verdict]],
|
|
2247
|
+
focus: [t('Product or reach'), (d) => ({
|
|
2248
|
+
product: t('Product first: {used} of new copies ask an AI something and {d1} come back. More visitors now would only fill the leak.', { used: pctOf(d.figures.used), d1: pctOf(d.figures.d1) }),
|
|
2249
|
+
reach: t('Reach: new copies use it and come back, but the week did not grow. Time to tell more people.'),
|
|
2250
|
+
both: t('Both hold: copies use it, come back and the week grows.'),
|
|
2251
|
+
})[d.verdict]],
|
|
2252
|
+
windows: [t('Windows and the native app'), (d) => ({
|
|
2253
|
+
priority: t('{share} of new copies come from Windows, and {win} of them ask an AI (the rest, {rest}). Windows is the main door: the native app weighs on the course.', { share: pctOf(d.figures.share), win: pctOf(d.figures.winUse), rest: pctOf(d.figures.restUse) }),
|
|
2254
|
+
relevant: t('{share} of new copies come from Windows ({win} ask an AI; the rest, {rest}).', { share: pctOf(d.figures.share), win: pctOf(d.figures.winUse), rest: pctOf(d.figures.restUse) }),
|
|
2255
|
+
minor: t('Windows is {share} of new copies: not the main door yet.', { share: pctOf(d.figures.share) }),
|
|
2256
|
+
})[d.verdict]],
|
|
2257
|
+
pro: [t('Charging for MADRE Pro'), (d) => ({
|
|
2258
|
+
ready: t('The four bars are met: there is a base to charge for Pro.'),
|
|
2259
|
+
close: t('{met} of 4 bars met.', { met: d.figures.met }),
|
|
2260
|
+
early: t('Not yet: {met} of 4 bars met.', { met: d.figures.met }),
|
|
2261
|
+
})[d.verdict]],
|
|
2262
|
+
invest: [t('Traction to show'), (d) => ({
|
|
2263
|
+
ready: t('Growing week after week with people who stay: there is traction to show.'),
|
|
2264
|
+
waiting: t('It takes two weeks with diagnostics to tell whether it grows week after week.'),
|
|
2265
|
+
close: t('{met} of 3 bars met.', { met: d.figures.met }),
|
|
2266
|
+
early: t('Not yet: {met} of 3 bars met.', { met: d.figures.met }),
|
|
2267
|
+
})[d.verdict]],
|
|
2268
|
+
english: [t('English'), (d) => ({
|
|
2269
|
+
invest: t('{share} of copies speak English: worth building for it.', { share: pctOf(d.figures.share) }),
|
|
2270
|
+
keep: t('{share} of copies speak English: keep it working, Spanish leads.', { share: pctOf(d.figures.share) }),
|
|
2271
|
+
spanish: t('{share} of copies speak English: Spanish is where MADRE is used.', { share: pctOf(d.figures.share) }),
|
|
2272
|
+
})[d.verdict]],
|
|
2273
|
+
quality: [t('Failures'), (d) => ({
|
|
2274
|
+
fix: t('{share} of copies met a failure ({k} of {n}): fix before spreading MADRE further.', { share: pctOf(d.figures.value), k: n(d.figures.k), n: n(d.figures.n) }),
|
|
2275
|
+
watch: t('{share} of copies met a failure ({k} of {n}): keep an eye on MADRE errors.', { share: pctOf(d.figures.value), k: n(d.figures.k), n: n(d.figures.n) }),
|
|
2276
|
+
fine: t('{share} of copies met a failure: it holds up.', { share: pctOf(d.figures.value) }),
|
|
2277
|
+
})[d.verdict]],
|
|
2278
|
+
};
|
|
2279
|
+
const decisions = el('div', 'sm-rumbo-decisions');
|
|
2280
|
+
for (const one of reading.decisions ?? []) {
|
|
2281
|
+
const [question, say] = SAYS[one.id] ?? [];
|
|
2282
|
+
if (!question) continue;
|
|
2283
|
+
const row = el('div', `sm-rumbo-decision is-${one.signal}`);
|
|
2284
|
+
const words = el('div', 'sm-rumbo-decision-words');
|
|
2285
|
+
words.append(el('b', null, question), el('span', null, say(one) ?? ''));
|
|
2286
|
+
if (one.figures?.bars) {
|
|
2287
|
+
const chips = el('div', 'sm-rumbo-bars');
|
|
2288
|
+
for (const bar of one.figures.bars) chips.append(el('small', bar.met ? 'met' : null, `${bar.met ? '✓' : '·'} ${BARS[bar.id]?.(bar) ?? bar.id}`));
|
|
2289
|
+
words.append(chips);
|
|
2290
|
+
}
|
|
2291
|
+
row.append(el('i', 'sm-rumbo-dot'), words);
|
|
2292
|
+
decisions.append(row);
|
|
2293
|
+
}
|
|
2294
|
+
right.append(section(t('What the numbers say'), t('Green holds, amber to watch, red to act on')), decisions);
|
|
2295
|
+
|
|
2296
|
+
// THE VARIABLES, each with its band: where the true figure lies nine times out of ten.
|
|
2297
|
+
const NAMES = {
|
|
2298
|
+
ready: t('New copies with an AI ready'),
|
|
2299
|
+
used: t('New copies that asked an AI'),
|
|
2300
|
+
readyToUse: t('With an AI ready, asked it'),
|
|
2301
|
+
firstProject: t('Copies with a project'),
|
|
2302
|
+
d1: t('Back after a day'),
|
|
2303
|
+
d7: t('Back after 7 days'),
|
|
2304
|
+
habit: t('Used it on 2 days or more'),
|
|
2305
|
+
growth: t('Copies asking an AI, week on week'),
|
|
2306
|
+
newGrowth: t('New copies, week on week'),
|
|
2307
|
+
starGrowth: t('Stars, week on week'),
|
|
2308
|
+
starRate: t('Stars per GitHub visitor'),
|
|
2309
|
+
failing: t('Copies that met a failure'),
|
|
2310
|
+
uninstall: t('Uninstalls per install'),
|
|
2311
|
+
windowsShare: t('New copies from Windows'),
|
|
2312
|
+
englishShare: t('Copies in English'),
|
|
2313
|
+
coverage: t('New copies with diagnostics'),
|
|
2314
|
+
topSource: t('Visitors from the top source'),
|
|
2315
|
+
};
|
|
2316
|
+
const GROUPS = { activation: t('Activation'), retention: t('Retention'), momentum: t('Momentum'), quality: t('Quality'), market: t('Market') };
|
|
2317
|
+
const SURE = { high: t('sure'), medium: t('fairly sure'), low: t('small sample') };
|
|
2318
|
+
const table = el('div', 'sm-rumbo-vars');
|
|
2319
|
+
for (const [group, title] of Object.entries(GROUPS)) {
|
|
2320
|
+
const mine = (reading.variables ?? []).filter((one) => one.group === group);
|
|
2321
|
+
if (!mine.length) continue;
|
|
2322
|
+
table.append(el('span', 'sm-rumbo-group', title));
|
|
2323
|
+
for (const one of mine) {
|
|
2324
|
+
const row = el('div', `sm-rumbo-var is-${one.signal}`);
|
|
2325
|
+
const name = one.id === 'topSource' && one.source ? `${NAMES[one.id]} · ${one.source}` : NAMES[one.id] ?? one.id;
|
|
2326
|
+
const value = one.kind === 'change' ? signed(one.value) : pctOf(one.value);
|
|
2327
|
+
const band = el('span', 'sm-rumbo-band');
|
|
2328
|
+
if (one.kind === 'rate' && one.interval) {
|
|
2329
|
+
const fill = el('i');
|
|
2330
|
+
fill.style.left = `${one.interval.low * 100}%`;
|
|
2331
|
+
fill.style.width = `${Math.max(1, (one.interval.high - one.interval.low) * 100)}%`;
|
|
2332
|
+
const dot = el('b');
|
|
2333
|
+
dot.style.left = `${(one.value ?? 0) * 100}%`;
|
|
2334
|
+
band.append(fill, dot);
|
|
2335
|
+
if (one.threshold) for (const at of [one.threshold.bad, one.threshold.good]) { const tick = el('em'); tick.style.left = `${at * 100}%`; band.append(tick); }
|
|
2336
|
+
band.title = t('Between {low} and {high}, nine times out of ten', { low: pctOf(one.interval.low), high: pctOf(one.interval.high) });
|
|
2337
|
+
}
|
|
2338
|
+
const count = one.kind === 'change' ? t('{now} vs {before}', { now: n(one.now), before: n(one.before) }) : t('{k} of {n}', { k: n(one.k), n: n(one.n) });
|
|
2339
|
+
row.append(el('i', 'sm-rumbo-dot'), el('span', 'sm-rumbo-var-name', name), el('b', 'sm-rumbo-n', value), band, el('small', null, `${count} · ${SURE[one.confidence] ?? ''}`));
|
|
2340
|
+
if (one.threshold) row.title = one.threshold.lower ? t('Good at {good} or less, red over {bad}', { good: pctOf(one.threshold.good), bad: pctOf(one.threshold.bad) }) : one.kind === 'change' ? t('Good from {good}, red under {bad}', { good: signed(one.threshold.good), bad: signed(one.threshold.bad) }) : t('Good from {good}, red under {bad}', { good: pctOf(one.threshold.good), bad: pctOf(one.threshold.bad) });
|
|
2341
|
+
table.append(row);
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
body.append(section(t('The variables'), t('The band is where the true figure lies nine times out of ten; the ticks, where it turns amber and green')), table);
|
|
2345
|
+
|
|
2346
|
+
// THE WEEKS: on, new, and the ones that asked an AI.
|
|
2347
|
+
const weeks = (reading.weeks ?? []).filter((one, i, all) => one.active || all.slice(0, i).some((before) => before.active));
|
|
2348
|
+
const lower = el('div', 'sm-rumbo');
|
|
2349
|
+
if (weeks.length) {
|
|
2350
|
+
const peak = Math.max(1, ...weeks.map((one) => one.active));
|
|
2351
|
+
const chart = el('div', 'sm-rumbo-weeks');
|
|
2352
|
+
chart.setAttribute('role', 'img');
|
|
2353
|
+
chart.setAttribute('aria-label', t('Copies on, new and asking an AI, week by week'));
|
|
2354
|
+
for (const one of weeks) {
|
|
2355
|
+
const week = el('span');
|
|
2356
|
+
for (const [field, tone] of [['active', 'on'], ['new', 'new'], ['activated', 'used']]) {
|
|
2357
|
+
const bar = el('i', tone);
|
|
2358
|
+
bar.style.setProperty('--h', String(one[field] / peak));
|
|
2359
|
+
week.append(bar);
|
|
2360
|
+
}
|
|
2361
|
+
week.append(el('small', null, shortDay(one.start)));
|
|
2362
|
+
week.title = t('Week of {day}: {active} on · {fresh} new · {used} asked an AI', { day: shortDay(one.start), active: one.active, fresh: one.new, used: one.activated });
|
|
2363
|
+
chart.append(week);
|
|
2364
|
+
}
|
|
2365
|
+
const box = el('div', 'sm-rumbo-col');
|
|
2366
|
+
const legend = el('small', 'sm-usage-legend');
|
|
2367
|
+
legend.append(el('i', 'is-on'), t('on'), el('i', 'is-new'), t('new'), el('i', 'is-used'), t('asked an AI'));
|
|
2368
|
+
box.append(section(t('Week by week'), null), chart, legend);
|
|
2369
|
+
lower.append(box);
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
// THE RECORD: GitHub and npm since the start.
|
|
2373
|
+
const record = reading.record ?? {};
|
|
2374
|
+
const facts = el('div', 'sm-usage-lines sm-rumbo-record');
|
|
2375
|
+
const lines = [];
|
|
2376
|
+
if (record.stars !== null && record.stars !== undefined) lines.push([t('Stars'), t('{n} · {week} this week · {forks} forks', { n: n(record.stars), week: n(record.stars7), forks: n(record.forks) })]);
|
|
2377
|
+
if (record.visits) lines.push([t('GitHub, 14 days'), t('{v} visits from {u} people · {c} clones', { v: n(record.visits.count), u: n(record.visits.uniques), c: n(record.clones?.count) })]);
|
|
2378
|
+
if (record.installer) lines.push([t('Windows installer'), t('{n} downloads from GitHub', { n: n(record.installer.total) })]);
|
|
2379
|
+
if (record.npm) lines.push([t('npm'), t('{week} last week · {total} in 90 days · {top}', { week: n(record.npm.lastWeek), total: n(record.npm.total), top: (record.npm.byVersion ?? []).slice(0, 3).map((one) => `${one.version} ${n(one.n)}`).join(' · ') })]);
|
|
2380
|
+
const sources = byId.topSource?.sources ?? [];
|
|
2381
|
+
if (sources.length) lines.push([t('Visitors come from'), sources.map((one) => `${one.name} ${n(one.n)}`).join(' · ')]);
|
|
2382
|
+
for (const [label, said] of lines) {
|
|
2383
|
+
const row = el('div', 'sm-w-line');
|
|
2384
|
+
row.append(el('b', null, label), el('small', null, said));
|
|
2385
|
+
facts.append(row);
|
|
2386
|
+
}
|
|
2387
|
+
// Stars by day since the first one: the project's own history.
|
|
2388
|
+
const stars = record.starsByDay ?? [];
|
|
2389
|
+
const box = el('div', 'sm-rumbo-col');
|
|
2390
|
+
box.append(section(t('GitHub and npm'), null), facts);
|
|
2391
|
+
if (stars.length) {
|
|
2392
|
+
const first = Date.parse(`${stars[0].day}T12:00:00Z`);
|
|
2393
|
+
const span = Math.max(1, Math.round((Date.now() - first) / 86_400_000) + 1);
|
|
2394
|
+
const perDay = new Map(stars.map((one) => [one.day, one.n]));
|
|
2395
|
+
const values = Array.from({ length: span }, (_, i) => perDay.get(new Date(first + i * 86_400_000).toISOString().slice(0, 10)) ?? 0);
|
|
2396
|
+
const peak = Math.max(1, ...values);
|
|
2397
|
+
const strip = el('div', 'sm-rumbo-strip');
|
|
2398
|
+
strip.style.setProperty('--days', String(span));
|
|
2399
|
+
strip.setAttribute('role', 'img');
|
|
2400
|
+
strip.setAttribute('aria-label', t('Stars each day since the first'));
|
|
2401
|
+
values.forEach((value, i) => { const bar = el('i'); bar.style.setProperty('--h', String(value / peak)); bar.title = `${shortDay(new Date(first + i * 86_400_000).toISOString().slice(0, 10))}: ${value}`; strip.append(bar); });
|
|
2402
|
+
const axis = el('div', 'sm-usage-axis');
|
|
2403
|
+
axis.append(el('small', null, shortDay(stars[0].day)), el('small', null, t('stars each day')), el('small', null, t('today')));
|
|
2404
|
+
box.append(strip, axis);
|
|
2405
|
+
}
|
|
2406
|
+
lower.append(box);
|
|
2407
|
+
body.append(lower);
|
|
2408
|
+
|
|
2409
|
+
// Where each figure came from, and when.
|
|
2410
|
+
const said = reading.sources ?? {};
|
|
2411
|
+
const when = (one) => (one?.at ? ago(one.at) : t('never'));
|
|
2412
|
+
const foot = el('small', 'sm-w-foot', t('Read: madre.run {a} · GitHub {b} · npm {c}', { a: when(said.madre), b: when(said.github), c: when(said.npm) }));
|
|
2413
|
+
body.append(foot);
|
|
2414
|
+
if (said.madre?.failed && !said.madre.at) body.append(el('p', 'sm-hint', t('madre.run does not give the funnel yet (it answered {status}): publish the site so it has /api/rumbo.', { status: said.madre.status || '—' })));
|
|
2415
|
+
else if (said.madre?.failed) body.append(el('p', 'sm-hint', t('madre.run did not answer just now: these are its last figures.')));
|
|
2416
|
+
if (!said.github?.at) body.append(el('p', 'sm-hint', t('GitHub is read with your gh session: sign in with gh auth login to see stars and visits.')));
|
|
2417
|
+
},
|
|
2156
2418
|
usage(body, reading) {
|
|
2157
2419
|
if (!reading.available) { body.append(el('p', 'sm-hint', reading.status ? t('madre.run answered {status}.', { status: reading.status }) : t('madre.run could not be reached.'))); return; }
|
|
2158
2420
|
const n = (value) => Number(value ?? 0).toLocaleString();
|
|
@@ -2461,6 +2723,7 @@ const WIDGET_GUIDE = {
|
|
|
2461
2723
|
live: () => t('Copies on right now: a copy is on when it said so in the last ten minutes. Off are the ones used this month that are not on now. It reads again every minute.'),
|
|
2462
2724
|
installs: () => t('Installs, updates and uninstalls by day. An uninstall counts only when made from Settings; whoever simply stops using MADRE shows as off.'),
|
|
2463
2725
|
environments: () => t('Each copy once, by what it said last this month: its system, memory, agents, how many projects and which modules. Copies from before 1.1.0 say less.'),
|
|
2726
|
+
rumbo: () => t('The model of what decides MADRE\'s course: the funnel from a GitHub visit to using it on two days, with its leak in red; what the numbers say about product or reach, Windows, Pro, traction, English and failures; and every variable with how sure it is. It reads itself again on its own.'),
|
|
2464
2727
|
agenda: () => t('Your reminders from every project, by day. ✓ settles one, «Later» moves it, and the box below sets a new one as you would say it.'),
|
|
2465
2728
|
};
|
|
2466
2729
|
function guideWidget(node, kind) {
|
|
@@ -3090,6 +3353,47 @@ async function homeNews(tries = 0) {
|
|
|
3090
3353
|
void fetch('/api/whats-new/seen', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' }).catch(() => null);
|
|
3091
3354
|
}
|
|
3092
3355
|
|
|
3356
|
+
// THE INVITATION TO A FIRST PROJECT (2026-11-01): whoever updates MADRE and still has no project is
|
|
3357
|
+
// asked once per version, on Home, to add one. 90 of 147 copies never opened a project, and MADRE does
|
|
3358
|
+
// nothing without one. Two ways in, the folder they work in or the project to try (src/salas.mjs,
|
|
3359
|
+
// createSampleProject), which opens straight on its first messages; and «Not now». Never over the
|
|
3360
|
+
// news, the welcome or another window. What they choose is counted with the anonymous diagnostics.
|
|
3361
|
+
const tellInvite = (answer) => fetch('/api/invite/project', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ answer }) }).catch(() => null);
|
|
3362
|
+
async function homeInvite(tries = 0) {
|
|
3363
|
+
if (welcomeOpen() || document.querySelector('dialog[open]')) { if (tries < 120) setTimeout(() => void homeInvite(tries + 1), 3000); return; }
|
|
3364
|
+
const dialog = el('dialog', 'sm-sheet sm-invite');
|
|
3365
|
+
const inner = el('div', 'sm-sheet-body');
|
|
3366
|
+
const head = el('header', 'sm-sheet-head');
|
|
3367
|
+
let answered = false;
|
|
3368
|
+
const answer = (said) => { if (answered) return; answered = true; void tellInvite(said); };
|
|
3369
|
+
head.append(el('h3', null, t('Add your first project')), closeKey(() => dialog.close()));
|
|
3370
|
+
const lead = el('p', null, t('MADRE works inside a project: a folder with your store, your website or your documents. There your AIs read, remember what you decide and show you every change.'));
|
|
3371
|
+
const hint = el('p', 'hint', t('You have none yet. Choose a folder you already work in, or make one to try: a page with a list of tasks, to ask your AIs for changes without fear of breaking anything.'));
|
|
3372
|
+
const keys = el('div', 'sm-invite-keys');
|
|
3373
|
+
const later = button('sm-btn', t('Not now'), () => dialog.close());
|
|
3374
|
+
const sample = button('sm-btn', t('Make the project to try'), async () => {
|
|
3375
|
+
sample.disabled = true;
|
|
3376
|
+
answer('sample');
|
|
3377
|
+
const made = await fetch('/api/salas/new', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ sample: true, language }) })
|
|
3378
|
+
.then(async (response) => ({ ok: response.ok, body: await response.json().catch(() => ({})) })).catch(() => ({ ok: false, body: {} }));
|
|
3379
|
+
const room = made.ok ? made.body.added?.[0] : null;
|
|
3380
|
+
if (!room) { hint.textContent = made.body?.error ?? t('The project to try MADRE could not be made.'); sample.disabled = false; return; }
|
|
3381
|
+
dialog.close();
|
|
3382
|
+
await refresh();
|
|
3383
|
+
await startRoom(room, { enter: true });
|
|
3384
|
+
});
|
|
3385
|
+
const pick = button('sm-btn primary', t('Choose a folder'), () => { answer('picked'); dialog.close(); openAddSheet(); });
|
|
3386
|
+
keys.append(later, sample, pick);
|
|
3387
|
+
inner.append(head, wizardScene('projects'), lead, hint, keys);
|
|
3388
|
+
dialog.append(inner);
|
|
3389
|
+
dialog.addEventListener('close', () => { answer('later'); dialog.remove(); });
|
|
3390
|
+
document.body.append(dialog);
|
|
3391
|
+
dialog.showModal();
|
|
3392
|
+
bootDone();
|
|
3393
|
+
void tellInvite('shown');
|
|
3394
|
+
pick.focus({ preventScroll: true });
|
|
3395
|
+
}
|
|
3396
|
+
|
|
3093
3397
|
// Home in another language, without a reload: what it says now, and every widget and the tour's pill.
|
|
3094
3398
|
function sayIn(code) {
|
|
3095
3399
|
language = setLanguage(code);
|
|
@@ -4909,6 +5213,7 @@ const welcomeHost = {
|
|
|
4909
5213
|
chapters: () => homeTour.openChapters('home'),
|
|
4910
5214
|
saved: (welcome) => { welcomeSeen = welcome; drawAttention(); },
|
|
4911
5215
|
closed: () => { void loadAgents(); void refresh(); },
|
|
5216
|
+
refresh: () => refresh(),
|
|
4912
5217
|
};
|
|
4913
5218
|
function openHomeWelcome({ at = null, then = null } = {}) {
|
|
4914
5219
|
welcomed = true;
|
package/public/welcome.js
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
//
|
|
13
13
|
// The host page hands in what only it can do: `agentsPanel(options)` and `projectPicker(options)`
|
|
14
14
|
// (Home's own), `mark(id, size)`, `closeKey(onClick)`, `projects()`, `openProject(room)`,
|
|
15
|
-
// `setLanguage(code)`, `agentState(agent, answer)`, `openLinks()`, `openMarket()`, `saved(welcome)
|
|
16
|
-
// and `closed()`.
|
|
15
|
+
// `setLanguage(code)`, `agentState(agent, answer)`, `openLinks()`, `openMarket()`, `saved(welcome)`,
|
|
16
|
+
// `refresh()` (Home's projects read again) and `closed()`.
|
|
17
17
|
|
|
18
18
|
import { t, language } from './i18n.js';
|
|
19
19
|
import { platformOf, remedyKey } from './remedy.js';
|
|
@@ -43,7 +43,10 @@ const post = async (url, payload = {}) => {
|
|
|
43
43
|
const getJson = (url) => fetch(url, { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null)).catch(() => null);
|
|
44
44
|
const number = (value) => new Intl.NumberFormat(language(), { maximumFractionDigits: 1 }).format(value);
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
// The project comes right after the agents (2026-11-01): 90 of 147 copies never opened one, and
|
|
47
|
+
// the AI on the computer and the memory, heavy and optional, stood in front of it.
|
|
48
|
+
export const WELCOME_STEPS = ['hello', 'machine', 'agents', 'project', 'ai', 'memory', 'ready'];
|
|
49
|
+
const stepOf = (id) => WELCOME_STEPS.indexOf(id) + 1;
|
|
47
50
|
const STEP_NAMES = {
|
|
48
51
|
hello: () => t('Hello'), machine: () => t('Your computer'), agents: () => t('Your agents'), ai: () => t('AI on your computer'),
|
|
49
52
|
memory: () => t('Memory'), project: () => t('Your project'), ready: () => t('Ready'),
|
|
@@ -266,9 +269,9 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
266
269
|
const list = el('div', 'wl-card wl-checks');
|
|
267
270
|
for (const [title, sub] of [
|
|
268
271
|
[t('Your agents'), t('The AIs that work in your projects (Claude, Codex, Gemini…). We install and connect them here.')],
|
|
272
|
+
[t('Your first project'), t('A folder you work in. It is ready when we finish.')],
|
|
269
273
|
[t('AI on your computer'), t('If your computer can carry it, a free and private AI that works without internet.')],
|
|
270
274
|
[t('Memory'), t('So MADRE finds what it remembers even when you ask in other words.')],
|
|
271
|
-
[t('Your first project'), t('A folder you work in. It is ready when we finish.')],
|
|
272
275
|
]) {
|
|
273
276
|
const row = el('div', 'wl-check');
|
|
274
277
|
const tick = el('span', 'wl-tick');
|
|
@@ -310,7 +313,7 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
310
313
|
fact(t('Free space'), env.disk ? t('{n} GB free', { n: number(env.disk.freeGb) }) : null);
|
|
311
314
|
const notes = [];
|
|
312
315
|
const carry = canCarry();
|
|
313
|
-
if (carry === 'yes') notes.push(note('ok', t('Your computer can run its own AI. We recommend a model in step
|
|
316
|
+
if (carry === 'yes') notes.push(note('ok', t('Your computer can run its own AI. We recommend a model in step {n}.', { n: stepOf('ai') })));
|
|
314
317
|
else if (carry === 'slow') notes.push(note('warn', t('Your computer can run a small AI, but slowly: it has no graphics card the AI can use.')));
|
|
315
318
|
else notes.push(note('warn', t('This computer does not have enough memory for an AI of its own. MADRE works just the same with your agents.')));
|
|
316
319
|
if (env.place === 'wsl') notes.push(note('', t('MADRE runs here on Linux, inside Windows (WSL). Your Windows browser opens it directly.')));
|
|
@@ -320,7 +323,7 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
320
323
|
if (env.vm && env.vm !== 'macOS') notes.push(note('warn', t('MADRE runs in a virtual machine: an AI here runs slower than on the computer itself. If that computer runs Windows, MADRE works better in WSL.')));
|
|
321
324
|
if (env.place === 'ssh') notes.push(note('', t('You\'re connected from another computer. Some agents connect with a code instead of opening a page; each one says so.'), fix('ssh-tunnel')));
|
|
322
325
|
if (env.place === 'container') notes.push(note('', t('MADRE runs inside a container: what it installs stays in that container.')));
|
|
323
|
-
if (env.disk && env.disk.freeGb < 10) notes.push(note('warn', t('Only {n} GB free. Agents fit, but an AI of its own needs more room: free some up before step
|
|
326
|
+
if (env.disk && env.disk.freeGb < 10) notes.push(note('warn', t('Only {n} GB free. Agents fit, but an AI of its own needs more room: free some up before step {step}.', { n: number(env.disk.freeGb), step: stepOf('ai') })));
|
|
324
327
|
content.replaceChildren(...head(t('Here is what we found'), t('We use it to recommend what works best on your computer. It never leaves your computer.')), grid, ...notes);
|
|
325
328
|
footer();
|
|
326
329
|
}
|
|
@@ -360,7 +363,7 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
360
363
|
for (const node of actions.querySelectorAll('.wl-skipnote, [data-skip]')) node.hidden = Boolean(s.ready);
|
|
361
364
|
}
|
|
362
365
|
|
|
363
|
-
// ----
|
|
366
|
+
// ---- 5 · AI ON YOUR COMPUTER: install Ollama, download the model, try it — or use another
|
|
364
367
|
// computer's, or leave it for later.
|
|
365
368
|
function aiChoices() {
|
|
366
369
|
const env = s.env ?? {};
|
|
@@ -669,7 +672,7 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
669
672
|
return box;
|
|
670
673
|
}
|
|
671
674
|
|
|
672
|
-
// ----
|
|
675
|
+
// ---- 6 · MEMORY: search by meaning on this computer, with Gemini, or exact words.
|
|
673
676
|
let memoryBody = null;
|
|
674
677
|
function memoryStep() {
|
|
675
678
|
memoryBody = el('div', 'wl-memory');
|
|
@@ -697,7 +700,7 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
697
700
|
const pick = (value) => { s.memoryChoice = value; if (value === 'local' && !hasModel(EMBED_MODEL) && !s.pulls.get(EMBED_MODEL)?.running) void startPull(EMBED_MODEL); paintMemory(); };
|
|
698
701
|
const embedReady = hasModel(EMBED_MODEL);
|
|
699
702
|
const group = choices(t('Memory'),
|
|
700
|
-
choice('memory', 'local', s.memoryChoice, s.ollama?.host && !localHost(s.ollama.host) ? t('With your Ollama') : t('On your computer'), local ? (embedReady ? (s.ollama?.host && !localHost(s.ollama.host) ? t('With the Ollama of the other computer, on your network. Its memory model is already there. Free and private.') : t('With Ollama. Its memory model is already here. Free and private.')) : t('With Ollama. Downloads a memory model of {mb} MB. Free and private.', { mb: EMBED_MB })) : t('Needs the AI on your computer (step
|
|
703
|
+
choice('memory', 'local', s.memoryChoice, s.ollama?.host && !localHost(s.ollama.host) ? t('With your Ollama') : t('On your computer'), local ? (embedReady ? (s.ollama?.host && !localHost(s.ollama.host) ? t('With the Ollama of the other computer, on your network. Its memory model is already there. Free and private.') : t('With Ollama. Its memory model is already here. Free and private.')) : t('With Ollama. Downloads a memory model of {mb} MB. Free and private.', { mb: EMBED_MB })) : t('Needs the AI on your computer (step {n}).', { n: stepOf('ai') }), pick, { badge: local ? t('Recommended') : null, disabled: !local }),
|
|
701
704
|
choice('memory', 'gemini', s.memoryChoice, t('With Gemini'), s.geminiKey ? t('Uses your Gemini key, already on this computer. Paid per use, very little. What it searches is sent to Google.') : t('Needs your Gemini key: paste it in step 3, in Gemini.'), pick, { badge: !local && s.geminiKey ? t('Recommended') : null }),
|
|
702
705
|
choice('memory', 'off', s.memoryChoice, t('Exact words only'), t('Nothing extra. It finds what you ask for with the same words.'), pick),
|
|
703
706
|
);
|
|
@@ -727,7 +730,7 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
727
730
|
});
|
|
728
731
|
}
|
|
729
732
|
|
|
730
|
-
// ----
|
|
733
|
+
// ---- 4 · YOUR PROJECT: a new one or a folder that already is one.
|
|
731
734
|
function project() {
|
|
732
735
|
const had = host.projects?.() ?? [];
|
|
733
736
|
const lead = t('A project is a folder you work in: a store, a website, your documents. Each one has its own conversations and its own memory.');
|
|
@@ -749,6 +752,20 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
749
752
|
},
|
|
750
753
|
});
|
|
751
754
|
if (picker) parts.push(picker.node);
|
|
755
|
+
// No project at hand (2026-11-01): one made to try MADRE, a page with a list of tasks and a README
|
|
756
|
+
// with what to ask. «I do not know what I would do with MADRE» is answered by having something.
|
|
757
|
+
const sample = el('div', 'wl-card wl-sample');
|
|
758
|
+
const said = el('p', 'wl-muted', t('No project at hand? Make one to try: a page with a list of tasks, to ask your AIs for changes without fear of breaking anything.'));
|
|
759
|
+
const make = button('wl-btn small', t('Make the project to try'), async () => {
|
|
760
|
+
make.disabled = true;
|
|
761
|
+
const answer = await post('/api/salas/new', { sample: true, language: language() });
|
|
762
|
+
if (!answer.ok) { said.textContent = answer.body?.error ?? t('The project to try MADRE could not be made.'); make.disabled = false; return; }
|
|
763
|
+
s.added = [...s.added, ...(answer.body.added ?? [])];
|
|
764
|
+
await host.refresh?.();
|
|
765
|
+
if (stepId() === 'project') go(s.step + 1, 'done');
|
|
766
|
+
});
|
|
767
|
+
sample.append(said, make);
|
|
768
|
+
parts.push(sample);
|
|
752
769
|
content.replaceChildren(...parts);
|
|
753
770
|
footer({
|
|
754
771
|
nextOff: !had.length,
|
|
@@ -815,8 +832,19 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
815
832
|
}
|
|
816
833
|
content.replaceChildren(...head(t('MADRE is ready'), t('Here is what is ready. Anything you left for later has its button.')), summary, el('p', 'wl-eyebrow wl-gap', t('What comes next')), nextCards, trainCard);
|
|
817
834
|
const learn = button('wl-btn', t('Get to know MADRE'), () => { const after = then ?? host.chapters; finish(); after?.(); });
|
|
818
|
-
//
|
|
819
|
-
//
|
|
835
|
+
// Into the project when there is one and an agent to answer (2026-11-01): 90 of 147 copies never
|
|
836
|
+
// opened a project, and the welcome ended in Home with the Market and connections as what comes
|
|
837
|
+
// next. The project opens on its blank page, with three first messages to press. Without a
|
|
838
|
+
// project or an agent, Home as before (2026-10-30), whose first-time cards walk the person there.
|
|
839
|
+
if (room && connected.length) {
|
|
840
|
+
const home = button('wl-btn ghost', t('Go to Home'), () => finish());
|
|
841
|
+
footer({
|
|
842
|
+
next: t('Open {name} and write your first message', { name: room.name }),
|
|
843
|
+
onNext: () => { finish(); void host.openProject?.(room); },
|
|
844
|
+
extra: (() => { const keys = el('span', 'wl-keys'); keys.append(learn, home); return keys; })(),
|
|
845
|
+
});
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
820
848
|
footer({
|
|
821
849
|
next: t('Go to Home'),
|
|
822
850
|
onNext: () => finish(),
|
package/src/dataset.mjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { mkdir, readFile, readdir, rm, writeFile } from 'node:fs/promises';
|
|
11
11
|
import { join } from 'node:path';
|
|
12
12
|
import { redact } from './sentinel-errors.mjs';
|
|
13
|
-
import { ABERRATION, VERDICTS, NEGATIVE_VERDICTS, POSITIVE_VERDICTS } from './memory.mjs';
|
|
13
|
+
import { ABERRATION, VERDICTS, NEGATIVE_VERDICTS, POSITIVE_VERDICTS, travels } from './memory.mjs';
|
|
14
14
|
|
|
15
15
|
const MIN_ANSWER_CHARS = 40;
|
|
16
16
|
|
|
@@ -107,7 +107,9 @@ export function readiness(events, notes = [], { target = DATASET_TARGET } = {})
|
|
|
107
107
|
// below, where being wrong is the point.
|
|
108
108
|
export function pairsFromNotes(notes, { project = 'project', home, user, privacy = null } = {}) {
|
|
109
109
|
const clean = guard(privacy);
|
|
110
|
-
|
|
110
|
+
// Nor one the human quarantined or put out (2026-11-01, external review #14): the recall stopped
|
|
111
|
+
// handing it over, and training on it would teach the model what the room stopped believing.
|
|
112
|
+
return notes.filter((note) => note.kind !== ABERRATION && !note.refutedBy && (!note.zone || travels(note))).map((note) => ({
|
|
111
113
|
kind: 'note',
|
|
112
114
|
agent: 'madre',
|
|
113
115
|
mode: 1,
|
package/src/embeddings.mjs
CHANGED
|
@@ -76,7 +76,7 @@ async function geminiEmbed(texts, { key, model, dims, query, fetchImpl, timeoutM
|
|
|
76
76
|
export function createEmbedder({ key = null, env = process.env, fetchImpl = globalThis.fetch, timeoutMs = Number(env.PULSE_EMBED_TIMEOUT_MS ?? 8000), ollama = null, ollamaEmbedder: makeOllama = null } = {}) {
|
|
77
77
|
if (env.PULSE_EMBED === '0') return null;
|
|
78
78
|
if (env.PULSE_EMBED_FAKE === '1') {
|
|
79
|
-
return { model: 'fake-64', dims: 64, embed: async (texts) => texts.map((text) => fakeEmbedding(text)) };
|
|
79
|
+
return { model: 'fake-64', dims: 64, provider: 'fake', embed: async (texts) => texts.map((text) => fakeEmbedding(text)) };
|
|
80
80
|
}
|
|
81
81
|
const provider = env.PULSE_EMBED_PROVIDER ?? 'auto';
|
|
82
82
|
if (provider !== 'gemini' && ollama?.running && ollama.embedModel && makeOllama) return makeOllama({ host: ollama.host, model: ollama.embedModel, fetchImpl });
|
|
@@ -84,5 +84,5 @@ export function createEmbedder({ key = null, env = process.env, fetchImpl = glob
|
|
|
84
84
|
if (!key) return null;
|
|
85
85
|
const model = env.PULSE_EMBED_MODEL ?? DEFAULT_EMBED_MODEL;
|
|
86
86
|
const dims = Number(env.PULSE_EMBED_DIMS ?? DEFAULT_EMBED_DIMS);
|
|
87
|
-
return { model: `${model}@${dims}`, dims, embed: (texts, { query = false } = {}) => geminiEmbed(texts, { key, model, dims, query, fetchImpl, timeoutMs }) };
|
|
87
|
+
return { model: `${model}@${dims}`, dims, provider: 'gemini', embed: (texts, { query = false } = {}) => geminiEmbed(texts, { key, model, dims, query, fetchImpl, timeoutMs }) };
|
|
88
88
|
}
|
package/src/file-ops.mjs
CHANGED
|
@@ -32,7 +32,8 @@ export function needsDesignation(...paths) {
|
|
|
32
32
|
// words of a path are not its place. `src/../.git/config`, a link named `gitlink` that points at
|
|
33
33
|
// `.git`, `.ENV` on a disk that does not tell it from `.env` — each wrote into a guarded zone with
|
|
34
34
|
// no designation, because only the words were read. A path that does not exist yet is judged by
|
|
35
|
-
// the real folder it would land in
|
|
35
|
+
// the real folder it would land in: the nearest one that exists, however many are still to be
|
|
36
|
+
// made (2026-11-01, external review #60) — `gitlink/hooks/new/x` lands in .git/hooks.
|
|
36
37
|
export async function needsDesignationOnDisk(root, ...paths) {
|
|
37
38
|
if (needsDesignation(...paths)) return true;
|
|
38
39
|
const top = await realpath(root).catch(() => null);
|
|
@@ -40,8 +41,13 @@ export async function needsDesignationOnDisk(root, ...paths) {
|
|
|
40
41
|
for (const path of paths.filter(Boolean)) {
|
|
41
42
|
const wanted = resolve(top, String(path).replace(/^\/+/, ''));
|
|
42
43
|
const real = await realpath(wanted).catch(async () => {
|
|
43
|
-
const
|
|
44
|
-
|
|
44
|
+
const missing = [basename(wanted)];
|
|
45
|
+
for (let folder = dirname(wanted); ; folder = dirname(folder)) {
|
|
46
|
+
const found = await realpath(folder).catch(() => null);
|
|
47
|
+
if (found) return join(found, ...missing.reverse());
|
|
48
|
+
if (dirname(folder) === folder) return null;
|
|
49
|
+
missing.push(basename(folder));
|
|
50
|
+
}
|
|
45
51
|
});
|
|
46
52
|
if (!real || (real !== top && !real.startsWith(top + sep))) continue; // outside: the fence refuses it elsewhere
|
|
47
53
|
if (needsDesignation(relative(top, real).split(sep).join('/'))) return true;
|
package/src/github.mjs
CHANGED
|
@@ -229,14 +229,16 @@ export function parseIncluded(text) {
|
|
|
229
229
|
// already has installed — it notices that and does not count the request twice. Either way the
|
|
230
230
|
// line holds the method, the address, whether it went and how long it took. Never a body, never
|
|
231
231
|
// a header, never the credential.
|
|
232
|
-
|
|
232
|
+
// `accept` is for the few reads that come in another shape (the stargazers with the day each star
|
|
233
|
+
// was given, src/rumbo.mjs).
|
|
234
|
+
export async function githubRequest({ method = 'GET', path, body = null, auth, log = null, env = process.env, timeoutMs = 20000, accept = 'application/vnd.github+json' }) {
|
|
233
235
|
if (!auth) throw new GithubError('NO_CREDENTIAL', ERRORS.NO_SESSION);
|
|
234
236
|
if (!String(path ?? '').startsWith('/')) throw new GithubError('FAILED', ERRORS.FAILED);
|
|
235
237
|
const verb = String(method).toUpperCase();
|
|
236
238
|
const url = `${API}${path}`;
|
|
237
239
|
const started = Date.now();
|
|
238
240
|
if (auth.kind === 'gh') {
|
|
239
|
-
const args = ['api', '--method', verb, '--include', '-H',
|
|
241
|
+
const args = ['api', '--method', verb, '--include', '-H', `Accept: ${accept}`, '-H', 'X-GitHub-Api-Version: 2022-11-28', path.replace(/^\/+/, '')];
|
|
240
242
|
if (body != null) args.push('--input', '-');
|
|
241
243
|
// GH_HOST pinned: a session for an enterprise host in the environment must not take this
|
|
242
244
|
// request anywhere but the host the module declared.
|
|
@@ -259,7 +261,7 @@ export async function githubRequest({ method = 'GET', path, body = null, auth, l
|
|
|
259
261
|
response = await send(url, {
|
|
260
262
|
method: verb,
|
|
261
263
|
headers: {
|
|
262
|
-
accept
|
|
264
|
+
accept,
|
|
263
265
|
'x-github-api-version': '2022-11-28',
|
|
264
266
|
'user-agent': 'MADRE',
|
|
265
267
|
authorization: `Bearer ${auth.token}`,
|