@jossuealcala/madre 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADDITIONAL-TERMS.md +7 -2
- package/CHANGELOG.en.md +152 -1
- package/CHANGELOG.md +152 -1
- package/CONTRIBUTING.md +2 -2
- package/LICENSE +111 -661
- package/NOTICE +59 -24
- package/README.en.md +36 -204
- package/README.md +36 -210
- package/SECURITY.md +1 -0
- package/TRADEMARKS.en.md +13 -14
- package/TRADEMARKS.md +42 -26
- package/bin/madre.cjs +2 -2
- package/bin/madre.mjs +114 -42
- package/docs/REFERENCE.md +53 -6
- package/docs/SDK.md +44 -5
- package/docs/en/REFERENCE.md +53 -6
- package/docs/en/SDK.md +43 -4
- package/docs/madre-banner.png +0 -0
- package/docs/sdk/hello-module.mjs +3 -0
- package/package.json +3 -2
- package/public/abduction.js +6 -6
- package/public/activity.js +425 -0
- package/public/app.js +3519 -647
- package/public/assets/abduction-cat-blink.webp +0 -0
- package/public/assets/abduction-cat-control-left.webp +0 -0
- package/public/assets/abduction-cat-control-right.webp +0 -0
- package/public/assets/abduction-cat.webp +0 -0
- package/public/assets/manual/shots/en-agents.webp +0 -0
- package/public/assets/manual/shots/en-chats.webp +0 -0
- package/public/assets/manual/shots/en-code.webp +0 -0
- package/public/assets/manual/shots/en-composer.webp +0 -0
- package/public/assets/manual/shots/en-connectors.webp +0 -0
- package/public/assets/manual/shots/en-continuity.webp +0 -0
- package/public/assets/manual/shots/en-coordinator.webp +0 -0
- package/public/assets/manual/shots/en-copilot.webp +0 -0
- package/public/assets/manual/shots/en-diagnostics.webp +0 -0
- package/public/assets/manual/shots/en-home.webp +0 -0
- package/public/assets/manual/shots/en-local.webp +0 -0
- package/public/assets/manual/shots/en-market.webp +0 -0
- package/public/assets/manual/shots/en-memory.webp +0 -0
- package/public/assets/manual/shots/en-modes.webp +0 -0
- package/public/assets/manual/shots/en-notes.webp +0 -0
- package/public/assets/manual/shots/en-settings.webp +0 -0
- package/public/assets/manual/shots/en-welcome.webp +0 -0
- package/public/assets/manual/shots/en-windows.webp +0 -0
- package/public/assets/manual/shots/es-agents.webp +0 -0
- package/public/assets/manual/shots/es-chats.webp +0 -0
- package/public/assets/manual/shots/es-code.webp +0 -0
- package/public/assets/manual/shots/es-composer.webp +0 -0
- package/public/assets/manual/shots/es-connectors.webp +0 -0
- package/public/assets/manual/shots/es-continuity.webp +0 -0
- package/public/assets/manual/shots/es-coordinator.webp +0 -0
- package/public/assets/manual/shots/es-copilot.webp +0 -0
- package/public/assets/manual/shots/es-diagnostics.webp +0 -0
- package/public/assets/manual/shots/es-home.webp +0 -0
- package/public/assets/manual/shots/es-local.webp +0 -0
- package/public/assets/manual/shots/es-market.webp +0 -0
- package/public/assets/manual/shots/es-memory.webp +0 -0
- package/public/assets/manual/shots/es-modes.webp +0 -0
- package/public/assets/manual/shots/es-notes.webp +0 -0
- package/public/assets/manual/shots/es-settings.webp +0 -0
- package/public/assets/manual/shots/es-welcome.webp +0 -0
- package/public/assets/manual/shots/es-windows.webp +0 -0
- package/public/assets/news/1.1/en/chats.webp +0 -0
- package/public/assets/news/1.1/en/home.webp +0 -0
- package/public/assets/news/1.1/en/maps.webp +0 -0
- package/public/assets/news/1.1/en/market.webp +0 -0
- package/public/assets/news/1.1/en/permissions.webp +0 -0
- package/public/assets/news/1.1/en/privacy.webp +0 -0
- package/public/assets/news/1.1/en/welcome.webp +0 -0
- package/public/assets/news/1.1/es/chats.webp +0 -0
- package/public/assets/news/1.1/es/home.webp +0 -0
- package/public/assets/news/1.1/es/maps.webp +0 -0
- package/public/assets/news/1.1/es/market.webp +0 -0
- package/public/assets/news/1.1/es/permissions.webp +0 -0
- package/public/assets/news/1.1/es/privacy.webp +0 -0
- package/public/assets/news/1.1/es/welcome.webp +0 -0
- package/public/attribution.js +15 -16
- package/public/brands.js +2 -2
- package/public/code-tools.js +2 -2
- package/public/editor.js +13 -13
- package/public/en.js +483 -0
- package/public/es.js +1817 -598
- package/public/hardware.js +2 -2
- package/public/i18n.js +47 -9
- package/public/icons.js +158 -0
- package/public/index.html +68 -51
- package/public/inquiry.js +2 -2
- package/public/loader.js +271 -2
- package/public/macroverso.js +60 -21
- package/public/manual-content.js +900 -0
- package/public/manual-shots.js +47 -0
- package/public/manual.css +246 -0
- package/public/manual.html +15 -0
- package/public/manual.js +427 -0
- package/public/market-art.js +99 -41
- package/public/market-view.js +243 -47
- package/public/market.js +139 -26
- package/public/mcp-catalog.js +62 -0
- package/public/neural.js +64 -8
- package/public/nostromo-engine.js +709 -40
- package/public/page-errors.js +29 -0
- package/public/power.js +350 -11
- package/public/remedy.js +89 -0
- package/public/resay.js +4 -2
- package/public/review-ask.js +12 -7
- package/public/routing.js +3 -3
- package/public/salas-mac.css +875 -48
- package/public/salas-mac.html +27 -15
- package/public/salas-mac.js +1668 -338
- package/public/salas.css +2 -2
- package/public/salas.html +3 -3
- package/public/salas.js +3 -3
- package/public/styles.css +2694 -323
- package/public/syntax.js +2 -2
- package/public/terms.js +152 -0
- package/public/touch.js +2 -2
- package/public/tour-chapters.js +100 -92
- package/public/tour.js +118 -28
- package/public/troubleshooting.js +327 -21
- package/public/wallpaper.js +4 -3
- package/public/welcome.js +923 -0
- package/src/activity.mjs +85 -0
- package/src/adapters/claude.mjs +61 -35
- package/src/adapters/codex.mjs +18 -5
- package/src/adapters/cursor.mjs +60 -9
- package/src/adapters/gemini.mjs +17 -4
- package/src/adapters/madre.mjs +30 -9
- package/src/adapters/opencode.mjs +73 -10
- package/src/adapters/process.mjs +19 -15
- package/src/adapters/subagents.mjs +159 -0
- package/src/asking.mjs +8 -2
- package/src/auth-probe.mjs +47 -11
- package/src/bridge/devices.mjs +2 -2
- package/src/bridge/handoff.mjs +2 -2
- package/src/bridge/host.mjs +2 -2
- package/src/bridge/network.mjs +2 -2
- package/src/bridge/policy.mjs +3 -3
- package/src/bridge/qr.mjs +2 -2
- package/src/bridge/server.mjs +3 -3
- package/src/builtin-updates.mjs +87 -0
- package/src/capabilities.mjs +5 -5
- package/src/chats.mjs +51 -2
- package/src/checkpoint.mjs +67 -9
- package/src/choices.mjs +2 -2
- package/src/cli-args.mjs +2 -2
- package/src/cold.mjs +2 -2
- package/src/commands.mjs +2 -2
- package/src/config.mjs +2 -2
- package/src/conversation-context.mjs +2 -2
- package/src/credentials.mjs +80 -18
- package/src/dataset.mjs +2 -2
- package/src/directives.mjs +2 -2
- package/src/distiller.mjs +2 -2
- package/src/embeddings.mjs +2 -2
- package/src/enlaces.mjs +2 -2
- package/src/environment.mjs +147 -0
- package/src/event-store.mjs +2 -2
- package/src/exam.mjs +2 -2
- package/src/extensions.mjs +2 -2
- package/src/eyecat-watch.mjs +2 -2
- package/src/eyecat.mjs +2 -2
- package/src/file-ops.mjs +2 -2
- package/src/files.mjs +2 -2
- package/src/github.mjs +2 -2
- package/src/heartbeat.mjs +2 -2
- package/src/history.mjs +76 -0
- package/src/i18n.mjs +32 -3
- package/src/image-studio.mjs +2 -2
- package/src/install-metrics.mjs +109 -0
- package/src/json-file.mjs +2 -2
- package/src/launch.mjs +2 -2
- package/src/lease.mjs +15 -4
- package/src/lobby-work.mjs +11 -4
- package/src/local-ai.mjs +12 -4
- package/src/looks.mjs +19 -7
- package/src/market-check.mjs +165 -0
- package/src/market-key.mjs +10 -2
- package/src/market-license.mjs +104 -0
- package/src/market-remote.mjs +71 -13
- package/src/maturity.mjs +2 -2
- package/src/mcp/connect.mjs +2 -2
- package/src/mcp/github-server.mjs +2 -2
- package/src/mcp/image-server.mjs +2 -2
- package/src/mcp/memory-server.mjs +2 -2
- package/src/mcp/proxy.mjs +16 -5
- package/src/mcp/smtp-server.mjs +2 -2
- package/src/memory-dashboard.mjs +2 -2
- package/src/memory-tools.mjs +2 -2
- package/src/memory.mjs +2 -2
- package/src/models.mjs +115 -12
- package/src/module-scope.mjs +2 -2
- package/src/modules/ahp.mjs +2 -2
- package/src/modules/ash-policy.mjs +2 -2
- package/src/modules/ash.mjs +2 -2
- package/src/modules/bishop-exam.mjs +2 -2
- package/src/modules/bishop-plan.mjs +2 -2
- package/src/modules/bishop.mjs +9 -3
- package/src/modules/choices.mjs +2 -2
- package/src/modules/correo.mjs +2 -2
- package/src/modules/enlaces.mjs +2 -2
- package/src/modules/git-pulse.mjs +2 -2
- package/src/modules/github.mjs +2 -2
- package/src/modules/helpers.mjs +2 -2
- package/src/modules/image-studio.mjs +2 -2
- package/src/modules/index.mjs +92 -5
- package/src/modules/intents-calibration.mjs +2 -2
- package/src/modules/intents-desk.mjs +4 -3
- package/src/modules/intents-observe.mjs +2 -2
- package/src/modules/intents-policy.mjs +2 -2
- package/src/modules/intents-try.mjs +2 -2
- package/src/modules/intents.mjs +2 -2
- package/src/modules/local-models.mjs +41 -10
- package/src/modules/mcp-connect.mjs +2 -2
- package/src/modules/notes.mjs +281 -0
- package/src/modules/ollama.mjs +48 -13
- package/src/modules/playwright.mjs +16 -5
- package/src/modules/reminders.mjs +664 -0
- package/src/modules/ripley.mjs +3 -3
- package/src/modules/runs.mjs +2 -2
- package/src/modules/sdk.mjs +57 -9
- package/src/modules/updates.mjs +2 -2
- package/src/mother.mjs +13 -3
- package/src/npm-launch.mjs +2 -2
- package/src/ollama.mjs +8 -6
- package/src/opencode-health.mjs +83 -0
- package/src/outbound.mjs +35 -3
- package/src/override.mjs +27 -22
- package/src/ports.mjs +2 -2
- package/src/prices.mjs +2 -2
- package/src/privacy.mjs +2 -2
- package/src/quota-monitor.mjs +2 -2
- package/src/quota-sources.mjs +2 -2
- package/src/request-guard.mjs +2 -2
- package/src/review-ask.mjs +4 -3
- package/src/room/archivist.mjs +2 -2
- package/src/room/attachments.mjs +2 -2
- package/src/room/budget.mjs +2 -2
- package/src/room/context.mjs +2 -2
- package/src/room/control.mjs +2 -2
- package/src/room/copilot.mjs +2 -2
- package/src/room/economy.mjs +2 -2
- package/src/room/escalation.mjs +2 -2
- package/src/room/ghost.mjs +2 -2
- package/src/room/guard.mjs +6 -4
- package/src/room/prompt.mjs +3 -3
- package/src/room/returns.mjs +2 -2
- package/src/room/runs.mjs +6 -4
- package/src/room/vectors.mjs +2 -2
- package/src/room.mjs +144 -36
- package/src/router.mjs +2 -2
- package/src/runs.mjs +2 -2
- package/src/runtime-detection.mjs +36 -6
- package/src/salas.mjs +31 -6
- package/src/sentinel-errors.mjs +17 -7
- package/src/server-sentinel.mjs +2 -2
- package/src/server.mjs +980 -139
- package/src/setup-trouble.mjs +33 -0
- package/src/setup.mjs +4 -4
- package/src/smtp.mjs +2 -2
- package/src/telemetry.mjs +266 -0
- package/src/terms.mjs +43 -0
- package/src/tour.mjs +60 -7
- package/src/uninstall.mjs +225 -0
- package/src/updates.mjs +2 -2
- package/src/usage-sentinel.mjs +2 -2
- package/src/vault.mjs +2 -2
- package/src/verdict.mjs +13 -10
- package/src/whats-new.mjs +97 -3
- package/public/assets/abduction-cat-blink.png +0 -0
- package/public/assets/abduction-cat-control-left.png +0 -0
- package/public/assets/abduction-cat-control-right.png +0 -0
- package/public/assets/abduction-cat.png +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
// MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
|
|
3
|
+
// A failure of the page itself — a script that threw, a promise nobody caught — told to the MADRE
|
|
4
|
+
// that serves it (src/telemetry.mjs, /api/telemetry/page-error, 2026-10-28), which keeps it with the
|
|
5
|
+
// rest of its anonymous diagnostics. Once per message per page, a few at most, and nothing of what
|
|
6
|
+
// the person wrote: the error's own words and the lines of MADRE's code it went through.
|
|
7
|
+
export function tellFailures(page) {
|
|
8
|
+
// A page without a window to listen on (the tests read the page in Node) has nothing to tell.
|
|
9
|
+
if (typeof globalThis.window?.addEventListener !== 'function') return;
|
|
10
|
+
const told = new Set();
|
|
11
|
+
const tell = (message, stack) => {
|
|
12
|
+
const said = String(message ?? '').slice(0, 300);
|
|
13
|
+
// «Script error.» is a script of another site, a browser extension's: not MADRE's.
|
|
14
|
+
if (!said || said === 'Script error.' || told.has(said) || told.size >= 20) return;
|
|
15
|
+
if (/chrome-extension:|moz-extension:|safari-web-extension:/.test(String(stack ?? ''))) return;
|
|
16
|
+
told.add(said);
|
|
17
|
+
void fetch('/api/telemetry/page-error', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ page, message: said, stack: String(stack ?? '').slice(0, 4000) }) }).catch(() => null);
|
|
18
|
+
};
|
|
19
|
+
window.addEventListener('error', (event) => {
|
|
20
|
+
if (!event.message && !event.error) return;
|
|
21
|
+
tell(event.error?.message ?? event.message, event.error?.stack ?? `${event.filename ?? ''}:${event.lineno ?? 0}`);
|
|
22
|
+
});
|
|
23
|
+
window.addEventListener('unhandledrejection', (event) => {
|
|
24
|
+
const reason = event.reason;
|
|
25
|
+
// A fetch the network refused is the network's, not a fault of the page.
|
|
26
|
+
if (reason?.name === 'AbortError' || /Failed to fetch|NetworkError|Load failed/.test(String(reason?.message ?? reason))) return;
|
|
27
|
+
tell(reason?.message ?? String(reason), reason?.stack ?? '');
|
|
28
|
+
});
|
|
29
|
+
}
|
package/public/power.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
2
|
-
// MADRE · © 2026 Jossue Alcalá ·
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
// MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
|
|
3
3
|
// Turning MADRE off from the page (2026-10-16): one key in the top bar of Home and of every
|
|
4
4
|
// project, a question before anything happens, and then the server closes every open project and
|
|
5
5
|
// itself the clean way (src/server.mjs, /api/madre/shutdown). What is left on screen says MADRE is
|
|
6
6
|
// off, so a page that no longer answers is never mistaken for one that broke.
|
|
7
7
|
import { t } from './i18n.js';
|
|
8
|
+
import { trazo } from './icons.js';
|
|
8
9
|
|
|
9
|
-
export const POWER_ICON = '
|
|
10
|
+
export const POWER_ICON = trazo('power');
|
|
10
11
|
|
|
11
12
|
const node = (tag, className, text) => {
|
|
12
13
|
const made = document.createElement(tag);
|
|
@@ -15,18 +16,96 @@ const node = (tag, className, text) => {
|
|
|
15
16
|
return made;
|
|
16
17
|
};
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
export const RESTART_ICON = trazo('refresh');
|
|
20
|
+
const SLEEP_ICON = trazo('out');
|
|
21
|
+
|
|
22
|
+
// The key itself, in the classes of the bar it sits in. Since 2026-10-28 it holds restarting too: a
|
|
23
|
+
// press opens two choices, restart and turn off, and the bar has no reload key of its own.
|
|
24
|
+
// In a project (`project: true`) it also holds closing that project alone (2026-10-28): it sleeps, Home
|
|
25
|
+
// and the other projects stay. Not in the Coordinator, which lives in Home's own process.
|
|
26
|
+
export function powerKey(className, { project = false } = {}) {
|
|
20
27
|
const key = node('button', `${className} power-key`);
|
|
21
28
|
key.type = 'button';
|
|
22
29
|
key.innerHTML = POWER_ICON; // trusted: our own SVG string
|
|
23
30
|
labelPowerKey(key);
|
|
24
|
-
key.
|
|
31
|
+
key.setAttribute('aria-haspopup', 'menu');
|
|
32
|
+
key.addEventListener('click', () => openPowerMenu(key));
|
|
33
|
+
if (project) asProjectKey(key);
|
|
34
|
+
return key;
|
|
35
|
+
}
|
|
36
|
+
// A key that opens these choices in a project's page offers closing that project too.
|
|
37
|
+
export function asProjectKey(key) {
|
|
38
|
+
void whereAmI().then((place) => { if (place?.here && place.here.id !== place.home?.id) key.dataset.project = '1'; });
|
|
25
39
|
return key;
|
|
26
40
|
}
|
|
41
|
+
// This page's project and Home, as Home knows them (/api/salas): the address to go back to.
|
|
42
|
+
async function whereAmI() {
|
|
43
|
+
try {
|
|
44
|
+
const data = await fetch('/api/salas', { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null));
|
|
45
|
+
if (!data) return null;
|
|
46
|
+
return { here: (data.rooms ?? []).find((room) => room.here) ?? null, home: (data.rooms ?? []).find((room) => room.id === data.salas) ?? null };
|
|
47
|
+
} catch { return null; }
|
|
48
|
+
}
|
|
27
49
|
export function labelPowerKey(key) {
|
|
28
|
-
key.title = t('
|
|
29
|
-
key.setAttribute('aria-label', t('
|
|
50
|
+
key.title = t('Restart or turn off MADRE');
|
|
51
|
+
key.setAttribute('aria-label', t('Restart or turn off MADRE'));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// The two choices, beside the key that opened them: above it when the key is low on the screen (the
|
|
55
|
+
// sidebar's foot), under it when it is high (a bar). Escape, a press elsewhere or a choice closes them.
|
|
56
|
+
let powerMenu = null;
|
|
57
|
+
export function openPowerMenu(anchor) {
|
|
58
|
+
// A second press on the same key puts the choices away.
|
|
59
|
+
const was = powerMenu;
|
|
60
|
+
if (was) { was.close(); if (was.anchor === anchor) return; }
|
|
61
|
+
const card = node('div', 'power-menu');
|
|
62
|
+
card.setAttribute('role', 'menu');
|
|
63
|
+
card.setAttribute('aria-label', t('Restart or turn off MADRE'));
|
|
64
|
+
const close = () => {
|
|
65
|
+
card.remove();
|
|
66
|
+
document.removeEventListener('pointerdown', outside, true);
|
|
67
|
+
document.removeEventListener('keydown', keys, true);
|
|
68
|
+
anchor?.setAttribute?.('aria-expanded', 'false');
|
|
69
|
+
if (powerMenu?.card === card) powerMenu = null;
|
|
70
|
+
};
|
|
71
|
+
const item = (icon, words, about, run, danger = false) => {
|
|
72
|
+
const one = node('button', `power-item${danger ? ' danger' : ''}`);
|
|
73
|
+
one.type = 'button';
|
|
74
|
+
one.setAttribute('role', 'menuitem');
|
|
75
|
+
one.innerHTML = icon; // trusted: our own SVG strings
|
|
76
|
+
const said = node('span', 'power-words');
|
|
77
|
+
said.append(node('b', null, words), node('small', null, about));
|
|
78
|
+
one.append(said);
|
|
79
|
+
one.addEventListener('click', () => { close(); run(); });
|
|
80
|
+
return one;
|
|
81
|
+
};
|
|
82
|
+
const items = [
|
|
83
|
+
...(anchor?.dataset?.project === '1' ? [item(SLEEP_ICON, t('Close this project'), t('It sleeps; Home and your other projects stay open'), () => void askCloseProject())] : []),
|
|
84
|
+
item(RESTART_ICON, t('Restart MADRE'), t('Home and every open project start again'), () => void askRestart()),
|
|
85
|
+
item(POWER_ICON, t('Turn MADRE off'), t('Home and every open project close'), () => void askPowerOff(), true),
|
|
86
|
+
];
|
|
87
|
+
card.append(...items);
|
|
88
|
+
document.body.append(card);
|
|
89
|
+
const at = anchor.getBoundingClientRect();
|
|
90
|
+
const box = card.getBoundingClientRect();
|
|
91
|
+
const low = at.top > window.innerHeight / 2;
|
|
92
|
+
const top = low ? at.top - box.height - 6 : at.bottom + 6;
|
|
93
|
+
const left = Math.max(8, Math.min(window.innerWidth - box.width - 8, at.left + at.width / 2 > window.innerWidth / 2 ? at.right - box.width : at.left));
|
|
94
|
+
card.style.top = `${Math.round(Math.max(8, top))}px`;
|
|
95
|
+
card.style.left = `${Math.round(left)}px`;
|
|
96
|
+
const outside = (event) => { if (!card.contains(event.target) && !anchor.contains(event.target)) close(); };
|
|
97
|
+
const keys = (event) => {
|
|
98
|
+
if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); close(); anchor.focus?.(); return; }
|
|
99
|
+
if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') return;
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
const at = items.indexOf(document.activeElement);
|
|
102
|
+
items[(at + (event.key === 'ArrowDown' ? 1 : items.length - 1)) % items.length]?.focus();
|
|
103
|
+
};
|
|
104
|
+
document.addEventListener('pointerdown', outside, true);
|
|
105
|
+
document.addEventListener('keydown', keys, true);
|
|
106
|
+
anchor.setAttribute?.('aria-expanded', 'true');
|
|
107
|
+
powerMenu = { card, anchor, close };
|
|
108
|
+
items[0]?.focus();
|
|
30
109
|
}
|
|
31
110
|
|
|
32
111
|
// How many projects are open besides this page, to say what closes.
|
|
@@ -47,7 +126,7 @@ export async function askPowerOff() {
|
|
|
47
126
|
icon.innerHTML = POWER_ICON; // trusted: our own SVG string
|
|
48
127
|
const title = node('h2', 'room-ask-title', t('Turn MADRE off?'));
|
|
49
128
|
title.id = 'power-ask-title';
|
|
50
|
-
const what = open === null ? t('Home and every open project close.') : open === 1 ? t('Home and the one open project close.') : t('Home and the {n} open projects close.', { n: open });
|
|
129
|
+
const what = open === null ? t('Home and every open project close.') : open === 0 ? t('Home closes.') : open === 1 ? t('Home and the one open project close.') : t('Home and the {n} open projects close.', { n: open });
|
|
51
130
|
const body = node('p', 'room-ask-body', `${what} ${t('If an agent is working, it stops and the conversation says so; everything else is kept as it is.')}`);
|
|
52
131
|
const again = node('p', 'key-safe', t('To use it again, open MADRE the way you always do. Your projects, conversations and settings will be there.'));
|
|
53
132
|
const reply = node('p', 'key-reply');
|
|
@@ -72,9 +151,9 @@ export async function askPowerOff() {
|
|
|
72
151
|
try {
|
|
73
152
|
const response = await fetch('/api/madre/shutdown', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' });
|
|
74
153
|
answer = await response.json().catch(() => ({}));
|
|
75
|
-
if (!response.ok) throw new Error(answer.error
|
|
154
|
+
if (!response.ok) throw new Error(answer.error ? t(answer.error) : t('MADRE did not answer. Check that it is still open.'));
|
|
76
155
|
} catch (error) {
|
|
77
|
-
reply.textContent = error.message;
|
|
156
|
+
reply.textContent = error.name === 'TypeError' ? t('MADRE did not answer. Check that it is still open.') : error.message;
|
|
78
157
|
go.disabled = false;
|
|
79
158
|
cancel.disabled = false;
|
|
80
159
|
go.textContent = t('Turn off');
|
|
@@ -87,6 +166,80 @@ export async function askPowerOff() {
|
|
|
87
166
|
cancel.focus();
|
|
88
167
|
}
|
|
89
168
|
|
|
169
|
+
// RESTARTING MADRE (2026-10-28): the same question, then the server — Home and every open project —
|
|
170
|
+
// closes and comes back on the same addresses (src/server.mjs, /api/madre/restart). The page says
|
|
171
|
+
// so while it waits, and loads again by itself the moment MADRE answers.
|
|
172
|
+
export async function askRestart() {
|
|
173
|
+
if (document.querySelector('dialog.power-ask')) return;
|
|
174
|
+
const open = await openProjects();
|
|
175
|
+
const dialog = node('dialog', 'room-ask power-ask');
|
|
176
|
+
dialog.setAttribute('aria-labelledby', 'restart-ask-title');
|
|
177
|
+
const card = node('div', 'room-ask-card');
|
|
178
|
+
const icon = node('span', 'room-ask-icon');
|
|
179
|
+
icon.innerHTML = RESTART_ICON; // trusted: our own SVG string
|
|
180
|
+
const title = node('h2', 'room-ask-title', t('Restart MADRE?'));
|
|
181
|
+
title.id = 'restart-ask-title';
|
|
182
|
+
const what = open === null ? t('Home and every open project close and open again.') : open === 0 ? t('Home closes and opens again.') : open === 1 ? t('Home and the one open project close and open again.') : t('Home and the {n} open projects close and open again.', { n: open });
|
|
183
|
+
const body = node('p', 'room-ask-body', `${what} ${t('If an agent is working, it stops and the conversation says so; everything else is kept as it is.')}`);
|
|
184
|
+
const again = node('p', 'key-safe', t('It takes a few seconds. Every page you have open comes back on its own.'));
|
|
185
|
+
const reply = node('p', 'key-reply');
|
|
186
|
+
reply.setAttribute('aria-live', 'polite');
|
|
187
|
+
const actions = node('div', 'room-ask-actions');
|
|
188
|
+
const cancel = node('button', 'room-ask-choice', t('Cancel'));
|
|
189
|
+
cancel.type = 'button';
|
|
190
|
+
const go = node('button', 'room-ask-choice primary', t('Restart'));
|
|
191
|
+
go.type = 'button';
|
|
192
|
+
actions.append(cancel, go);
|
|
193
|
+
card.append(icon, title, body, again, reply, actions);
|
|
194
|
+
dialog.append(card);
|
|
195
|
+
document.body.append(dialog);
|
|
196
|
+
dialog.addEventListener('close', () => dialog.remove());
|
|
197
|
+
cancel.addEventListener('click', () => dialog.close());
|
|
198
|
+
go.addEventListener('click', async () => {
|
|
199
|
+
go.disabled = true;
|
|
200
|
+
cancel.disabled = true;
|
|
201
|
+
go.textContent = t('Restarting…');
|
|
202
|
+
reply.textContent = '';
|
|
203
|
+
try {
|
|
204
|
+
const response = await fetch('/api/madre/restart', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' });
|
|
205
|
+
const answer = await response.json().catch(() => ({}));
|
|
206
|
+
if (!response.ok) throw new Error(answer.error ? t(answer.error) : t('MADRE did not answer. Check that it is still open.'));
|
|
207
|
+
} catch (error) {
|
|
208
|
+
reply.textContent = error.name === 'TypeError' ? t('MADRE did not answer. Check that it is still open.') : error.message;
|
|
209
|
+
go.disabled = false;
|
|
210
|
+
cancel.disabled = false;
|
|
211
|
+
go.textContent = t('Restart');
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
dialog.close();
|
|
215
|
+
await waitForRestart();
|
|
216
|
+
});
|
|
217
|
+
dialog.showModal();
|
|
218
|
+
go.focus();
|
|
219
|
+
}
|
|
220
|
+
// While MADRE is away: a screen that says so, until this page's own server answers again — first
|
|
221
|
+
// gone, then back — and the page loads. A minute at most; after it, the screen says what to do.
|
|
222
|
+
async function waitForRestart() {
|
|
223
|
+
const screen = node('div', 'madre-off madre-restarting');
|
|
224
|
+
screen.setAttribute('role', 'status');
|
|
225
|
+
const mark = node('span', 'madre-off-mark');
|
|
226
|
+
mark.innerHTML = RESTART_ICON; // trusted: our own SVG string
|
|
227
|
+
const said = node('p', null, t('Home and your projects close and open again on the same addresses.'));
|
|
228
|
+
screen.append(mark, node('h1', null, t('Restarting MADRE…')), said);
|
|
229
|
+
document.body.append(screen);
|
|
230
|
+
document.documentElement.classList.add('madre-is-off');
|
|
231
|
+
const answers = () => fetch(`/api/version?ts=${Date.now()}`, { cache: 'no-store', signal: AbortSignal.timeout(1500) }).then((response) => response.ok).catch(() => false);
|
|
232
|
+
const until = Date.now() + 60000;
|
|
233
|
+
let gone = false;
|
|
234
|
+
while (Date.now() < until) {
|
|
235
|
+
await new Promise((resolve) => setTimeout(resolve, 600));
|
|
236
|
+
const up = await answers();
|
|
237
|
+
if (!up) gone = true;
|
|
238
|
+
else if (gone) { location.reload(); return; }
|
|
239
|
+
}
|
|
240
|
+
said.textContent = t('MADRE is taking longer than usual. Open it the way you always do; your projects, conversations and settings are there.');
|
|
241
|
+
}
|
|
242
|
+
|
|
90
243
|
// What stays on screen once MADRE is off.
|
|
91
244
|
function showOff(stuck) {
|
|
92
245
|
const screen = node('div', 'madre-off');
|
|
@@ -98,3 +251,189 @@ function showOff(stuck) {
|
|
|
98
251
|
document.body.append(screen);
|
|
99
252
|
document.documentElement.classList.add('madre-is-off');
|
|
100
253
|
}
|
|
254
|
+
|
|
255
|
+
// Closing this project alone (2026-10-28): it sleeps the way Home's «Close» puts it to sleep — what
|
|
256
|
+
// runs stops, its memory is put away — and the page goes back to Home. Home and the other projects
|
|
257
|
+
// are not touched. If Home is not open, the page says how to come back.
|
|
258
|
+
export async function askCloseProject() {
|
|
259
|
+
if (document.querySelector('dialog.power-ask')) return;
|
|
260
|
+
const place = await whereAmI();
|
|
261
|
+
const name = place?.here?.name ?? '';
|
|
262
|
+
const dialog = node('dialog', 'room-ask power-ask');
|
|
263
|
+
dialog.setAttribute('aria-labelledby', 'close-project-title');
|
|
264
|
+
const card = node('div', 'room-ask-card');
|
|
265
|
+
const icon = node('span', 'room-ask-icon');
|
|
266
|
+
icon.innerHTML = SLEEP_ICON; // trusted: our own SVG string
|
|
267
|
+
const title = node('h2', 'room-ask-title', name ? t('Close «{name}»?', { name }) : t('Close this project?'));
|
|
268
|
+
title.id = 'close-project-title';
|
|
269
|
+
const body = node('p', 'room-ask-body', t('Only this project sleeps: Home and your other projects stay open. If an agent is working, it stops and the conversation says so.'));
|
|
270
|
+
const again = node('p', 'key-safe', t('You open it again from Home, as it was.'));
|
|
271
|
+
const reply = node('p', 'key-reply');
|
|
272
|
+
reply.setAttribute('aria-live', 'polite');
|
|
273
|
+
const actions = node('div', 'room-ask-actions');
|
|
274
|
+
const cancel = node('button', 'room-ask-choice', t('Cancel'));
|
|
275
|
+
cancel.type = 'button';
|
|
276
|
+
const go = node('button', 'room-ask-choice primary', t('Close'));
|
|
277
|
+
go.type = 'button';
|
|
278
|
+
actions.append(cancel, go);
|
|
279
|
+
card.append(icon, title, body, again, reply, actions);
|
|
280
|
+
dialog.append(card);
|
|
281
|
+
document.body.append(dialog);
|
|
282
|
+
dialog.addEventListener('close', () => dialog.remove());
|
|
283
|
+
cancel.addEventListener('click', () => dialog.close());
|
|
284
|
+
go.addEventListener('click', async () => {
|
|
285
|
+
go.disabled = true;
|
|
286
|
+
cancel.disabled = true;
|
|
287
|
+
go.textContent = t('Closing…');
|
|
288
|
+
try {
|
|
289
|
+
const response = await fetch('/api/room/close', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' });
|
|
290
|
+
if (!response.ok) throw new Error(t('MADRE did not answer. Check that it is still open.'));
|
|
291
|
+
} catch (error) {
|
|
292
|
+
reply.textContent = error.name === 'TypeError' ? t('MADRE did not answer. Check that it is still open.') : error.message;
|
|
293
|
+
go.disabled = false;
|
|
294
|
+
cancel.disabled = false;
|
|
295
|
+
go.textContent = t('Close');
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
dialog.close();
|
|
299
|
+
const port = place?.home?.open?.port;
|
|
300
|
+
if (port) { location.href = `${location.protocol}//${location.hostname}:${port}/salas`; return; }
|
|
301
|
+
const screen = node('div', 'madre-off');
|
|
302
|
+
screen.setAttribute('role', 'status');
|
|
303
|
+
const mark = node('span', 'madre-off-mark');
|
|
304
|
+
mark.innerHTML = SLEEP_ICON; // trusted: our own SVG string
|
|
305
|
+
screen.append(mark, node('h1', null, name ? t('«{name}» is asleep', { name }) : t('This project is asleep')), node('p', null, t('Open MADRE the way you always do to come back to Home.')));
|
|
306
|
+
document.body.append(screen);
|
|
307
|
+
document.documentElement.classList.add('madre-is-off');
|
|
308
|
+
});
|
|
309
|
+
dialog.showModal();
|
|
310
|
+
go.focus();
|
|
311
|
+
}
|
|
312
|
+
// UNINSTALLING MADRE (2026-10-29), from Home's Settings: first what goes and what stays, as the server
|
|
313
|
+
// would do it (src/uninstall.mjs, GET /api/madre/uninstall); then, on a yes, Home and every open
|
|
314
|
+
// project close and MADRE takes away what it put on this computer. What is left on screen says it
|
|
315
|
+
// is done, and what is still the person's to do: npm's command, when npm installed it.
|
|
316
|
+
const TRASH_ICON = trazo('trash');
|
|
317
|
+
const filesSaid = (n) => (n === 1 ? t('1 file') : t('{n} files', { n }));
|
|
318
|
+
export async function askUninstall() {
|
|
319
|
+
if (document.querySelector('dialog.power-ask')) return;
|
|
320
|
+
let plan = null;
|
|
321
|
+
try {
|
|
322
|
+
const response = await fetch('/api/madre/uninstall', { cache: 'no-store' });
|
|
323
|
+
plan = await response.json().catch(() => null);
|
|
324
|
+
if (!response.ok) throw new Error(plan?.error ? t(plan.error) : t('MADRE did not answer. Check that it is still open.'));
|
|
325
|
+
} catch (error) {
|
|
326
|
+
plan = { ok: false, error: error.name === 'TypeError' ? t('MADRE did not answer. Check that it is still open.') : error.message };
|
|
327
|
+
}
|
|
328
|
+
const dialog = node('dialog', 'room-ask power-ask uninstall-ask');
|
|
329
|
+
dialog.setAttribute('aria-labelledby', 'uninstall-ask-title');
|
|
330
|
+
const card = node('div', 'room-ask-card');
|
|
331
|
+
const icon = node('span', 'room-ask-icon');
|
|
332
|
+
icon.innerHTML = TRASH_ICON; // trusted: our own SVG string
|
|
333
|
+
const title = node('h2', 'room-ask-title', t('Uninstall MADRE?'));
|
|
334
|
+
title.id = 'uninstall-ask-title';
|
|
335
|
+
const body = node('p', 'room-ask-body', t('Home and every open project close, and MADRE takes away what it put on this computer. It cannot be undone.'));
|
|
336
|
+
const list = (heading, items) => {
|
|
337
|
+
const box = node('div', 'uninstall-part');
|
|
338
|
+
const ul = node('ul', 'uninstall-list');
|
|
339
|
+
for (const item of items) ul.append(node('li', null, item));
|
|
340
|
+
box.append(node('b', null, heading), ul);
|
|
341
|
+
return box;
|
|
342
|
+
};
|
|
343
|
+
const reply = node('p', 'key-reply');
|
|
344
|
+
reply.setAttribute('aria-live', 'polite');
|
|
345
|
+
const actions = node('div', 'room-ask-actions');
|
|
346
|
+
const cancel = node('button', 'room-ask-choice', t('Cancel'));
|
|
347
|
+
cancel.type = 'button';
|
|
348
|
+
const go = node('button', 'room-ask-choice danger', t('Uninstall'));
|
|
349
|
+
go.type = 'button';
|
|
350
|
+
actions.append(cancel, go);
|
|
351
|
+
card.append(icon, title, body);
|
|
352
|
+
let made = null;
|
|
353
|
+
if (plan?.ok) {
|
|
354
|
+
const names = plan.projects.map((one) => one.name);
|
|
355
|
+
const goes = [t('Your conversations, memory and settings in MADRE ({path})', { path: plan.stateRoot })];
|
|
356
|
+
if (names.length) goes.push(t('MADRE\'s folder inside your projects (.pulse) and their restore points: {list}', { list: names.join(', ') }));
|
|
357
|
+
// The restore points kept inside a project's own git, .env included (QA 1.1.0, ACT-03).
|
|
358
|
+
if (plan.restorePoints) goes.push(t('The restore points MADRE kept inside the projects\' git ({n}), without touching your history or your branches', { n: plan.restorePoints }));
|
|
359
|
+
if (plan.tools.length) goes.push(t('The AIs MADRE installed in its own folder: {list}', { list: plan.tools.join(', ') }));
|
|
360
|
+
if (plan.npx) goes.push(t('The copy of MADRE that npx downloaded'));
|
|
361
|
+
// Said apart when MADRE installed the AIs itself: «your AIs stay» beside «the AIs go» read as a
|
|
362
|
+
// contradiction to whoever installed all of them from MADRE (NUE-33).
|
|
363
|
+
const stays = [t('Your projects and their files'), plan.tools.length
|
|
364
|
+
? t('The sign-ins of your AIs (installed again, they are still connected), the AIs you installed yourself, and Ollama with its models')
|
|
365
|
+
: t('Your AIs and their sign-ins, and Ollama with its models')];
|
|
366
|
+
if (plan.made) stays.push(t('What the AIs created in your projects (.pulse/out, {files}), unless you tick the box below', { files: filesSaid(plan.made) }));
|
|
367
|
+
if (plan.modules.length) stays.push(t('The modules you wrote inside a project (.madre): {list}', { list: plan.modules.join(', ') }));
|
|
368
|
+
if (plan.program.command) stays.push(t('MADRE itself: npm takes it away with the command you will see at the end'));
|
|
369
|
+
if (plan.program.install === 'source') stays.push(t('MADRE\'s source folder: {folder}', { folder: plan.program.folder ?? '' }));
|
|
370
|
+
card.append(list(t('What goes'), goes), list(t('What stays'), stays));
|
|
371
|
+
if (plan.made) {
|
|
372
|
+
const label = node('label', 'uninstall-made');
|
|
373
|
+
made = node('input');
|
|
374
|
+
made.type = 'checkbox';
|
|
375
|
+
label.append(made, node('span', null, t('Also delete what the AIs created in .pulse/out ({files})', { files: filesSaid(plan.made) })));
|
|
376
|
+
card.append(label);
|
|
377
|
+
}
|
|
378
|
+
} else {
|
|
379
|
+
reply.textContent = plan?.error ?? t('MADRE did not answer. Check that it is still open.');
|
|
380
|
+
go.disabled = true;
|
|
381
|
+
}
|
|
382
|
+
card.append(reply, actions);
|
|
383
|
+
dialog.append(card);
|
|
384
|
+
document.body.append(dialog);
|
|
385
|
+
dialog.addEventListener('close', () => dialog.remove());
|
|
386
|
+
cancel.addEventListener('click', () => dialog.close());
|
|
387
|
+
go.addEventListener('click', async () => {
|
|
388
|
+
go.disabled = true;
|
|
389
|
+
cancel.disabled = true;
|
|
390
|
+
if (made) made.disabled = true;
|
|
391
|
+
go.textContent = t('Uninstalling…');
|
|
392
|
+
reply.textContent = '';
|
|
393
|
+
let answer = null;
|
|
394
|
+
try {
|
|
395
|
+
const response = await fetch('/api/madre/uninstall', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ made: Boolean(made?.checked) }) });
|
|
396
|
+
answer = await response.json().catch(() => ({}));
|
|
397
|
+
if (!response.ok) throw new Error(answer.error ? t(answer.error) : t('MADRE did not answer. Check that it is still open.'));
|
|
398
|
+
} catch (error) {
|
|
399
|
+
reply.textContent = error.name === 'TypeError' ? t('MADRE did not answer. Check that it is still open.') : error.message;
|
|
400
|
+
go.disabled = false;
|
|
401
|
+
cancel.disabled = false;
|
|
402
|
+
if (made) made.disabled = false;
|
|
403
|
+
go.textContent = t('Uninstall');
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
dialog.close();
|
|
407
|
+
showUninstalled(answer);
|
|
408
|
+
});
|
|
409
|
+
dialog.showModal();
|
|
410
|
+
cancel.focus();
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// What stays on screen once MADRE is gone: done, and what is still the person's to do.
|
|
414
|
+
function showUninstalled(plan) {
|
|
415
|
+
const screen = node('div', 'madre-off madre-gone');
|
|
416
|
+
screen.setAttribute('role', 'status');
|
|
417
|
+
const mark = node('span', 'madre-off-mark');
|
|
418
|
+
mark.innerHTML = TRASH_ICON; // trusted: our own SVG string
|
|
419
|
+
screen.append(mark, node('h1', null, t('MADRE was uninstalled')), node('p', null, t('You can close this tab. Your projects are where they were.')));
|
|
420
|
+
if (plan?.made && !plan.madeGo) screen.append(node('p', null, t('What the AIs created is still in each project, in .pulse/out.')));
|
|
421
|
+
if (plan?.program?.command) {
|
|
422
|
+
screen.append(node('p', null, t('To take the program away as well, type this in your Terminal:')));
|
|
423
|
+
const line = node('div', 'madre-gone-command');
|
|
424
|
+
const code = node('code', null, plan.program.command);
|
|
425
|
+
const copy = node('button', 'room-ask-choice', t('Copy'));
|
|
426
|
+
copy.type = 'button';
|
|
427
|
+
copy.addEventListener('click', async () => {
|
|
428
|
+
try { await navigator.clipboard.writeText(plan.program.command); copy.textContent = t('Copied'); } catch { copy.textContent = t('Select it and copy it.'); }
|
|
429
|
+
});
|
|
430
|
+
line.append(code, copy);
|
|
431
|
+
screen.append(line);
|
|
432
|
+
} else if (plan?.program?.install === 'source') {
|
|
433
|
+
screen.append(node('p', null, t('This copy runs from its source folder; delete it yourself if you no longer want it: {folder}', { folder: plan.program.folder ?? '' })));
|
|
434
|
+
} else {
|
|
435
|
+
screen.append(node('p', null, t('If you ever want it back: npx @jossuealcala/madre')));
|
|
436
|
+
}
|
|
437
|
+
document.body.append(screen);
|
|
438
|
+
document.documentElement.classList.add('madre-is-off');
|
|
439
|
+
}
|
package/public/remedy.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
// MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
|
|
3
|
+
// «See how to fix it» (2026-10-28, docs/private/BIENVENIDA-1.0.6.md, F7): one card of Diagnostics
|
|
4
|
+
// (public/troubleshooting.js), opened over the place where something went wrong — the welcome, or
|
|
5
|
+
// an agent's card in Home. Diagnostics lives inside each project, and a person who is setting MADRE
|
|
6
|
+
// up has none open yet; so the same card, from the same catalogue, is read here: what to do, the
|
|
7
|
+
// commands for the system MADRE runs on (macOS, Linux, WSL, Windows), and why it happens, folded.
|
|
8
|
+
|
|
9
|
+
import { t } from './i18n.js';
|
|
10
|
+
import { PLATFORMS, allConditions, fixesFor } from './troubleshooting.js';
|
|
11
|
+
|
|
12
|
+
const el = (tag, className = null, text = null) => {
|
|
13
|
+
const node = document.createElement(tag);
|
|
14
|
+
if (className) node.className = className;
|
|
15
|
+
if (text !== null && text !== undefined) node.textContent = text;
|
|
16
|
+
return node;
|
|
17
|
+
};
|
|
18
|
+
const button = (className, text, onClick) => {
|
|
19
|
+
const node = el('button', className, text);
|
|
20
|
+
node.type = 'button';
|
|
21
|
+
if (onClick) node.addEventListener('click', onClick);
|
|
22
|
+
return node;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// The column of commands for where MADRE runs, as src/environment.mjs says it.
|
|
26
|
+
export function platformOf(environment) {
|
|
27
|
+
if (environment?.wsl) return 'wsl';
|
|
28
|
+
if (environment?.os === 'windows' || environment?.platform === 'win32') return 'win32';
|
|
29
|
+
return PLATFORMS[environment?.platform] ? environment.platform : 'darwin';
|
|
30
|
+
}
|
|
31
|
+
let asked = null;
|
|
32
|
+
const platformHere = () => (asked ??= fetch('/api/environment', { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null)).then((answer) => platformOf(answer?.environment), () => 'darwin'));
|
|
33
|
+
|
|
34
|
+
// The key that opens it, beside what went wrong.
|
|
35
|
+
export function remedyKey(id, options = {}) {
|
|
36
|
+
const key = button('wl-btn ghost small wl-remedy-key', t('See how to fix it'), () => void openRemedy(id, options));
|
|
37
|
+
key.dataset.remedy = id;
|
|
38
|
+
return key;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function openRemedy(id, { platform = null } = {}) {
|
|
42
|
+
const condition = allConditions().find((one) => one.id === id);
|
|
43
|
+
if (!condition) return null;
|
|
44
|
+
let system = platform ?? await platformHere();
|
|
45
|
+
const dialog = el('dialog', 'wl wl-remedy');
|
|
46
|
+
dialog.setAttribute('aria-label', condition.title);
|
|
47
|
+
const box = el('div', 'wl-remedy-box');
|
|
48
|
+
const close = button('wl-btn ghost small wl-remedy-close', t('Close'), () => dialog.close());
|
|
49
|
+
const head = el('div', 'wl-remedy-head');
|
|
50
|
+
head.append(el('p', 'wl-eyebrow', `${condition.code} · ${t('Diagnostics')}`), close);
|
|
51
|
+
box.append(head, el('h2', 'wl-title', condition.title), el('p', 'wl-lead', condition.remedy));
|
|
52
|
+
const terminal = el('div', 'wl-card wl-remedy-terminal');
|
|
53
|
+
const paint = () => {
|
|
54
|
+
const seg = el('div', 'wl-seg');
|
|
55
|
+
seg.setAttribute('role', 'radiogroup');
|
|
56
|
+
seg.setAttribute('aria-label', t('Operating system'));
|
|
57
|
+
for (const [value, meta] of Object.entries(PLATFORMS)) {
|
|
58
|
+
const option = button(null, meta.label, () => { system = value; paint(); });
|
|
59
|
+
option.setAttribute('role', 'radio');
|
|
60
|
+
option.setAttribute('aria-checked', String(value === system));
|
|
61
|
+
seg.append(option);
|
|
62
|
+
}
|
|
63
|
+
const lines = fixesFor(condition, system);
|
|
64
|
+
const block = el('div', 'wl-remedy-lines');
|
|
65
|
+
for (const line of lines) {
|
|
66
|
+
// A command is never translated; a comment is prose a person reads.
|
|
67
|
+
const comment = line.trim().startsWith('#');
|
|
68
|
+
block.append(el(comment ? 'p' : 'code', comment ? 'wl-remedy-say' : null, comment ? t(line.trim()).replace(/^#\s*/, '') : line));
|
|
69
|
+
}
|
|
70
|
+
const runnable = lines.filter((line) => !line.trim().startsWith('#'));
|
|
71
|
+
const copy = button('wl-btn small', t('Copy'), async () => {
|
|
72
|
+
try { await navigator.clipboard.writeText(runnable.join('\n')); copy.textContent = t('Copied'); setTimeout(() => { copy.textContent = t('Copy'); }, 1500); } catch { copy.textContent = t('Select it'); }
|
|
73
|
+
});
|
|
74
|
+
copy.hidden = !runnable.length;
|
|
75
|
+
const top = el('div', 'wl-row wl-remedy-top');
|
|
76
|
+
top.append(el('b', null, t('In your terminal')), el('span', 'wl-tiny', PLATFORMS[system].shell), el('span', 'wl-grow'), seg);
|
|
77
|
+
terminal.replaceChildren(top, block, copy);
|
|
78
|
+
};
|
|
79
|
+
paint();
|
|
80
|
+
const why = el('details', 'wl-remedy-why');
|
|
81
|
+
why.append(el('summary', null, t('Why it happens')), el('p', null, condition.diagnosis));
|
|
82
|
+
box.append(terminal, why);
|
|
83
|
+
dialog.append(box);
|
|
84
|
+
document.body.append(dialog);
|
|
85
|
+
dialog.addEventListener('close', () => dialog.remove());
|
|
86
|
+
dialog.addEventListener('click', (event) => { if (event.target === dialog) dialog.close(); });
|
|
87
|
+
dialog.showModal();
|
|
88
|
+
return dialog;
|
|
89
|
+
}
|
package/public/resay.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
2
|
-
// MADRE · © 2026 Jossue Alcalá ·
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
// MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
|
|
3
3
|
// What MADRE said in another language, said again.
|
|
4
4
|
//
|
|
5
5
|
// A failure is recorded in the ledger with the sentence MADRE wrote at the time, and a room that
|
|
@@ -32,6 +32,7 @@ const SAID = [
|
|
|
32
32
|
'{label} was interrupted before it started: {why}.',
|
|
33
33
|
'{label} was interrupted: {why}.',
|
|
34
34
|
'{label} did not respond before the timeout ({seconds}s).',
|
|
35
|
+
'{label} exited with code {code}.',
|
|
35
36
|
' Last output: {output}',
|
|
36
37
|
'MADRE is shutting down',
|
|
37
38
|
'STOPALL by the human',
|
|
@@ -58,6 +59,7 @@ const SAID = [
|
|
|
58
59
|
'@{agent} is capped at #{n} {label}; raise its MAX MODE to #{wanted} in CONNECTIONS to arm {mode}.',
|
|
59
60
|
'@{agent} already holds {mode} of this project; one holder at a time. STOPALL revokes it.',
|
|
60
61
|
'@{agent} left the project: Ollama is not running. Start Ollama, or open Local AI in Modules.',
|
|
62
|
+
'@{agent} left the project: Ollama is not running. Start Ollama, or set up Local AI in Settings.',
|
|
61
63
|
'@madre is in the project · {version}',
|
|
62
64
|
'{agent} is not installed on this computer.',
|
|
63
65
|
'@madre left the project: Ollama has no chat model running',
|
package/public/review-ask.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
2
|
-
// MADRE · © 2026 Jossue Alcalá ·
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
// MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
|
|
3
3
|
// Asking for a star or a review (2026-10-10), in the room and in Home: the server keeps when to
|
|
4
4
|
// ask (src/review-ask.mjs); this page says once a minute that it is in view, and when a moment is
|
|
5
5
|
// due it asks — only when nothing is going on: no turn running, nothing half written, no other
|
|
6
6
|
// window open. Otherwise it waits for the next minute. The sheet is the room's question
|
|
7
|
-
// (styles.css, dialog.room-ask): a star on GitHub, a review on madre.run,
|
|
8
|
-
//
|
|
7
|
+
// (styles.css, dialog.room-ask): a star on GitHub, a review on madre.run, a donation on GitHub
|
|
8
|
+
// Sponsors (2026-10-30), not now, or never again. The links open in the person's browser; MADRE
|
|
9
|
+
// itself sends nothing.
|
|
9
10
|
|
|
10
11
|
import { language, t } from './i18n.js';
|
|
12
|
+
import { trazo } from './icons.js';
|
|
11
13
|
|
|
12
14
|
export const STAR_URL = 'https://github.com/jossuealcacao-exe/madre';
|
|
15
|
+
// GitHub keeps no commission on Sponsors (.github/FUNDING.yml); Settings › Version links it too.
|
|
16
|
+
export const SPONSORS_URL = 'https://github.com/sponsors/jossuealcacao-exe';
|
|
13
17
|
export const REVIEW_URLS = { es: 'https://madre.run/resenas/', en: 'https://madre.run/en/reviews/' };
|
|
14
18
|
const TICK_MS = 60 * 1000;
|
|
15
|
-
const STAR = '
|
|
19
|
+
const STAR = trazo('star');
|
|
16
20
|
|
|
17
21
|
const post = (url, payload) => fetch(url, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(payload ?? {}) })
|
|
18
22
|
.then((response) => (response.ok ? response.json() : null)).catch(() => null);
|
|
@@ -43,7 +47,7 @@ export function startReviewAsk({ busy = () => false } = {}) {
|
|
|
43
47
|
title.textContent = t('Are you enjoying MADRE?');
|
|
44
48
|
const body = document.createElement('p');
|
|
45
49
|
body.className = 'room-ask-body';
|
|
46
|
-
body.textContent = t('If MADRE saves you work, a star on GitHub or a few words about it help more people find it.
|
|
50
|
+
body.textContent = t('If MADRE saves you work, a star on GitHub or a few words about it help more people find it. And if you can, a donation keeps it going: MADRE is made by one person.');
|
|
47
51
|
const actions = document.createElement('div');
|
|
48
52
|
actions.className = 'room-ask-actions review-ask-actions';
|
|
49
53
|
const choice = (words, tone, answer, href = null) => {
|
|
@@ -60,10 +64,11 @@ export function startReviewAsk({ busy = () => false } = {}) {
|
|
|
60
64
|
actions.append(
|
|
61
65
|
choice(t('Write a review'), null, 'review', REVIEW_URLS[language()] ?? REVIEW_URLS.es),
|
|
62
66
|
choice(t('Give it a star on GitHub'), 'primary', 'star', STAR_URL),
|
|
67
|
+
choice(t('Donate on GitHub'), 'give', 'donate', SPONSORS_URL),
|
|
63
68
|
);
|
|
64
69
|
const note = document.createElement('p');
|
|
65
70
|
note.className = 'review-ask-note';
|
|
66
|
-
note.textContent = t('
|
|
71
|
+
note.textContent = t('They open in your browser. MADRE sends nothing.');
|
|
67
72
|
card.append(icon, title, body, actions, quiet, note);
|
|
68
73
|
dialog.append(card);
|
|
69
74
|
let settled = false;
|
package/public/routing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
2
|
-
// MADRE · © 2026 Jossue Alcalá ·
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
// MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
|
|
3
3
|
// Which questions the room can answer without paying for them.
|
|
4
4
|
//
|
|
5
5
|
// @madre runs on Ollama, on this computer. A turn it answers costs nothing: no input tokens, no
|
|
@@ -88,7 +88,7 @@ export function modeAskedWithTime(text = '', { ran = 1 } = {}) {
|
|
|
88
88
|
|
|
89
89
|
// The windows a key may open, as the project allows them (src/override.mjs): what the agent asked
|
|
90
90
|
// for becomes the smallest one that covers it, or the longest there is.
|
|
91
|
-
export const MODE_WINDOWS = Object.freeze({ 3: Object.freeze([5, 15, 30]), 4: Object.freeze([5]) });
|
|
91
|
+
export const MODE_WINDOWS = Object.freeze({ 3: Object.freeze([5, 15, 30, 60, 240, 480]), 4: Object.freeze([5, 15, 30, 60]) });
|
|
92
92
|
export function windowFor(mode, minutes) {
|
|
93
93
|
const allowed = MODE_WINDOWS[mode];
|
|
94
94
|
if (!allowed || !Number.isFinite(minutes) || minutes <= 0) return 0;
|