@jossuealcala/madre 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADDITIONAL-TERMS.md +7 -2
- package/CHANGELOG.en.md +47 -1
- package/CHANGELOG.md +47 -1
- package/CONTRIBUTING.md +2 -2
- package/LICENSE +111 -661
- package/NOTICE +28 -23
- package/README.en.md +30 -101
- package/README.md +30 -103
- package/SECURITY.md +1 -0
- package/TRADEMARKS.en.md +13 -14
- package/TRADEMARKS.md +24 -26
- package/bin/madre.cjs +2 -2
- package/bin/madre.mjs +112 -40
- package/docs/REFERENCE.md +52 -5
- package/docs/SDK.md +21 -3
- package/docs/en/REFERENCE.md +52 -5
- package/docs/en/SDK.md +22 -3
- 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 +2468 -435
- 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 +413 -4
- package/public/es.js +1345 -483
- package/public/hardware.js +2 -2
- package/public/i18n.js +2 -2
- package/public/icons.js +158 -0
- package/public/index.html +66 -48
- package/public/inquiry.js +2 -2
- package/public/loader.js +271 -2
- package/public/macroverso.js +60 -21
- package/public/manual-content.js +412 -169
- package/public/manual-shots.js +38 -34
- package/public/manual.css +20 -2
- package/public/manual.html +1 -1
- package/public/manual.js +54 -25
- package/public/market-art.js +47 -45
- package/public/market-view.js +111 -33
- package/public/market.js +132 -30
- package/public/mcp-catalog.js +2 -2
- 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 +3 -2
- package/public/review-ask.js +12 -7
- package/public/routing.js +3 -3
- package/public/salas-mac.css +703 -24
- package/public/salas-mac.html +26 -14
- package/public/salas-mac.js +1254 -289
- package/public/salas.css +2 -2
- package/public/salas.html +3 -3
- package/public/salas.js +3 -3
- package/public/styles.css +2404 -291
- package/public/syntax.js +2 -2
- package/public/terms.js +152 -0
- package/public/touch.js +2 -2
- package/public/tour-chapters.js +10 -10
- package/public/tour.js +56 -8
- package/public/troubleshooting.js +182 -11
- 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 +5 -3
- package/src/adapters/gemini.mjs +5 -3
- package/src/adapters/madre.mjs +3 -3
- package/src/adapters/opencode.mjs +73 -10
- package/src/adapters/process.mjs +14 -13
- package/src/adapters/subagents.mjs +159 -0
- package/src/asking.mjs +8 -2
- package/src/auth-probe.mjs +27 -10
- 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 +2 -2
- package/src/builtin-updates.mjs +87 -0
- package/src/capabilities.mjs +2 -2
- 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 +56 -16
- 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 +2 -2
- package/src/i18n.mjs +9 -2
- 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 +2 -2
- package/src/looks.mjs +2 -2
- package/src/market-check.mjs +165 -0
- package/src/market-key.mjs +10 -2
- package/src/market-license.mjs +4 -4
- package/src/market-remote.mjs +54 -12
- 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 +2 -2
- 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 +33 -3
- 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 +90 -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 +14 -11
- package/src/modules/mcp-connect.mjs +2 -2
- package/src/modules/notes.mjs +159 -20
- package/src/modules/ollama.mjs +9 -3
- package/src/modules/playwright.mjs +2 -2
- package/src/modules/reminders.mjs +356 -37
- package/src/modules/ripley.mjs +3 -3
- package/src/modules/runs.mjs +2 -2
- package/src/modules/sdk.mjs +38 -6
- package/src/modules/updates.mjs +2 -2
- package/src/mother.mjs +2 -2
- package/src/npm-launch.mjs +2 -2
- package/src/ollama.mjs +6 -4
- package/src/opencode-health.mjs +26 -6
- package/src/outbound.mjs +10 -2
- 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 +127 -31
- package/src/router.mjs +2 -2
- package/src/runs.mjs +2 -2
- package/src/runtime-detection.mjs +31 -5
- package/src/salas.mjs +31 -6
- package/src/sentinel-errors.mjs +13 -4
- package/src/server-sentinel.mjs +2 -2
- package/src/server.mjs +689 -80
- 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 +39 -5
- 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
- package/public/assets/manual/madre-manual-en.pdf +0 -0
- package/public/assets/manual/madre-manual-es.pdf +0 -0
- package/public/assets/manual/shots/en-modules.webp +0 -0
- package/public/assets/manual/shots/es-modules.webp +0 -0
- package/src/mcp/notes-server.mjs +0 -120
- package/src/reminder-time.mjs +0 -127
package/public/salas-mac.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
|
// SALAS on the Mac: every room this Mac knows, open or asleep, in one place (docs/MACROVERSO.md,
|
|
4
4
|
// phase 1). The room that serves this page answers for all of them (src/salas.mjs): it lists
|
|
5
5
|
// them, opens one that is asleep, asks one to close, and stops every agent in every room. A room
|
|
@@ -9,20 +9,32 @@
|
|
|
9
9
|
|
|
10
10
|
import { browserLanguage, sessionDetail, setLanguage, t } from './i18n.js';
|
|
11
11
|
import { brandOf, monogram } from './brands.js';
|
|
12
|
-
import { startReviewAsk } from './review-ask.js';
|
|
12
|
+
import { SPONSORS_URL, startReviewAsk } from './review-ask.js';
|
|
13
13
|
import { startTour } from './tour.js';
|
|
14
14
|
import { dropStickyHover } from './touch.js';
|
|
15
|
-
import { drawAttribution, drawColophonKeys, drawLegal } from './attribution.js';
|
|
15
|
+
import { AUTHOR, AUTHOR_URL, YEAR, drawAttribution, drawColophonKeys, drawLegal } from './attribution.js';
|
|
16
16
|
|
|
17
17
|
// Where nothing can hover (a tablet), a tapped key does not stay lit (public/touch.js).
|
|
18
18
|
dropStickyHover();
|
|
19
|
-
import { creep, finishLoader, makeLoader, setLoader, showCurtain } from './loader.js';
|
|
20
|
-
import { labelPowerKey, powerKey } from './power.js';
|
|
19
|
+
import { bootDone, creep, finishLoader, makeLoader, openingPlayed, playOpening, setLoader, showCurtain } from './loader.js';
|
|
20
|
+
import { POWER_ICON, askUninstall, labelPowerKey, openPowerMenu, powerKey } from './power.js';
|
|
21
21
|
import { drawHardware } from './hardware.js';
|
|
22
22
|
import { CUSTOM_WALL, addPicture, customTile, customTools, customWall, paintCustomWall, rememberedWall } from './wallpaper.js';
|
|
23
|
-
import { neuralChosen, rememberNeural } from './neural.js';
|
|
23
|
+
import { mapKeys, neuralChosen, rememberNeural } from './neural.js';
|
|
24
24
|
import { openMarket } from './market-view.js';
|
|
25
|
+
import { openWelcome, welcomeOpen, WELCOME_STEPS } from './welcome.js';
|
|
26
|
+
import { remedyKey } from './remedy.js';
|
|
25
27
|
import { loadMarket } from './market.js';
|
|
28
|
+
import { trazo, trazoDrawing } from './icons.js';
|
|
29
|
+
import { tellFailures } from './page-errors.js';
|
|
30
|
+
import { mountActivity } from './activity.js';
|
|
31
|
+
import { ensureTerms } from './terms.js';
|
|
32
|
+
|
|
33
|
+
// Nothing of MADRE starts before its license and privacy notice are accepted on this computer
|
|
34
|
+
// (public/terms.js, src/terms.mjs): the page waits here.
|
|
35
|
+
await ensureTerms();
|
|
36
|
+
// A failure of Home's page is told to MADRE's anonymous diagnostics (src/telemetry.mjs).
|
|
37
|
+
tellFailures('home');
|
|
26
38
|
|
|
27
39
|
const $ = (id) => document.getElementById(id);
|
|
28
40
|
const root = document.documentElement;
|
|
@@ -48,7 +60,8 @@ let timer = 0;
|
|
|
48
60
|
let arming = 0;
|
|
49
61
|
let data = null;
|
|
50
62
|
let macro = null; // the macroverse, while it is open
|
|
51
|
-
let welcomed = false; // the
|
|
63
|
+
let welcomed = false; // the welcome was offered this visit (public/welcome.js)
|
|
64
|
+
let welcomeSeen = null; // where the welcome is (src/tour.mjs, `welcome`), as last saved
|
|
52
65
|
let agentsSeen = null; // what /api/settings said of the agents, last time it was asked
|
|
53
66
|
let localSeen = null; // what /api/salas/local-ai said: the mode and which projects use the local AI
|
|
54
67
|
let versionSeen = null; // what /api/version said of MADRE, last time it was asked
|
|
@@ -68,8 +81,8 @@ const revoking = new Set(); // link ids whose row asks before revoking
|
|
|
68
81
|
|
|
69
82
|
// The room's looks, from this browser: the same keys the room's own page keeps (app.js, LOOKS),
|
|
70
83
|
// so a choice made here is the room's too when the room is served at this address.
|
|
71
|
-
const ACCENTS = ['madre', 'mountain', 'caribbean', 'phantom', 'malbec', 'dijon', 'pacific', 'love', 'sierra', 'pitahaya', 'papaya', 'agave', 'dinamo', 'marina', 'pulso', 'leal', 'dulce', 'marmol', 'durazno', 'pistache', 'petalo'];
|
|
72
|
-
const ACCENT_WORDS = { madre: () => t('Madre green'), mountain: () => t('Mountain green'), caribbean: () => t('Caribbean blue'), phantom: () => t('Phantom purple'), malbec: () => t('Malbec red'), dijon: () => t('Dijon yellow'), pacific: () => t('Pacific blue'), love: () => t('Love pink'), sierra: () => t('Sierra blue'), pitahaya: () => 'Pitahaya', papaya: () => 'Papaya', agave: () => 'Agave', dinamo: () => t('Dynamo black'), marina: () => t('Marina blue'), pulso: () => t('Pulse green'), leal: () => t('Loyal orange'), dulce: () => t('Sweet yellow'), marmol: () => t('Marble gray'), durazno: () => t('Peach orange'), pistache: () => t('Pistachio green'), petalo: () => t('Petal pink') };
|
|
84
|
+
const ACCENTS = ['madre', 'mountain', 'caribbean', 'phantom', 'malbec', 'dijon', 'pacific', 'love', 'sierra', 'pitahaya', 'papaya', 'agave', 'dinamo', 'marina', 'pulso', 'leal', 'dulce', 'marmol', 'durazno', 'pistache', 'petalo', 'negro', 'fortaleza'];
|
|
85
|
+
const ACCENT_WORDS = { madre: () => t('Madre green'), mountain: () => t('Mountain green'), caribbean: () => t('Caribbean blue'), phantom: () => t('Phantom purple'), malbec: () => t('Malbec red'), dijon: () => t('Dijon yellow'), pacific: () => t('Pacific blue'), love: () => t('Love pink'), sierra: () => t('Sierra blue'), pitahaya: () => 'Pitahaya', papaya: () => 'Papaya', agave: () => 'Agave', dinamo: () => t('Dynamo black'), marina: () => t('Marina blue'), pulso: () => t('Pulse green'), leal: () => t('Loyal orange'), dulce: () => t('Sweet yellow'), marmol: () => t('Marble gray'), durazno: () => t('Peach orange'), pistache: () => t('Pistachio green'), petalo: () => t('Petal pink'), negro: () => t('Black'), fortaleza: () => t('Fortress blue') };
|
|
73
86
|
// The wallpapers are the room's (app.js, LOOKS.wallpaper; styles.css, --wp-*): the same images, the
|
|
74
87
|
// same veil, the same «mesh» and blur the room's PERSONALIZE sets, read from the same keys.
|
|
75
88
|
const WALLPAPERS = ['default', 'jarrito', 'canela', 'paradise', 'ventura', 'magna', 'biznaga', 'oceano', 'quila', 'xico', 'tropical', 'tradicion', 'urbania', CUSTOM_WALL];
|
|
@@ -291,7 +304,9 @@ const addressOf = (room) => (room.here ? '/' : `http://127.0.0.1:${room.open.por
|
|
|
291
304
|
const KINDS = ['decision', 'fact', 'preference', 'question', 'aberration'];
|
|
292
305
|
const KIND_WORDS = { decision: t('DECISION'), fact: t('FACT'), preference: t('PREFERENCE'), question: t('QUESTION'), aberration: t('DOUBTFUL MEMORY') };
|
|
293
306
|
// A kind as a sentence says it: «Decisión», not «DECISIÓN».
|
|
294
|
-
|
|
307
|
+
// A word the catalogue keeps in capitals, said in sentence case: «Decisión», «Centrar».
|
|
308
|
+
const asLabel = (text) => { const word = String(text).toLowerCase(); return word.charAt(0).toUpperCase() + word.slice(1); };
|
|
309
|
+
const kindWord = (kind) => asLabel(KIND_WORDS[kind] ?? kind);
|
|
295
310
|
|
|
296
311
|
function memoryStrip(census) {
|
|
297
312
|
const strip = el('div', 'sm-strip');
|
|
@@ -316,6 +331,9 @@ function stateOf(room) {
|
|
|
316
331
|
const glance = room.glance ?? {};
|
|
317
332
|
if (!room.open) return { key: 'asleep', words: room.lastOpened ? t('Asleep · last open {when}', { when: ago(room.lastOpened) }) : t('Asleep') };
|
|
318
333
|
if (glance.outdated) return { key: 'outdated', words: t('Update MADRE in this project to see it here.') };
|
|
334
|
+
// Still on the MADRE it was opened with, after Home updated (QA 1.1.0, ACT-05): its card said
|
|
335
|
+
// «Active» and a press took the person into the old version without a word.
|
|
336
|
+
if (room.open?.version && data?.version && !room.here && olderVersion(room.open.version, data.version)) return { key: 'outdated', words: t('On MADRE {version} · restart it to bring it to {latest}', { version: room.open.version, latest: data.version }) };
|
|
319
337
|
if (glance.unreachable) return { key: 'quiet', words: t('Not answering right now') };
|
|
320
338
|
if (glance.delayed) return { key: 'quiet', words: t('Responding slowly · last known state') };
|
|
321
339
|
if (glance.waitingCount) return { key: 'waiting', words: t('Waiting for you · {n}', { n: glance.waitingCount }) };
|
|
@@ -479,14 +497,27 @@ function projectsInOrder() {
|
|
|
479
497
|
: [...open, ...asleep];
|
|
480
498
|
return { all, open, asleep };
|
|
481
499
|
}
|
|
500
|
+
let homeBootAsked = false;
|
|
482
501
|
function draw() {
|
|
483
502
|
if (!data) return;
|
|
484
503
|
const { all, open } = projectsInOrder();
|
|
485
504
|
drawBishop(data.rooms.find((room) => room.id === data.salas) ?? null);
|
|
486
505
|
drawWaiting();
|
|
487
506
|
drawProjects(all);
|
|
488
|
-
|
|
507
|
+
// An empty Home opens the welcome where it was left, or at the project when it was finished
|
|
508
|
+
// without one; someone new meets it in place of the bonjour (public/tour.js).
|
|
509
|
+
// Not for whoever updated from before 1.1.0: they meet the news, and «Add project» is on Home (2026-10-30).
|
|
510
|
+
if (!all.length && !welcomed) { welcomed = true; void homeTour.loaded.then((answer) => { if (!answer?.owed && !answer?.upgraded) openHomeWelcome({ at: answer?.state?.welcome?.finished ? 'project' : null }); }); }
|
|
489
511
|
welcomeHome();
|
|
512
|
+
// Home is drawn: the ground over its first frame goes (loader.js, bootDone) — unless the welcome is
|
|
513
|
+
// about to open, whose opening comes first; then it goes as the welcome opens (openHomeWelcome).
|
|
514
|
+
if (!homeBootAsked) {
|
|
515
|
+
homeBootAsked = true;
|
|
516
|
+
void homeTour.loaded.then((answer) => {
|
|
517
|
+
const welcomeComing = !answer?.upgraded && (answer?.owed ? homeTour.path() === 'new' : !all.length);
|
|
518
|
+
if (!welcomeComing) bootDone();
|
|
519
|
+
}, () => bootDone());
|
|
520
|
+
}
|
|
490
521
|
const working = open.some((room) => room.glance?.working?.length);
|
|
491
522
|
ui.stop.hidden = !working;
|
|
492
523
|
drawLinks(all);
|
|
@@ -570,7 +601,7 @@ for (const choice of ui.filter.querySelectorAll('[data-filter]')) {
|
|
|
570
601
|
// ORDER, where the projects are (2026-10-13): the same four orders as Home's Appearance, one press
|
|
571
602
|
// away from the list they arrange. «Yours» is the order made by dragging a card or by its
|
|
572
603
|
// right-click › Move; the menu says so, so the way to make it is never a secret.
|
|
573
|
-
const SORT_ICON = '
|
|
604
|
+
const SORT_ICON = trazo('sort');
|
|
574
605
|
const orderKey = button('sm-btn sm-order', null, () => {
|
|
575
606
|
const box = orderKey.getBoundingClientRect();
|
|
576
607
|
const now = readLooks().home.order;
|
|
@@ -600,7 +631,7 @@ function drawWaiting() {
|
|
|
600
631
|
ui.waiting.count.textContent = String(total);
|
|
601
632
|
ui.waiting.box.classList.toggle('has', Boolean(total));
|
|
602
633
|
ui.waiting.body.replaceChildren();
|
|
603
|
-
if (!total) { ui.waiting.body.append(el('p', 'sm-hint', t('
|
|
634
|
+
if (!total) { ui.waiting.body.append(el('p', 'sm-hint', t('All caught up. When an agent asks you something, it shows up here.'))); return; }
|
|
604
635
|
for (const room of rooms.slice(0, 2)) {
|
|
605
636
|
const row = el('a', 'sm-waiting-row');
|
|
606
637
|
row.href = addressOf(room);
|
|
@@ -622,7 +653,7 @@ function drawMemory() {
|
|
|
622
653
|
sum.travelling += census.travelling ?? 0;
|
|
623
654
|
for (const kind of KINDS) sum.kinds[kind] = (sum.kinds[kind] ?? 0) + (census.kinds?.[kind] ?? 0);
|
|
624
655
|
}
|
|
625
|
-
ui.memory.total.textContent =
|
|
656
|
+
ui.memory.total.textContent = memoriesCount(sum.memories);
|
|
626
657
|
ui.memory.total.hidden = !counted.length;
|
|
627
658
|
ui.memory.body.replaceChildren();
|
|
628
659
|
if (!counted.length) { ui.memory.body.append(el('p', 'sm-hint', t('Open a project to count its memory.'))); return; }
|
|
@@ -742,9 +773,11 @@ function attentionItems() {
|
|
|
742
773
|
const items = [];
|
|
743
774
|
for (const one of (remindersSeen ?? []).filter((item) => Date.parse(item.due) <= Date.now())) {
|
|
744
775
|
const room = data?.rooms.find((item) => item.id === one.room) ?? null;
|
|
776
|
+
// Due is waiting for the person, said as when it fell due (ACT-09): a green dot and «jueves 8:41
|
|
777
|
+
// p.m.» read as a thing done, not as one waiting.
|
|
745
778
|
items.push({
|
|
746
|
-
tone: '
|
|
747
|
-
hint: [room ? roomLabel(room) : one.project, t('Reminder · {when}', { when:
|
|
779
|
+
tone: 'wait', words: one.text,
|
|
780
|
+
hint: [room ? roomLabel(room) : one.project, t('Reminder · due {when}', { when: ago(one.due) })].filter(Boolean).join(' · '),
|
|
748
781
|
act: () => void settleReminder('/api/reminders/done', { id: one.id }), go: one.repeat ? t('Done for today') : t('Done'),
|
|
749
782
|
later: { go: reminderPrefs.snooze === 60 ? t('In an hour') : reminderPrefs.snooze > 60 ? t('In {n} hours', { n: Math.round(reminderPrefs.snooze / 60) }) : t('In {n} minutes', { n: reminderPrefs.snooze }), act: () => void settleReminder('/api/reminders/snooze', { id: one.id, minutes: reminderPrefs.snooze }) },
|
|
750
783
|
});
|
|
@@ -759,6 +792,11 @@ function attentionItems() {
|
|
|
759
792
|
const state = agentState(agent, agentsSeen);
|
|
760
793
|
if (!state.ok) items.push({ tone: state.key, words: `${agent.label ?? agent.id} · ${state.words}`, hint: t('Connected once, every project uses it.'), act: () => openSettings('agents'), go: t('Connect') });
|
|
761
794
|
}
|
|
795
|
+
// The welcome left halfway: where it stopped, and the way back to it.
|
|
796
|
+
if (welcomeSeen?.at && !welcomeSeen.finished) {
|
|
797
|
+
const n = WELCOME_STEPS.indexOf(welcomeSeen.at) + 1;
|
|
798
|
+
items.unshift({ tone: 'wait', words: t('MADRE is not ready yet.'), hint: t('The welcome stopped at step {n} of {total}.', { n, total: WELCOME_STEPS.length }), act: () => void openHomeWelcome(), go: t('Continue') });
|
|
799
|
+
}
|
|
762
800
|
const soon = Date.now() + 3 * 86400000;
|
|
763
801
|
for (const enlace of data?.enlaces ?? []) {
|
|
764
802
|
if (!enlace.expires || Date.parse(enlace.expires) > soon) continue;
|
|
@@ -856,9 +894,11 @@ async function loadWork({ again = false } = {}) {
|
|
|
856
894
|
function drawWork() {
|
|
857
895
|
const w = ui.work;
|
|
858
896
|
w.list.replaceChildren();
|
|
897
|
+
// Whatever it says, the Coordinator's tile is measured again once it is said (fitTile).
|
|
898
|
+
queueMicrotask(() => { if (typeof fitTiles === 'function' && layout) fitTiles(); });
|
|
859
899
|
const state = work?.state ?? 'loading';
|
|
860
900
|
w.box.classList.toggle('is-working', state === 'working');
|
|
861
|
-
w.again.hidden = !work || state === 'empty' || state === 'unavailable';
|
|
901
|
+
w.again.hidden = !work || state === 'empty' || state === 'unavailable' || state === 'plain';
|
|
862
902
|
w.again.disabled = state === 'working';
|
|
863
903
|
if (!work) { w.by.textContent = ''; w.note.textContent = t('Reading your conversations…'); return; }
|
|
864
904
|
if (state === 'empty') { w.by.textContent = ''; w.note.textContent = t('No conversations in the last two weeks. What you work on in any project shows here, summarised by MADRE.'); return; }
|
|
@@ -884,6 +924,7 @@ function drawWork() {
|
|
|
884
924
|
w.note.textContent = state === 'working' ? t('MADRE is summarising your latest conversations…')
|
|
885
925
|
: state === 'unavailable' ? (bullets.length ? t('MADRE\'s local model is off: this is the last summary it wrote.') : t('MADRE\'s local model is off: these are your latest conversations, as they are.'))
|
|
886
926
|
: state === 'failed' ? t('MADRE could not summarise them this time: these are your latest conversations, as they are.')
|
|
927
|
+
: state === 'plain' ? t('The AI on this computer is small to summarise them well: these are your latest conversations, as they are.')
|
|
887
928
|
: work.stale ? t('There is newer work than this summary: it updates itself in a few minutes, or now if you press Summarize again.')
|
|
888
929
|
: t('Written by MADRE on this Mac from your latest conversations.');
|
|
889
930
|
if (typeof fitTiles === 'function') fitTiles();
|
|
@@ -901,75 +942,99 @@ function endsOf(enlace) {
|
|
|
901
942
|
const { a, b } = enlace.rooms;
|
|
902
943
|
return enlace.direction === 'b→a' ? { source: b, reader: a } : { source: a, reader: b };
|
|
903
944
|
}
|
|
945
|
+
// A connection, said so it is understood at a glance (2026-10-28): who looks up whom, drawn as on the
|
|
946
|
+
// project map — the one that reads, an arrow, the one that shares —; what crosses, until when and
|
|
947
|
+
// whether orders go, as tags; what was read lately; and each thing it allows as a switch with one
|
|
948
|
+
// line on what it does. «Cancel the connection» asks once more before it does.
|
|
949
|
+
const LINK_MARK = (id) => {
|
|
950
|
+
const face = el('span', `sm-link-end${id === data.salas ? ' hub' : ''}`);
|
|
951
|
+
if (id === data.salas) face.append(mark('bishop', 30)); else { face.style.setProperty('--pc', toneOf(id)); face.append(el('i', null, roomName(id).slice(0, 1).toUpperCase())); }
|
|
952
|
+
const words = el('span', 'sm-link-end-words');
|
|
953
|
+
words.append(el('b', null, roomName(id)));
|
|
954
|
+
const box = el('span', 'sm-link-end-box');
|
|
955
|
+
box.append(face, words);
|
|
956
|
+
return box;
|
|
957
|
+
};
|
|
958
|
+
const LINK_ARROW = '<svg viewBox="0 0 60 16" aria-hidden="true"><path d="M58 8H6M12 2.5 6 8l6 5.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
959
|
+
const LINK_BOTH = '<svg viewBox="0 0 60 16" aria-hidden="true"><path d="M6 8h48M12 2.5 6 8l6 5.5M48 2.5 54 8l-6 5.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
904
960
|
function linkRow(enlace) {
|
|
905
961
|
const { source, reader } = endsOf(enlace);
|
|
906
962
|
const node = el('article', `sm-link${revoking.has(enlace.id) ? ' revoking' : ''}`);
|
|
907
963
|
node.dataset.link = enlace.id;
|
|
908
964
|
node.append(el('span', 'sm-link-kind', source === data.salas || reader === data.salas ? t('With the Coordinator') : t('Between projects')));
|
|
909
|
-
|
|
965
|
+
// Who looks up whom, as the map draws it.
|
|
966
|
+
const pair = el('div', 'sm-link-pair');
|
|
967
|
+
const arrow = el('span', 'sm-link-arrow');
|
|
968
|
+
arrow.innerHTML = enlace.direction === 'both' ? LINK_BOTH : LINK_ARROW; // trusted: our own SVG strings
|
|
969
|
+
arrow.append(el('small', null, enlace.direction === 'both' ? t('read each other') : t('looks up')));
|
|
970
|
+
pair.append(LINK_MARK(reader), arrow, LINK_MARK(source));
|
|
971
|
+
// The drawing says it; the sentence is kept for whoever hears the page.
|
|
972
|
+
const who = el('span');
|
|
910
973
|
who.append(enlace.direction === 'both' ? sayTinted('{a} and {b} read each other', { a: enlace.rooms.a, b: enlace.rooms.b }) : sayTinted('{reader} reads from {source}', { reader, source }));
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
974
|
+
pair.setAttribute('role', 'img');
|
|
975
|
+
pair.setAttribute('aria-label', who.textContent);
|
|
976
|
+
node.append(pair);
|
|
977
|
+
// What crosses, until when, and whether orders go.
|
|
978
|
+
const tags = el('div', 'sm-link-tags');
|
|
979
|
+
for (const kind of enlace.kinds ?? []) {
|
|
980
|
+
const word = String(KIND_WORDS[kind] ?? kind).toLocaleLowerCase(language);
|
|
981
|
+
const tag = el('span', 'sm-link-tag');
|
|
982
|
+
tag.append(el('i', `k-${kind}`), word.slice(0, 1).toLocaleUpperCase(language) + word.slice(1));
|
|
983
|
+
tags.append(tag);
|
|
984
|
+
}
|
|
985
|
+
tags.append(el('span', 'sm-link-tag plain', enlace.expires ? t('until {date}', { date: new Date(enlace.expires).toLocaleDateString(language, { day: 'numeric', month: 'short' }) }) : t('no expiry')));
|
|
986
|
+
tags.append(el('span', 'sm-link-tag plain', enlace.orders?.allowed ? t('orders up to #{n}', { n: enlace.orders.maxMode }) : t('no orders')));
|
|
914
987
|
// D-S13: a link BISHOP signed on its own says so, so it is never mistaken for one you signed.
|
|
915
|
-
if (enlace.signed?.by === 'bishop')
|
|
916
|
-
|
|
917
|
-
if (enlace.state) what.push(t('shares its state'));
|
|
918
|
-
if (enlace.deliver) what.push(t('receives delivered notes'));
|
|
919
|
-
node.append(el('p', 'what', what.join(' · ')));
|
|
988
|
+
if (enlace.signed?.by === 'bishop') tags.append(el('span', 'sm-link-tag plain', t('signed by the Coordinator')));
|
|
989
|
+
node.append(tags);
|
|
920
990
|
const traffic = enlace.traffic ?? {};
|
|
921
991
|
// S-021: the last reading says who read, as the room that asked said it.
|
|
922
992
|
const last = traffic.lastAt ? (traffic.lastAgent ? t('last by @{agent} of {room}, {when}', { agent: traffic.lastAgent, room: roomName(traffic.lastRoom), when: ago(traffic.lastAt) }) : t('last {when}', { when: ago(traffic.lastAt) })) : t('none yet');
|
|
923
993
|
node.append(el('p', 'traffic', [t('{n} reads in 24 h', { n: traffic.reads24h ?? 0 }), last].join(' · ')));
|
|
924
|
-
//
|
|
925
|
-
const
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
});
|
|
935
|
-
recall.append(recallBox, document.createTextNode(t('Always include (up to 3 notes)')));
|
|
936
|
-
node.append(recall);
|
|
937
|
-
// D-S15: on a link the Coordinator reads, whether it also learns from that project.
|
|
938
|
-
if (reader === data.salas) {
|
|
939
|
-
const learn = el('label', 'row sm-recall');
|
|
940
|
-
const learnBox = el('input'); learnBox.type = 'checkbox'; learnBox.checked = Boolean(enlace.train);
|
|
941
|
-
learnBox.addEventListener('change', async () => {
|
|
942
|
-
learnBox.disabled = true;
|
|
943
|
-
const answer = await fetch('/api/salas/enlaces/train', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id: enlace.id, train: learnBox.checked }) })
|
|
944
|
-
.then((response) => response.ok).catch(() => false);
|
|
945
|
-
if (!answer) learnBox.checked = !learnBox.checked;
|
|
946
|
-
learnBox.disabled = false;
|
|
947
|
-
await refresh();
|
|
948
|
-
});
|
|
949
|
-
learn.append(learnBox, document.createTextNode(t('The Coordinator learns from it')));
|
|
950
|
-
node.append(learn);
|
|
951
|
-
}
|
|
952
|
-
// D-S16 and D-S17: what else the link allows, ticked or cleared here by you.
|
|
953
|
-
for (const [field, label] of [['state', t('It shares its state')], ['deliver', t('It receives delivered notes')]]) {
|
|
954
|
-
const allow = el('label', 'row sm-recall');
|
|
955
|
-
const box = el('input'); box.type = 'checkbox'; box.checked = Boolean(enlace[field]);
|
|
994
|
+
// What else it allows, each a switch that says what it does (Fase 3e, D-S15, D-S16, D-S17).
|
|
995
|
+
const options = el('div', 'sm-link-options');
|
|
996
|
+
const option = (on, title, says, path, payload) => {
|
|
997
|
+
const line = el('label', 'sm-link-option');
|
|
998
|
+
const words = el('span', 'sm-link-option-words');
|
|
999
|
+
words.append(el('b', null, title), el('small', null, says));
|
|
1000
|
+
const wrap = el('span', 'settings-switch');
|
|
1001
|
+
const box = el('input');
|
|
1002
|
+
box.type = 'checkbox';
|
|
1003
|
+
box.checked = Boolean(on);
|
|
956
1004
|
box.addEventListener('change', async () => {
|
|
957
1005
|
box.disabled = true;
|
|
958
|
-
const answer = await fetch(
|
|
1006
|
+
const answer = await fetch(path, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(payload(box.checked)) })
|
|
959
1007
|
.then((response) => response.ok).catch(() => false);
|
|
960
1008
|
if (!answer) box.checked = !box.checked;
|
|
961
1009
|
box.disabled = false;
|
|
962
1010
|
await refresh();
|
|
963
1011
|
});
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
1012
|
+
wrap.append(box, el('i'));
|
|
1013
|
+
line.append(words, wrap);
|
|
1014
|
+
options.append(line);
|
|
1015
|
+
};
|
|
1016
|
+
option(enlace.recall, t('Always include its notes'), t('Up to 3 of its notes go with every answer, not only when an agent asks for them.'), '/api/salas/enlaces/recall', (on) => ({ id: enlace.id, recall: on }));
|
|
1017
|
+
if (reader === data.salas) option(enlace.train, t('The Coordinator learns from it'), t('What the Coordinator reads here also goes into what it is trained with.'), '/api/salas/enlaces/train', (on) => ({ id: enlace.id, train: on }));
|
|
1018
|
+
option(enlace.state, t('It shares its state'), t('Its goal, phase, next step and what is open can be read too, never its files.'), '/api/salas/enlaces/allow', (on) => ({ id: enlace.id, field: 'state', on }));
|
|
1019
|
+
option(enlace.deliver, t('It receives delivered notes'), t('Notes can be handed to it; they wait for you to accept them before entering its memory.'), '/api/salas/enlaces/allow', (on) => ({ id: enlace.id, field: 'deliver', on }));
|
|
1020
|
+
node.append(options);
|
|
967
1021
|
const actions = el('div', 'sm-actions');
|
|
968
|
-
if (revoking.has(enlace.id)) actions.append(el('span', 'sm-ask', t('Nothing crosses from then on.')), button('sm-btn danger', t('
|
|
969
|
-
else actions.append(button('sm-btn ghost', t('
|
|
1022
|
+
if (revoking.has(enlace.id)) actions.append(el('span', 'sm-ask', t('Nothing crosses from then on.')), button('sm-btn danger small', t('Yes, cancel it'), () => revokeLink(enlace.id)), button('sm-btn ghost small', t('Keep the connection'), () => { revoking.delete(enlace.id); draw(); }));
|
|
1023
|
+
else actions.append(button('sm-btn ghost small', t('Cancel the connection'), () => { revoking.add(enlace.id); draw(); }));
|
|
970
1024
|
node.append(actions);
|
|
971
1025
|
return node;
|
|
972
1026
|
}
|
|
1027
|
+
// How a connection works, in three steps under the sheet's title, as the project map says its own
|
|
1028
|
+
// gestures: who shares, who looks up, and you sign — cancelled whenever you want.
|
|
1029
|
+
function drawLinkSteps() {
|
|
1030
|
+
let steps = ui.linksSheet.querySelector('.sm-link-steps');
|
|
1031
|
+
if (!steps) { steps = el('ol', 'sm-link-steps'); ui.linksNote.after(steps); }
|
|
1032
|
+
steps.replaceChildren(...[
|
|
1033
|
+
[t('Choose what it shares'), t('A project and what it learned: decisions, facts, preferences.')],
|
|
1034
|
+
[t('Choose who looks it up'), t('Another project, or the Coordinator, which sees them all.')],
|
|
1035
|
+
[t('You sign it'), t('Until a date or with no end. Cancel it here whenever you want.')],
|
|
1036
|
+
].map(([title, says], index) => { const item = el('li'); item.append(el('i', null, String(index + 1)), el('b', null, title), el('small', null, says)); return item; }));
|
|
1037
|
+
}
|
|
973
1038
|
function drawLinks(projects) {
|
|
974
1039
|
const enlaces = [...(data.enlaces ?? [])].sort((a, b) => {
|
|
975
1040
|
const direct = (one) => Number(one.rooms.a !== data.salas && one.rooms.b !== data.salas);
|
|
@@ -983,7 +1048,8 @@ function drawLinks(projects) {
|
|
|
983
1048
|
ui.linksSum.textContent = enlaces.length
|
|
984
1049
|
? [enlaces.length === 1 ? t('1 in force') : t('{n} in force', { n: enlaces.length }), t('{n} reads in 24 h', { n: reads })].join(' · ')
|
|
985
1050
|
: enough ? t('No connections yet.') : t('Add a project to connect it.');
|
|
986
|
-
ui.linksNote.textContent = t('A connection lets one project
|
|
1051
|
+
ui.linksNote.textContent = t('A connection lets one project look up what another already learned: its decisions, facts and preferences. It only reads, never changes the other project, and you can cancel it whenever you want.');
|
|
1052
|
+
drawLinkSteps();
|
|
987
1053
|
ui.links.replaceChildren(...enlaces.map(linkRow));
|
|
988
1054
|
if (!enlaces.length && ui.linksSheet.open) ui.linksSheet.close();
|
|
989
1055
|
drawMap(projects, enlaces);
|
|
@@ -1106,7 +1172,7 @@ function openGraph() {
|
|
|
1106
1172
|
const keys = el('span', 'surface-modes');
|
|
1107
1173
|
const close = button('surface-mode close x-close x-only', null, () => graphWindow.close());
|
|
1108
1174
|
close.setAttribute('aria-label', t('Close'));
|
|
1109
|
-
close.innerHTML =
|
|
1175
|
+
close.innerHTML = `<span class="x-icon">${trazo('close')}</span>`; // trusted
|
|
1110
1176
|
keys.append(close);
|
|
1111
1177
|
head.append(words, keys);
|
|
1112
1178
|
const stage = el('div', 'sm-graph-stage');
|
|
@@ -1448,24 +1514,45 @@ const WIDGETS = {
|
|
|
1448
1514
|
// Only for MADRE's author, in a copy run from source with the author's token (src/server.mjs, homeWidget):
|
|
1449
1515
|
// anywhere else the server has no such widget and Home never offers it.
|
|
1450
1516
|
'w-usage': { kind: 'usage', owner: true, name: () => t('MADRE usage'), about: () => t('How many copies of MADRE are on, which versions and whether people come back. Only you see this.'), size: 8, rows: 5 },
|
|
1517
|
+
// What fails in every copy (src/telemetry.mjs, madre.run's /api/telemetry, 2026-10-28): the author's
|
|
1518
|
+
// too, with the same token, and nowhere else.
|
|
1519
|
+
'w-errors': { kind: 'errors', owner: true, name: () => t('MADRE errors'), about: () => t('What fails in every copy of MADRE, by how many copies it reaches: the ones Diagnostics knows and the ones nobody catalogued. Only you see this.'), size: 8, rows: 5 },
|
|
1520
|
+
// The author's board (2026-10-30, madre.run's /api/metrics): copies on right now and off, installs,
|
|
1521
|
+
// updates and uninstalls by day, and where MADRE runs. Only in the author's copy run from source.
|
|
1522
|
+
'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
|
+
'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
|
+
'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 },
|
|
1451
1525
|
'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
|
+
// Your agenda (2026-10-28): every project's reminders by when they are due — late, today, tomorrow,
|
|
1527
|
+
// this week, later —, each settled here, and a new one written as you would say it. Read from the
|
|
1528
|
+
// reminders themselves (src/modules/reminders.mjs), not from a widget of the server.
|
|
1529
|
+
'w-agenda': { kind: 'agenda', name: () => t('Agenda'), about: () => t('Your reminders from every project, by day, and a new one written as you would say it.'), size: 4, rows: 4, read: async () => {
|
|
1530
|
+
const answer = await fetch('/api/reminders?all=1', { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null)).catch(() => null);
|
|
1531
|
+
if (answer?.prefs) reminderPrefs = answer.prefs;
|
|
1532
|
+
return answer ? { reminders: answer.reminders ?? [] } : null;
|
|
1533
|
+
} },
|
|
1452
1534
|
};
|
|
1453
1535
|
const DEFAULT_LAYOUT = { order: ['bishop', 'waiting', 'links', 'projects', 'decisions', 'attention', 'memory'], size: {}, rows: {} };
|
|
1454
1536
|
// What each tile is, drawn in the accent the person chose (the same line as the room's AJUSTES icons).
|
|
1455
1537
|
const TILE_ICONS = {
|
|
1456
|
-
'bishop': '
|
|
1457
|
-
'waiting': '
|
|
1458
|
-
'projects': '
|
|
1459
|
-
'links': '
|
|
1460
|
-
'decisions': '
|
|
1461
|
-
'attention': '
|
|
1462
|
-
'memory': '
|
|
1463
|
-
'w-system': '
|
|
1464
|
-
'w-servers': '
|
|
1465
|
-
'w-memory': '
|
|
1466
|
-
'w-coordinator': '
|
|
1467
|
-
'w-models': '
|
|
1468
|
-
'w-
|
|
1538
|
+
'bishop': trazo('coordinator'),
|
|
1539
|
+
'waiting': trazo('hourglass'),
|
|
1540
|
+
'projects': trazo('card'),
|
|
1541
|
+
'links': trazo('edge'),
|
|
1542
|
+
'decisions': trazo('checkbox'),
|
|
1543
|
+
'attention': trazo('alert'),
|
|
1544
|
+
'memory': trazo('database'),
|
|
1545
|
+
'w-system': trazo('chip'),
|
|
1546
|
+
'w-servers': trazo('server'),
|
|
1547
|
+
'w-memory': trazo('gauge'),
|
|
1548
|
+
'w-coordinator': trazo('trending'),
|
|
1549
|
+
'w-models': trazo('cube'),
|
|
1550
|
+
'w-agenda': trazo('calendar'),
|
|
1551
|
+
'w-usage': trazo('bars'),
|
|
1552
|
+
'w-errors': trazo('warning'),
|
|
1553
|
+
'w-live': trazo('broadcast'),
|
|
1554
|
+
'w-installs': trazo('download'),
|
|
1555
|
+
'w-environments': trazo('globe'),
|
|
1469
1556
|
};
|
|
1470
1557
|
const tileIcon = (id) => { const box = el('span', 'sm-tile-icon'); box.innerHTML = TILE_ICONS[id] ?? ''; return box; }; // trusted: our own SVG strings
|
|
1471
1558
|
const known = (id) => Object.hasOwn(HOME_TILES, id) || Object.hasOwn(WIDGETS, id);
|
|
@@ -1527,7 +1614,11 @@ const rowsOf = (id) => layout.rows?.[id] ?? (HOME_TILES[id] ?? WIDGETS[id])?.row
|
|
|
1527
1614
|
const PAIRED = window.matchMedia?.('(max-width: 1180px) and (min-width: 761px)');
|
|
1528
1615
|
PAIRED?.addEventListener?.('change', () => fitTiles());
|
|
1529
1616
|
function fitTile(node) {
|
|
1530
|
-
|
|
1617
|
+
// The Coordinator with no summary yet, across the whole board, is as tall as what it holds (2026-10-28):
|
|
1618
|
+
// its five rows only kept an empty box open. Beside other tiles it keeps its rows, and the box says
|
|
1619
|
+
// what will come there (salas-mac.css, the empty summary).
|
|
1620
|
+
const unsaid = node.id === 'sm-bishop' && !ui.work.list.childElementCount && !layout.rows?.bishop && node.getBoundingClientRect().width > ($(BOARD)?.getBoundingClientRect().width ?? Infinity) * 0.9;
|
|
1621
|
+
const own = unsaid ? 0 : rowsOf(node.dataset.tile);
|
|
1531
1622
|
const chosen = own && PAIRED?.matches && spanOf(node.dataset.tile) < 12 ? Math.max(3, own) : own;
|
|
1532
1623
|
node.classList.toggle('sm-fixed', chosen > 0);
|
|
1533
1624
|
// How many rows it has, for the tile's own CSS: a short tile shows what matters and leaves the rest.
|
|
@@ -1565,16 +1656,16 @@ function addTile(id) {
|
|
|
1565
1656
|
|
|
1566
1657
|
// The menu a right-click opens, shared by the tiles and the space between them: the same card and
|
|
1567
1658
|
// keys as a project's menu (pinsMenu), closed the same way.
|
|
1568
|
-
const MOVE_ICON = '
|
|
1569
|
-
const BEFORE_ICON = '
|
|
1570
|
-
const AFTER_ICON = '
|
|
1659
|
+
const MOVE_ICON = trazo('move');
|
|
1660
|
+
const BEFORE_ICON = trazo('back');
|
|
1661
|
+
const AFTER_ICON = trazo('next');
|
|
1571
1662
|
// A height is drawn as the rows it takes, out of five; «Automatic» as rows that follow the content.
|
|
1572
|
-
const heightIcon = (count) => `<svg viewBox="0 0 20 20" aria-hidden="true"><rect x="5.2" y="2.8" width="9.6" height="14.4" rx="2.4" fill="none" stroke="currentColor" stroke-width="1.
|
|
1663
|
+
const heightIcon = (count) => `<svg viewBox="0 0 20 20" aria-hidden="true"><rect x="5.2" y="2.8" width="9.6" height="14.4" rx="2.4" fill="none" stroke="currentColor" stroke-width="1.6" opacity=".45"/>${count ? `<rect x="7" y="${(15.4 - 10.8 * count / 5).toFixed(2)}" width="6" height="${(10.8 * count / 5).toFixed(2)}" rx="1.2" fill="currentColor"/>` : '<path d="M7.2 8.6 10 6l2.8 2.6M7.2 11.4 10 14l2.8-2.6" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>'}</svg>`;
|
|
1573
1664
|
// A size is drawn as the share of the row it takes: a third, a half, two thirds, all of it.
|
|
1574
|
-
const sizeIcon = (span) => `<svg viewBox="0 0 20 20" aria-hidden="true"><rect x="2.8" y="5.2" width="14.4" height="9.6" rx="2.4" fill="none" stroke="currentColor" stroke-width="1.
|
|
1575
|
-
const ADD_ICON = '
|
|
1576
|
-
const RESET_ICON = '
|
|
1577
|
-
const HIDE_ICON = '
|
|
1665
|
+
const sizeIcon = (span) => `<svg viewBox="0 0 20 20" aria-hidden="true"><rect x="2.8" y="5.2" width="14.4" height="9.6" rx="2.4" fill="none" stroke="currentColor" stroke-width="1.6" opacity=".45"/><rect x="4.6" y="7" width="${(10.8 * span / 12).toFixed(2)}" height="6" rx="1.2" fill="currentColor"/></svg>`;
|
|
1666
|
+
const ADD_ICON = trazo('add');
|
|
1667
|
+
const RESET_ICON = trazo('reset');
|
|
1668
|
+
const HIDE_ICON = trazo('minus');
|
|
1578
1669
|
function homeMenu(point, entries, label) {
|
|
1579
1670
|
pinsCloseMenu();
|
|
1580
1671
|
const menu = el('div', 'bar-card sm-menu');
|
|
@@ -1774,6 +1865,8 @@ document.querySelector('.sm-main')?.addEventListener('contextmenu', (event) => {
|
|
|
1774
1865
|
// it would need when nothing feeds it yet.
|
|
1775
1866
|
let homeAddSheet = null;
|
|
1776
1867
|
async function openHomeAdd() {
|
|
1868
|
+
// Asked again while it is open: the same window comes forward, not a second one.
|
|
1869
|
+
if (homeAddSheet?.open) { homeAddSheet.focus?.(); homeWindowForward(homeAddSheet); return; }
|
|
1777
1870
|
homeAddSheet?.remove();
|
|
1778
1871
|
homeAddSheet = el('dialog', 'sm-sheet sm-add-sheet');
|
|
1779
1872
|
const body = el('div', 'sm-sheet-body');
|
|
@@ -1783,7 +1876,7 @@ async function openHomeAdd() {
|
|
|
1783
1876
|
const keys = el('span', 'surface-modes');
|
|
1784
1877
|
const close = button('surface-mode close x-close x-only', null, () => homeAddSheet.close());
|
|
1785
1878
|
close.setAttribute('aria-label', t('Close'));
|
|
1786
|
-
close.innerHTML =
|
|
1879
|
+
close.innerHTML = `<span class="x-icon">${trazo('close')}</span>`; // trusted
|
|
1787
1880
|
keys.append(close);
|
|
1788
1881
|
head.append(keys);
|
|
1789
1882
|
body.append(head, el('p', 'hint', t('Tiles you took off and widgets you can put on Home. Right-click any tile to move it, resize it or take it off.')));
|
|
@@ -1793,9 +1886,30 @@ async function openHomeAdd() {
|
|
|
1793
1886
|
// The key's squares stay filled while the sheet it opened is there.
|
|
1794
1887
|
const key = document.getElementById('sm-add-widgets');
|
|
1795
1888
|
key?.classList.add('filled');
|
|
1796
|
-
homeAddSheet.addEventListener('close', () => { homeAddSheet?.remove(); homeAddSheet = null; key?.classList.remove('filled'); });
|
|
1797
1889
|
document.body.append(homeAddSheet);
|
|
1798
|
-
|
|
1890
|
+
// A window of Home, as Settings and the Market are (2026-10-28): carried by its head, sized by its
|
|
1891
|
+
// sides, its place kept. On a phone it stays the sheet it was.
|
|
1892
|
+
const sheetNow = homeAddSheet;
|
|
1893
|
+
const framed = homeWindow({ root: sheetNow, bar: head, close: () => sheetNow.close(), key: 'pulse.homeAddWindow', minW: 420, minH: 240, keys: false, size: { w: 560, h: 640 } });
|
|
1894
|
+
// As tall as its list, unless the person gave it a size of their own (2026-10-28): with two widgets
|
|
1895
|
+
// a window of 640 px was mostly empty.
|
|
1896
|
+
const fit = () => {
|
|
1897
|
+
if (!framed || !sheetNow.isConnected) return;
|
|
1898
|
+
let sized = null;
|
|
1899
|
+
try { sized = localStorage.getItem('pulse.homeAddWindow'); } catch { /* no storage: fit it */ }
|
|
1900
|
+
if (sized) return;
|
|
1901
|
+
// Down to the foot of its list: scrollHeight never says less than the window already is.
|
|
1902
|
+
const below = getComputedStyle(body);
|
|
1903
|
+
const need = Math.ceil(list.getBoundingClientRect().bottom - body.getBoundingClientRect().top + body.scrollTop + Number.parseFloat(below.paddingBottom) + Number.parseFloat(below.borderBottomWidth));
|
|
1904
|
+
if (need < sheetNow.getBoundingClientRect().height) framed.resize({ h: Math.max(240, need) });
|
|
1905
|
+
};
|
|
1906
|
+
sheetNow.addEventListener('close', () => { framed?.drop(); sheetNow.remove(); if (homeAddSheet === sheetNow) homeAddSheet = null; key?.classList.remove('filled'); });
|
|
1907
|
+
if (framed) {
|
|
1908
|
+
sheetNow.classList.add('sm-add-framed');
|
|
1909
|
+
sheetNow.addEventListener('keydown', (event) => { if (event.key === 'Escape' && !event.defaultPrevented) { event.preventDefault(); sheetNow.close(); } });
|
|
1910
|
+
sheetNow.show();
|
|
1911
|
+
framed.raise();
|
|
1912
|
+
} else sheetNow.showModal();
|
|
1799
1913
|
void homeTour.hint('home-add', list, { inside: true, title: t('Add to Home'), text: t('The tiles you took off and the widgets you can add. A widget shows up only when this Mac has something to put in it. Right-click any tile to move it, change its size or take it off.') });
|
|
1800
1914
|
// The author's widget is asked about before the list is drawn: where it cannot be read, it is not listed at all.
|
|
1801
1915
|
const ownerOk = new Set();
|
|
@@ -1807,7 +1921,7 @@ async function openHomeAdd() {
|
|
|
1807
1921
|
...Object.entries(HOME_TILES).filter(([id]) => !placed(id)).map(([id, spec]) => ({ id, spec, ready: true })),
|
|
1808
1922
|
...Object.entries(WIDGETS).filter(([id, spec]) => !placed(id) && (!spec.owner || ownerOk.has(id))).map(([id, spec]) => ({ id, spec, ready: null })),
|
|
1809
1923
|
];
|
|
1810
|
-
if (!entries.length) { list.append(el('p', 'sm-hint', t('Everything is already on Home.'))); return; }
|
|
1924
|
+
if (!entries.length) { list.append(el('p', 'sm-hint', t('Everything is already on Home.'))); fit(); return; }
|
|
1811
1925
|
for (const entry of entries) {
|
|
1812
1926
|
const row = el('div', 'sm-add-row');
|
|
1813
1927
|
row.append(tileIcon(entry.id));
|
|
@@ -1822,7 +1936,9 @@ async function openHomeAdd() {
|
|
|
1822
1936
|
if (entry.ready === null) {
|
|
1823
1937
|
add.disabled = true;
|
|
1824
1938
|
said.textContent = t('Checking…');
|
|
1825
|
-
|
|
1939
|
+
// One that reads for itself (the agenda) is ready when it can read: it has a box to start with.
|
|
1940
|
+
const reading = entry.spec.read ? ((await entry.spec.read()) ? { available: true } : { failed: true })
|
|
1941
|
+
: await fetch(`/api/salas/widget?kind=${entry.spec.kind}`, { cache: 'no-store' }).then((response) => (response.ok ? response.json() : { failed: response.status })).catch(() => ({ failed: true }));
|
|
1826
1942
|
if (!row.isConnected) return;
|
|
1827
1943
|
const ok = Boolean(reading?.available);
|
|
1828
1944
|
add.disabled = !ok;
|
|
@@ -1831,6 +1947,7 @@ async function openHomeAdd() {
|
|
|
1831
1947
|
said.textContent = ok ? '' : reading.failed === 404 ? t('This page is served by a project started before widgets existed: open Home from its own address, or restart that project.') : reading.failed ? t('It could not be read just now.') : (entry.spec.needs?.() ?? t('Nothing feeds it on this Mac yet.'));
|
|
1832
1948
|
}
|
|
1833
1949
|
}
|
|
1950
|
+
fit();
|
|
1834
1951
|
}
|
|
1835
1952
|
|
|
1836
1953
|
// ---- The widgets. Each is a tile that reads its own route every 20 s while Home is in view.
|
|
@@ -1845,7 +1962,197 @@ function meter(value, tone = null) {
|
|
|
1845
1962
|
}
|
|
1846
1963
|
const toneFor = (share) => (share >= 0.85 ? 'hot' : share >= 0.6 ? 'warm' : null);
|
|
1847
1964
|
const OS_WORDS = { darwin: 'macOS', linux: 'Linux', win32: 'Windows', other: () => t('other') };
|
|
1965
|
+
const osWord = (name) => { const word = OS_WORDS[name] ?? name; return typeof word === 'function' ? word() : word; };
|
|
1848
1966
|
const WIDGET_PAINT = {
|
|
1967
|
+
// The agenda: what is late and what is today first, then tomorrow, this week and later; a line per
|
|
1968
|
+
// reminder with its project and its keys; and a box for a new one, in the person's own words.
|
|
1969
|
+
agenda(body, reading, { again } = {}) {
|
|
1970
|
+
const list = reading.reminders ?? [];
|
|
1971
|
+
const now = new Date();
|
|
1972
|
+
const day = (offset) => { const one = new Date(now); one.setHours(0, 0, 0, 0); one.setDate(one.getDate() + offset); return one.getTime(); };
|
|
1973
|
+
const groups = [
|
|
1974
|
+
[t('Late'), (at) => at < now.getTime()],
|
|
1975
|
+
[t('Today'), (at) => at < day(1)],
|
|
1976
|
+
[t('Tomorrow'), (at) => at < day(2)],
|
|
1977
|
+
[t('This week'), (at) => at < day(7)],
|
|
1978
|
+
[t('Later'), () => true],
|
|
1979
|
+
];
|
|
1980
|
+
const used = new Set();
|
|
1981
|
+
const time = (due) => new Intl.DateTimeFormat(reminderLocale(), { hour: 'numeric', minute: '2-digit' }).format(new Date(due));
|
|
1982
|
+
const date = (due) => new Intl.DateTimeFormat(reminderLocale(), { weekday: 'short', day: 'numeric', month: 'short' }).format(new Date(due));
|
|
1983
|
+
const box = el('div', 'sm-agenda');
|
|
1984
|
+
let shown = 0;
|
|
1985
|
+
for (const [title, fits] of groups) {
|
|
1986
|
+
const mine = list.filter((one) => !used.has(one.id) && fits(Date.parse(one.due)));
|
|
1987
|
+
for (const one of mine) used.add(one.id);
|
|
1988
|
+
if (!mine.length || shown >= 6) continue;
|
|
1989
|
+
const group = el('div', `sm-agenda-group${title === t('Late') ? ' late' : ''}`);
|
|
1990
|
+
group.append(el('span', 'sm-agenda-day', title));
|
|
1991
|
+
for (const one of mine.slice(0, 6 - shown)) {
|
|
1992
|
+
shown += 1;
|
|
1993
|
+
const row = el('div', 'sm-agenda-row');
|
|
1994
|
+
const words = el('div', 'sm-agenda-words');
|
|
1995
|
+
const when = title === t('Today') || title === t('Late') || title === t('Tomorrow') ? time(one.due) : date(one.due);
|
|
1996
|
+
const room = data?.rooms.find((item) => item.id === one.room) ?? null;
|
|
1997
|
+
words.append(el('b', null, one.text), el('small', null, [when, room ? roomLabel(room) : one.project, one.repeat ? t('repeats') : null].filter(Boolean).join(' · ')));
|
|
1998
|
+
const done = button('sm-agenda-key', null, async () => { done.disabled = true; await settleReminder('/api/reminders/done', { id: one.id }); again?.(); });
|
|
1999
|
+
done.innerHTML = trazo('check'); // trusted
|
|
2000
|
+
done.setAttribute('aria-label', t('Done'));
|
|
2001
|
+
done.title = t('Done');
|
|
2002
|
+
const later = button('sm-agenda-later', t('Later'), async () => { later.disabled = true; await settleReminder('/api/reminders/snooze', { id: one.id, minutes: reminderPrefs.snooze }); again?.(); });
|
|
2003
|
+
row.append(done, words, later);
|
|
2004
|
+
group.append(row);
|
|
2005
|
+
}
|
|
2006
|
+
box.append(group);
|
|
2007
|
+
}
|
|
2008
|
+
if (!list.length) box.append(el('p', 'sm-hint sm-agenda-empty', t('Nothing on your agenda. Write one below, or ask an agent to remind you of something.')));
|
|
2009
|
+
else if (list.length > shown) box.append(el('p', 'sm-hint', t('And {n} more.', { n: list.length - shown })));
|
|
2010
|
+
// A new one, as you would say it: «tomorrow at 5 call Ana» (the time first is taken off the words).
|
|
2011
|
+
const form = el('form', 'sm-agenda-add');
|
|
2012
|
+
const input = el('input');
|
|
2013
|
+
input.type = 'text';
|
|
2014
|
+
input.autocomplete = 'off';
|
|
2015
|
+
input.placeholder = t('Remind me… (tomorrow at 5 call Ana)');
|
|
2016
|
+
input.setAttribute('aria-label', t('New reminder'));
|
|
2017
|
+
const add = el('button', 'sm-btn small', t('Add'));
|
|
2018
|
+
add.type = 'submit';
|
|
2019
|
+
const said = el('small', 'sm-agenda-said');
|
|
2020
|
+
form.append(input, add, said);
|
|
2021
|
+
form.addEventListener('submit', async (event) => {
|
|
2022
|
+
event.preventDefault();
|
|
2023
|
+
const text = input.value.trim();
|
|
2024
|
+
if (!text) { input.focus(); return; }
|
|
2025
|
+
add.disabled = true;
|
|
2026
|
+
const answer = await post('/api/reminders', { text });
|
|
2027
|
+
add.disabled = false;
|
|
2028
|
+
if (!answer.ok) { said.textContent = answer.body?.error ?? t('The reminder was not set.'); return; }
|
|
2029
|
+
input.value = '';
|
|
2030
|
+
input.blur();
|
|
2031
|
+
const due = answer.body?.reminder?.due;
|
|
2032
|
+
if (due) toast(t('Reminder set: {when}.', { when: reminderWhen(due) }));
|
|
2033
|
+
again?.();
|
|
2034
|
+
void loadReminders();
|
|
2035
|
+
});
|
|
2036
|
+
body.append(box, form);
|
|
2037
|
+
},
|
|
2038
|
+
// The author's board (2026-10-30): one reading of madre.run's /api/metrics for the three.
|
|
2039
|
+
live(body, reading) {
|
|
2040
|
+
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; }
|
|
2041
|
+
const live = reading.live ?? {};
|
|
2042
|
+
const lead = el('div', 'sm-usage-lead sm-live-lead');
|
|
2043
|
+
lead.append(el('i', `sm-live-dot${live.on ? ' on' : ''}`), el('b', 'sm-w-big', Number(live.on ?? 0).toLocaleString()), el('span', null, t('on right now')));
|
|
2044
|
+
body.append(lead);
|
|
2045
|
+
const grid = el('div', 'sm-w-grid sm-usage-figures');
|
|
2046
|
+
for (const [label, value, line] of [
|
|
2047
|
+
[t('Off now'), live.off, t('used this month, not on now')],
|
|
2048
|
+
[t('Last hour'), live.hour, t('on at some moment')],
|
|
2049
|
+
[t('Silent'), live.silent, t('diagnostics off or a MADRE before 1.1.0')],
|
|
2050
|
+
]) {
|
|
2051
|
+
const cell = el('div', 'sm-w-metric');
|
|
2052
|
+
cell.append(el('span', 'sm-w-label', label), el('b', 'sm-w-big', Number(value ?? 0).toLocaleString()), el('small', null, line));
|
|
2053
|
+
grid.append(cell);
|
|
2054
|
+
}
|
|
2055
|
+
body.append(grid);
|
|
2056
|
+
const shares = (list, word = (name) => name) => {
|
|
2057
|
+
const total = list.reduce((sum, one) => sum + one.n, 0);
|
|
2058
|
+
return list.slice(0, 4).map((one) => `${word(one.name)} ${total ? Math.round((one.n / total) * 100) : 0}%`).join(' · ') || '—';
|
|
2059
|
+
};
|
|
2060
|
+
const lines = el('div', 'sm-usage-lines');
|
|
2061
|
+
for (const [label, said] of [[t('Versions'), shares(live.versions ?? [])], [t('Systems'), shares(live.os ?? [], osWord)]]) {
|
|
2062
|
+
const row = el('div', 'sm-w-line');
|
|
2063
|
+
row.append(el('b', null, label), el('small', null, said));
|
|
2064
|
+
lines.append(row);
|
|
2065
|
+
}
|
|
2066
|
+
body.append(lines);
|
|
2067
|
+
},
|
|
2068
|
+
installs(body, reading) {
|
|
2069
|
+
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; }
|
|
2070
|
+
const life = reading.lifecycle ?? { days: [], totals: {} };
|
|
2071
|
+
const totals = life.totals ?? {};
|
|
2072
|
+
const grid = el('div', 'sm-w-grid sm-usage-figures');
|
|
2073
|
+
for (const [label, value, line, tone] of [
|
|
2074
|
+
[t('Installs'), totals.installs, t('new copies, 30 days'), 'up'],
|
|
2075
|
+
[t('Updates'), totals.updates, t('a new version opened'), null],
|
|
2076
|
+
[t('Uninstalls'), totals.uninstalls, t('from Settings'), 'down'],
|
|
2077
|
+
[t('Home opened'), totals.starts, t('times, every copy'), null],
|
|
2078
|
+
]) {
|
|
2079
|
+
const cell = el('div', `sm-w-metric${tone ? ` sm-life-${tone}` : ''}`);
|
|
2080
|
+
cell.append(el('span', 'sm-w-label', label), el('b', 'sm-w-big', Number(value ?? 0).toLocaleString()), el('small', null, line));
|
|
2081
|
+
grid.append(cell);
|
|
2082
|
+
}
|
|
2083
|
+
body.append(grid);
|
|
2084
|
+
// Each day: installs up from the line, uninstalls down from it, updates as a quieter part of the bar.
|
|
2085
|
+
const days = life.days ?? [];
|
|
2086
|
+
const top = Math.max(1, ...days.map((one) => one.installs + one.updates), ...days.map((one) => one.uninstalls));
|
|
2087
|
+
const chart = el('div', 'sm-usage-chart');
|
|
2088
|
+
const bars = el('div', 'sm-life-days');
|
|
2089
|
+
bars.setAttribute('role', 'img');
|
|
2090
|
+
bars.setAttribute('aria-label', t('Installs, updates and uninstalls on each day, last 30 days'));
|
|
2091
|
+
const shortDay = (day) => new Date(`${day}T12:00:00Z`).toLocaleDateString(document.documentElement.lang === 'en' ? 'en-US' : 'es-MX', { day: 'numeric', month: 'short' });
|
|
2092
|
+
for (const one of days) {
|
|
2093
|
+
const day = el('span');
|
|
2094
|
+
const up = el('i', 'up');
|
|
2095
|
+
up.style.setProperty('--h', String((one.installs + one.updates) / top));
|
|
2096
|
+
up.style.setProperty('--part', String(one.installs + one.updates ? one.installs / (one.installs + one.updates) : 0));
|
|
2097
|
+
const down = el('i', 'down');
|
|
2098
|
+
down.style.setProperty('--h', String(one.uninstalls / top));
|
|
2099
|
+
day.append(up, down);
|
|
2100
|
+
day.title = t('{day}: {installs} installed · {updates} updated · {uninstalls} uninstalled', { day: shortDay(one.day), installs: one.installs, updates: one.updates, uninstalls: one.uninstalls });
|
|
2101
|
+
bars.append(day);
|
|
2102
|
+
}
|
|
2103
|
+
const axis = el('div', 'sm-usage-axis');
|
|
2104
|
+
axis.append(el('small', null, shortDay(days[0]?.day ?? reading.today)), el('small', 'sm-usage-legend', ''), el('small', null, t('today')));
|
|
2105
|
+
axis.children[1].append(el('i', 'is-new'), t('installed'), el('i', 'is-on'), t('updated'), el('i', 'is-down'), t('uninstalled'));
|
|
2106
|
+
chart.append(bars, axis);
|
|
2107
|
+
body.append(chart);
|
|
2108
|
+
body.append(el('p', 'sm-hint', t('{n} copies were heard for the first time in these 30 days, those from before 1.1.0 included.', { n: Number(totals.firstSeen ?? 0).toLocaleString() })));
|
|
2109
|
+
},
|
|
2110
|
+
environments(body, reading) {
|
|
2111
|
+
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; }
|
|
2112
|
+
const env = reading.env ?? {};
|
|
2113
|
+
const copies = Number(env.copies ?? 0);
|
|
2114
|
+
body.append(el('p', 'sm-hint', copies ? t('{n} copies this month, each by what it said last. Copies from before 1.1.0 say less: «?» is what they did not say.', { n: copies.toLocaleString() }) : t('No copy has said its environment yet: it starts with 1.1.0.')));
|
|
2115
|
+
if (!copies) return;
|
|
2116
|
+
const share = (n) => `${Math.round((n / copies) * 100)}%`;
|
|
2117
|
+
const SYSTEMS = { darwin: 'macOS', linux: 'Linux', win32: 'Windows', wsl: 'WSL', other: t('other') };
|
|
2118
|
+
const CHANNELS = { npx: 'npx', global: t('installed (npm -g)'), project: t('inside a project'), source: t('from source') };
|
|
2119
|
+
const LANGS = { es: t('Spanish'), en: t('English') };
|
|
2120
|
+
const AGENT_NAMES = { claude: 'Claude', codex: 'Codex', gemini: 'Gemini', opencode: 'OpenCode', cursor: 'Cursor' };
|
|
2121
|
+
const said = (list, words = {}) => (list ?? []).filter((one) => one.name !== '?').slice(0, 5).map((one) => `${words[one.name] ?? one.name} ${share(one.n)}`).join(' · ') || '—';
|
|
2122
|
+
const lines = el('div', 'sm-usage-lines sm-env-lines');
|
|
2123
|
+
for (const [label, text] of [
|
|
2124
|
+
[t('Systems'), said(env.systems, SYSTEMS)],
|
|
2125
|
+
[t('Chip'), said(env.arch, { arm64: 'Apple / ARM', x64: 'x64' })],
|
|
2126
|
+
[t('Memory'), said(env.ram)],
|
|
2127
|
+
[t('Cores'), said(env.cores)],
|
|
2128
|
+
[t('Installed with'), said(env.channel, CHANNELS)],
|
|
2129
|
+
[t('Language'), said(env.language, LANGS)],
|
|
2130
|
+
[t('Shell'), said(env.shell)],
|
|
2131
|
+
[t('Node'), said(env.node, Object.fromEntries((env.node ?? []).map((one) => [one.name, `Node ${one.name}`])))],
|
|
2132
|
+
[t('Agents installed'), said(env.agents, AGENT_NAMES)],
|
|
2133
|
+
[t('Agents ready'), said(env.agentsReady, AGENT_NAMES)],
|
|
2134
|
+
[t('Local AI'), t('installed {a} · on {b}', { a: share(env.localAi?.installed ?? 0), b: share(env.localAi?.running ?? 0) })],
|
|
2135
|
+
[t('Modules on'), said(env.modules)],
|
|
2136
|
+
]) {
|
|
2137
|
+
const row = el('div', 'sm-w-line');
|
|
2138
|
+
row.append(el('b', null, label), el('small', null, text));
|
|
2139
|
+
lines.append(row);
|
|
2140
|
+
}
|
|
2141
|
+
body.append(lines);
|
|
2142
|
+
// Projects per copy, the figure that sets the free limit of 1.1.1: a bar for each range.
|
|
2143
|
+
const ranges = ['0', '1', '2–5', '6–10', '11–20', '> 20'];
|
|
2144
|
+
const counts = new Map((env.projects ?? []).map((one) => [one.name, one.n]));
|
|
2145
|
+
const known = ranges.reduce((sum, name) => sum + (counts.get(name) ?? 0), 0);
|
|
2146
|
+
const box = el('div', 'sm-env-projects');
|
|
2147
|
+
box.append(el('b', null, t('Projects per copy')));
|
|
2148
|
+
for (const name of ranges) {
|
|
2149
|
+
const n = counts.get(name) ?? 0;
|
|
2150
|
+
const row = el('div', 'sm-env-range');
|
|
2151
|
+
row.append(el('span', null, name), meter(known ? n / known : 0), el('small', null, known ? `${n} · ${Math.round((n / known) * 100)}%` : '—'));
|
|
2152
|
+
box.append(row);
|
|
2153
|
+
}
|
|
2154
|
+
body.append(box);
|
|
2155
|
+
},
|
|
1849
2156
|
usage(body, reading) {
|
|
1850
2157
|
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; }
|
|
1851
2158
|
const n = (value) => Number(value ?? 0).toLocaleString();
|
|
@@ -1931,6 +2238,58 @@ const WIDGET_PAINT = {
|
|
|
1931
2238
|
foot.append(form);
|
|
1932
2239
|
body.append(foot);
|
|
1933
2240
|
},
|
|
2241
|
+
// What fails in every copy, the widest first (2026-10-28). Each with what it is (its MU code when
|
|
2242
|
+
// Diagnostics knows it), how many copies and times, which versions and systems, MADRE's own lines
|
|
2243
|
+
// it went through, and the author's word on it.
|
|
2244
|
+
errors(body, reading, { again } = {}) {
|
|
2245
|
+
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; }
|
|
2246
|
+
const open = reading.errors.filter((one) => one.status !== 'ignored' && one.status !== 'fixed');
|
|
2247
|
+
const fresh = open.filter((one) => one.status === 'new').length;
|
|
2248
|
+
const lead = el('div', 'sm-usage-lead');
|
|
2249
|
+
lead.append(el('b', 'sm-w-big', String(open.length)), el('span', null, t('failures in the last 30 days')), el('small', `sm-usage-trend${fresh ? ' down' : ''}`, fresh ? t('{n} not looked at yet', { n: fresh }) : t('all looked at')));
|
|
2250
|
+
body.append(lead);
|
|
2251
|
+
// How much MADRE was used in the same days, so a failure reads against the work it interrupted.
|
|
2252
|
+
const turns = Object.entries(reading.usage?.totals ?? {}).filter(([key]) => /^turn\.[a-z]/.test(key) && !['turn.attachments', 'turn.ash'].includes(key));
|
|
2253
|
+
const modes = Object.entries(reading.usage?.totals ?? {}).filter(([key]) => /^mode\.\d$/.test(key));
|
|
2254
|
+
const all = (list) => list.reduce((sum, [, n]) => sum + n, 0);
|
|
2255
|
+
const lines = el('div', 'sm-usage-lines');
|
|
2256
|
+
for (const [label, said] of [
|
|
2257
|
+
[t('Copies'), t('{n} sent diagnostics', { n: reading.copies })],
|
|
2258
|
+
[t('Turns'), turns.length ? turns.sort((a, b) => b[1] - a[1]).slice(0, 5).map(([key, n]) => `@${key.slice(5)} ${Math.round((n / all(turns)) * 100)}%`).join(' · ') : '—'],
|
|
2259
|
+
[t('Modes'), modes.length ? modes.sort((a, b) => a[0].localeCompare(b[0])).map(([key, n]) => `#${key.slice(5)} ${Math.round((n / all(modes)) * 100)}%`).join(' · ') : '—'],
|
|
2260
|
+
]) {
|
|
2261
|
+
const row = el('div', 'sm-w-line');
|
|
2262
|
+
row.append(el('b', null, label), el('small', null, said));
|
|
2263
|
+
lines.append(row);
|
|
2264
|
+
}
|
|
2265
|
+
body.append(lines);
|
|
2266
|
+
const list = el('div', 'sm-errors');
|
|
2267
|
+
for (const one of reading.errors.slice(0, 12)) {
|
|
2268
|
+
const row = el('details', `sm-fail is-${one.status}`);
|
|
2269
|
+
const head = el('summary');
|
|
2270
|
+
const what = one.code ? one.code : { agent: t('Agent'), crash: t('Crash'), route: t('Route'), page: t('Page'), install: t('Install'), model: t('Model'), startup: t('Start'), other: t('Other') }[one.kind] ?? one.kind;
|
|
2271
|
+
head.append(el('span', 'sm-fail-what', `${what}${one.agent ? ` · @${one.agent}` : ''}`), el('span', 'sm-fail-said', one.message), el('small', null, t('{copies} copies · {hits} times', { copies: one.copies, hits: one.hits })));
|
|
2272
|
+
row.append(head);
|
|
2273
|
+
const systems = one.systems.map((name) => { const word = OS_WORDS[name] ?? name; return typeof word === 'function' ? word() : word; }).join(', ');
|
|
2274
|
+
const facts = el('p', 'sm-hint', [one.versions.map((v) => `v${v}`).join(', '), `${systems}${one.wsl ? ' · WSL' : ''}`, t('last {when}', { when: new Date(one.last_seen).toLocaleString(document.documentElement.lang === 'en' ? 'en-US' : 'es-MX', { day: 'numeric', month: 'short', hour: 'numeric', minute: '2-digit' }) })].filter(Boolean).join(' · '));
|
|
2275
|
+
row.append(facts);
|
|
2276
|
+
if (one.frames.length) { const code = el('code', 'sm-error-frames', one.frames.join('\n')); row.append(code); }
|
|
2277
|
+
const keys = el('div', 'sm-error-keys');
|
|
2278
|
+
for (const [status, words] of [['known', t('Known')], ['fixed', t('Fixed')], ['ignored', t('Ignore')]]) {
|
|
2279
|
+
const key = button(`sm-btn small${one.status === status ? ' on' : ''}`, words, async () => {
|
|
2280
|
+
key.disabled = true;
|
|
2281
|
+
const answer = await post('/api/salas/errors/status', { fp: one.fp, status: one.status === status ? 'new' : status });
|
|
2282
|
+
if (!answer.ok) { key.disabled = false; toast(t('madre.run could not be reached.'), 'error'); return; }
|
|
2283
|
+
again?.();
|
|
2284
|
+
});
|
|
2285
|
+
keys.append(key);
|
|
2286
|
+
}
|
|
2287
|
+
row.append(keys);
|
|
2288
|
+
list.append(row);
|
|
2289
|
+
}
|
|
2290
|
+
if (!reading.errors.length) list.append(el('p', 'sm-hint', t('No failures in the last 30 days.')));
|
|
2291
|
+
body.append(list);
|
|
2292
|
+
},
|
|
1934
2293
|
system(body, reading) {
|
|
1935
2294
|
const cpu = el('div', 'sm-w-metric');
|
|
1936
2295
|
cpu.append(el('span', 'sm-w-label', t('Processor')), el('b', 'sm-w-big', pct(reading.cpu.busy)), meter(reading.cpu.busy, toneFor(reading.cpu.busy ?? 0)), el('small', null, t('{n} cores · load {load}', { n: reading.cpu.cores, load: reading.cpu.load[0] })));
|
|
@@ -1976,7 +2335,7 @@ const WIDGET_PAINT = {
|
|
|
1976
2335
|
top.append(el('b', 'sm-w-big', `${reading.pairs}`), el('span', null, t('of {n} exchanges to train on', { n: reading.target })));
|
|
1977
2336
|
body.append(top, meter(share));
|
|
1978
2337
|
body.append(el('p', 'sm-w-says', [reading.stage, reading.says].filter(Boolean).join(' · ')));
|
|
1979
|
-
const facts = [
|
|
2338
|
+
const facts = [memoriesCount(reading.notes ?? 0), reading.trained ? t('model {name}', { name: reading.trained }) : t('no model of its own yet')];
|
|
1980
2339
|
body.append(el('small', 'sm-w-foot', facts.join(' · ')));
|
|
1981
2340
|
},
|
|
1982
2341
|
models(body, reading) {
|
|
@@ -2015,13 +2374,15 @@ function makeWidget(id) {
|
|
|
2015
2374
|
let timer = 0;
|
|
2016
2375
|
const read = async () => {
|
|
2017
2376
|
if (document.hidden || !node.isConnected) return;
|
|
2018
|
-
|
|
2377
|
+
// A field being written in is never redrawn under the person (the agenda's new reminder).
|
|
2378
|
+
if (body.contains(document.activeElement) && document.activeElement.matches('input, textarea')) return;
|
|
2379
|
+
const reading = spec.read ? await spec.read() : await fetch(`/api/salas/widget?kind=${spec.kind}`, { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null)).catch(() => null);
|
|
2019
2380
|
if (!node.isConnected) return;
|
|
2020
2381
|
body.replaceChildren();
|
|
2021
2382
|
// The author's widget is not there at all for a copy that cannot read it (no token, not from source).
|
|
2022
2383
|
if (spec.owner) node.hidden = !reading;
|
|
2023
2384
|
if (!reading) { body.append(el('p', 'sm-hint', t('It could not be read just now.'))); return; }
|
|
2024
|
-
WIDGET_PAINT[spec.kind](body, reading);
|
|
2385
|
+
WIDGET_PAINT[spec.kind](body, reading, { again: () => void read() });
|
|
2025
2386
|
fitTile(node);
|
|
2026
2387
|
// The first time it shows, what it is (homeTour is set up below this, so it is read late).
|
|
2027
2388
|
if (!node.dataset.guided) { node.dataset.guided = '1'; setTimeout(() => { try { guideWidget(node, spec.kind); } catch { /* the tour is not up yet */ } }, 1500); }
|
|
@@ -2039,7 +2400,8 @@ applyLayout();
|
|
|
2039
2400
|
// THE WELCOME OF 1.0 (public/tour.js): the bonjour the first time, the chapters after it, the pill
|
|
2040
2401
|
// that waits in the bar, `?` for the gestures, and the hint on Connections. In Home, «Take me
|
|
2041
2402
|
// there» opens what lives here; for what lives inside a project it opens the one open most
|
|
2042
|
-
// recently, if any is. A new person
|
|
2403
|
+
// recently, if any is. A new person meets the welcome (public/welcome.js) in place of the bonjour,
|
|
2404
|
+
// and its last step leads to the chapters.
|
|
2043
2405
|
const agentsReady = () => (agentsSeen?.agents ?? []).some((agent) => agent.id !== 'madre' && agentState(agent, agentsSeen).ok);
|
|
2044
2406
|
const intoAProject = () => {
|
|
2045
2407
|
const room = data ? projectsInOrder().open[0] : null;
|
|
@@ -2049,8 +2411,8 @@ const homeTour = startTour({
|
|
|
2049
2411
|
page: 'home',
|
|
2050
2412
|
pillSlot: $('sm-tour-pill'),
|
|
2051
2413
|
hidden: () => (data?.phonePreview ? [] : ['phone']),
|
|
2052
|
-
ready: () => Boolean(data) && !
|
|
2053
|
-
welcome: { needed: () => !projectsInOrder().all.length || !agentsReady(), open: (then) =>
|
|
2414
|
+
ready: () => Boolean(data) && !welcomeOpen() && !sheet,
|
|
2415
|
+
welcome: { instead: true, needed: () => !projectsInOrder().all.length || !agentsReady(), open: (then) => openHomeWelcome({ then }) },
|
|
2054
2416
|
onProjects: () => void refresh(),
|
|
2055
2417
|
go: {
|
|
2056
2418
|
get project() { return intoAProject(); },
|
|
@@ -2095,6 +2457,11 @@ const WIDGET_GUIDE = {
|
|
|
2095
2457
|
coordinator: () => t('How far the Coordinator\'s own record is from training a model of its own.'),
|
|
2096
2458
|
models: () => t('Ollama and its models, and how many examples each project has toward a model of its own (8/300 is 8 of 300). «Choose projects» sets which ones use the local AI.'),
|
|
2097
2459
|
usage: () => t('How many copies of MADRE are on, which versions and whether people come back. Only you see this.'),
|
|
2460
|
+
errors: () => t('What fails in every copy of MADRE, by how many copies it reaches. Mark each one known, fixed or ignored; a fixed one that happens again comes back as new.'),
|
|
2461
|
+
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
|
+
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
|
+
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.'),
|
|
2464
|
+
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.'),
|
|
2098
2465
|
};
|
|
2099
2466
|
function guideWidget(node, kind) {
|
|
2100
2467
|
const said = WIDGET_GUIDE[kind];
|
|
@@ -2108,6 +2475,8 @@ function welcomeHome() {
|
|
|
2108
2475
|
if (welcomeAsked) return;
|
|
2109
2476
|
welcomeAsked = true;
|
|
2110
2477
|
void homeTour.loaded.then(async (answer) => {
|
|
2478
|
+
welcomeSeen = answer?.state?.welcome ?? null;
|
|
2479
|
+
drawAttention();
|
|
2111
2480
|
// Someone new meets the bonjour and the chapters on this same visit: Home's cards come after
|
|
2112
2481
|
// them, once Home is quiet again, not only on the next visit as they did (2026-10-20).
|
|
2113
2482
|
// Someone who met MADRE just now (src/tour.mjs, `met`) is walked through Home once the bonjour
|
|
@@ -2222,9 +2591,9 @@ function sayBold(key, vars, bold = Object.keys(vars)) {
|
|
|
2222
2591
|
out.append(template.slice(at));
|
|
2223
2592
|
return out;
|
|
2224
2593
|
}
|
|
2225
|
-
const ALLOWED_GLYPH = '
|
|
2226
|
-
const NOT_ALLOWED_GLYPH = '
|
|
2227
|
-
const BOTH_WAYS_ICON = '
|
|
2594
|
+
const ALLOWED_GLYPH = trazo('check');
|
|
2595
|
+
const NOT_ALLOWED_GLYPH = trazo('close');
|
|
2596
|
+
const BOTH_WAYS_ICON = trazo('swap');
|
|
2228
2597
|
function openLinkSheet({ reader = null, source = null } = {}) {
|
|
2229
2598
|
if (!data || sheet) return;
|
|
2230
2599
|
const rooms = [...data.rooms].sort((x, y) => Number(Boolean(y.open)) - Number(Boolean(x.open)) || roomLabel(x).localeCompare(roomLabel(y)));
|
|
@@ -2294,8 +2663,14 @@ function openLinkSheet({ reader = null, source = null } = {}) {
|
|
|
2294
2663
|
const seg = el('div', 'sx-seg');
|
|
2295
2664
|
seg.setAttribute('role', 'radiogroup');
|
|
2296
2665
|
seg.setAttribute('aria-label', label);
|
|
2666
|
+
// A choice slides the mark and says it over the scene; the step is not drawn again (2026-10-28:
|
|
2667
|
+
// drawing it again made the whole sheet blink at every press).
|
|
2297
2668
|
for (const [value, words] of options) {
|
|
2298
|
-
const one = button(null, words, () => {
|
|
2669
|
+
const one = button(null, words, () => {
|
|
2670
|
+
choose(value);
|
|
2671
|
+
for (const other of seg.children) other.setAttribute('aria-checked', String(other === one));
|
|
2672
|
+
paintStage();
|
|
2673
|
+
});
|
|
2299
2674
|
one.setAttribute('role', 'radio');
|
|
2300
2675
|
one.setAttribute('aria-checked', String(value === current));
|
|
2301
2676
|
seg.append(one);
|
|
@@ -2431,7 +2806,9 @@ function openLinkSheet({ reader = null, source = null } = {}) {
|
|
|
2431
2806
|
stage.append(terms);
|
|
2432
2807
|
}
|
|
2433
2808
|
|
|
2434
|
-
|
|
2809
|
+
// `still`: the same step drawn again for a choice that adds or takes rows (orders), without the
|
|
2810
|
+
// step's entrance, so nothing blinks.
|
|
2811
|
+
function render({ back = false, still = false } = {}) {
|
|
2435
2812
|
settle();
|
|
2436
2813
|
const steps = stepsNow();
|
|
2437
2814
|
at = Math.min(at, steps.length - 1);
|
|
@@ -2440,7 +2817,7 @@ function openLinkSheet({ reader = null, source = null } = {}) {
|
|
|
2440
2817
|
const dots = el('ol', 'sm-steps');
|
|
2441
2818
|
steps.forEach((name, index) => dots.append(el('li', index === at ? 'on' : index < at ? 'done' : null, STEP_WORDS[name]())));
|
|
2442
2819
|
head.append(dots, closeKey(() => sheet.close()));
|
|
2443
|
-
const page = el('div', `sm-step lw-step${back ? ' back' : ''}`);
|
|
2820
|
+
const page = el('div', `sm-step lw-step${back ? ' back' : ''}${still ? ' still' : ''}`);
|
|
2444
2821
|
// The swap, on the first step: it turns the link round, and the scene shows it.
|
|
2445
2822
|
const turn = button('sm-btn small', t('Swap'), () => { [pick.reader, pick.source] = [pick.source, pick.reader]; render(); });
|
|
2446
2823
|
const intro = (title, lead) => {
|
|
@@ -2507,7 +2884,7 @@ function openLinkSheet({ reader = null, source = null } = {}) {
|
|
|
2507
2884
|
const box = card();
|
|
2508
2885
|
box.classList.add('lw-grid');
|
|
2509
2886
|
for (const kindOf of LINK_KINDS) {
|
|
2510
|
-
box.append(row(kindWord(kindOf), LINK_KIND_NOTES[kindOf](), toggle(pick.kinds.has(kindOf), (on) => { if (on) pick.kinds.add(kindOf); else pick.kinds.delete(kindOf); error.textContent = '';
|
|
2887
|
+
box.append(row(kindWord(kindOf), LINK_KIND_NOTES[kindOf](), toggle(pick.kinds.has(kindOf), (on) => { if (on) pick.kinds.add(kindOf); else pick.kinds.delete(kindOf); error.textContent = ''; paintStage(); }, kindWord(kindOf)), { recommended: kindOf === 'decision' || kindOf === 'fact', dot: kindOf }));
|
|
2511
2888
|
}
|
|
2512
2889
|
page.append(box, el('p', 'lw-foot', t('Only the notes already in use are shared, cleaned of private data first. Never your files, your whole conversations or the notes you set aside.')));
|
|
2513
2890
|
actions.append(next(() => (pick.kinds.size ? null : t('Choose at least one kind.'))));
|
|
@@ -2517,19 +2894,19 @@ function openLinkSheet({ reader = null, source = null } = {}) {
|
|
|
2517
2894
|
const ends = el('div', 'lw-control');
|
|
2518
2895
|
ends.append(rail(LINK_DAYS.map(([value, words]) => [value, words()]), pick.days, (value) => { pick.days = value; }, t('It ends')));
|
|
2519
2896
|
box.append(row(t('It ends'), t('A week is enough to try it; signing it again takes a moment.'), ends, { recommended: pick.days === 7 }));
|
|
2520
|
-
box.append(row(t('Always include'), t('With every question it gets up to 3 related notes without looking for them; each time counts toward the hourly limit. Off, its agents look them up only when they need to.'), toggle(pick.recall, (on) => { pick.recall = on;
|
|
2897
|
+
box.append(row(t('Always include'), t('With every question it gets up to 3 related notes without looking for them; each time counts toward the hourly limit. Off, its agents look them up only when they need to.'), toggle(pick.recall, (on) => { pick.recall = on; paintStage(); }, t('Always include'))));
|
|
2521
2898
|
// D-S15: only with the Coordinator reading, and only by you.
|
|
2522
|
-
if (coordinator(pick.reader)) box.append(row(t('The Coordinator learns from it'), t("Its notes also go into the training of the Coordinator's local AI, so it knows this project without opening it. Clearing it or revoking takes it out of the next export; a model already trained keeps what it learned until you train it again."), toggle(pick.train, (on) => { pick.train = on;
|
|
2899
|
+
if (coordinator(pick.reader)) box.append(row(t('The Coordinator learns from it'), t("Its notes also go into the training of the Coordinator's local AI, so it knows this project without opening it. Clearing it or revoking takes it out of the next export; a model already trained keeps what it learned until you train it again."), toggle(pick.train, (on) => { pick.train = on; paintStage(); }, t('The Coordinator learns from it'))));
|
|
2523
2900
|
// D-S16 and D-S17: by you only, off unless you turn them on.
|
|
2524
|
-
box.append(row(t('It shares its state'), t('Besides its notes, its canonical state as Continuity keeps it: objective, phase, next step, its last handoff, decisions and what is still open. Only if the project has Continuity installed; never its files or its code.'), toggle(pick.state, (on) => { pick.state = on;
|
|
2525
|
-
box.append(row(t('It receives delivered notes'), t('The project that reads can hand it notes. They wait there until you accept them (or an agent of that project in #3 EDIT or above): nothing enters its memory on its own.'), toggle(pick.deliver, (on) => { pick.deliver = on;
|
|
2901
|
+
box.append(row(t('It shares its state'), t('Besides its notes, its canonical state as Continuity keeps it: objective, phase, next step, its last handoff, decisions and what is still open. Only if the project has Continuity installed; never its files or its code.'), toggle(pick.state, (on) => { pick.state = on; paintStage(); }, t('It shares its state'))));
|
|
2902
|
+
box.append(row(t('It receives delivered notes'), t('The project that reads can hand it notes. They wait there until you accept them (or an agent of that project in #3 EDIT or above): nothing enters its memory on its own.'), toggle(pick.deliver, (on) => { pick.deliver = on; paintStage(); }, t('It receives delivered notes'))));
|
|
2526
2903
|
page.append(box);
|
|
2527
2904
|
actions.append(next());
|
|
2528
2905
|
} else if (kind === 'orders') {
|
|
2529
2906
|
const name = nameOf(ordersInto());
|
|
2530
2907
|
intro(t('Orders from the Coordinator'), sayBold('With orders, the Coordinator can ask {room} for a task, and its agents do it there. Without them, it only reads. #3 EDIT and #4 FULL ACCESS never go this way: they arrive as a proposal you unlock in that project.', { room: name }));
|
|
2531
2908
|
const box = card();
|
|
2532
|
-
box.append(row(sayBold('Allow orders into {room}', { room: name }), sayBold('Leave it off unless you need the Coordinator to act in {room}.', { room: name }), toggle(pick.orders, (on) => { pick.orders = on; render(); }, t('Allow orders into {room}', { room: name })), { recommended: !pick.orders }));
|
|
2909
|
+
box.append(row(sayBold('Allow orders into {room}', { room: name }), sayBold('Leave it off unless you need the Coordinator to act in {room}.', { room: name }), toggle(pick.orders, (on) => { pick.orders = on; render({ still: true }); }, t('Allow orders into {room}', { room: name })), { recommended: !pick.orders }));
|
|
2533
2910
|
if (pick.orders) {
|
|
2534
2911
|
const modes = el('div', 'lw-control');
|
|
2535
2912
|
modes.append(rail([1, 2].map((n) => [n, `#${n} ${modeName(n)}`]), pick.maxMode, (value) => { pick.maxMode = value; }, t('Up to which mode')));
|
|
@@ -2607,11 +2984,18 @@ let refreshPending = null;
|
|
|
2607
2984
|
// 4 s replaced the button under the pointer and the click went nowhere (2026-10-19).
|
|
2608
2985
|
let drawnRooms = '';
|
|
2609
2986
|
let drawnRoomsAt = 0;
|
|
2987
|
+
// MADRE's pulse says how Home stands with its server (2026-10-28): the dot at its end green while it
|
|
2988
|
+
// answers, red when it does not, amber while an answer is slow to come (styles.css, data-link).
|
|
2989
|
+
const setLink = (state) => { root.dataset.link = state; };
|
|
2990
|
+
setLink('waiting');
|
|
2610
2991
|
async function refresh({ polled = false } = {}) {
|
|
2611
2992
|
if (refreshPending) return refreshPending;
|
|
2612
2993
|
refreshPending = fetch('/api/salas', { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null)).catch(() => null);
|
|
2994
|
+
const slow = setTimeout(() => setLink('waiting'), 2500);
|
|
2613
2995
|
const answer = await refreshPending;
|
|
2996
|
+
clearTimeout(slow);
|
|
2614
2997
|
refreshPending = null;
|
|
2998
|
+
setLink(answer ? 'live' : 'lost');
|
|
2615
2999
|
if (!answer) { ui.foot.textContent = t('This project did not answer. It may have closed.'); ui.bar.live.classList.add('is-off'); ui.bar.live.lastChild.textContent = t('Not answering right now'); return; }
|
|
2616
3000
|
// Home is the first screen of `npx madre`: a MADRE nobody has set takes this browser's language
|
|
2617
3001
|
// here, once, and every project follows (public/i18n.js, browserLanguage).
|
|
@@ -2622,18 +3006,103 @@ async function refresh({ polled = false } = {}) {
|
|
|
2622
3006
|
const mine = chosenHere === 'es' || chosenHere === 'en' ? chosenHere : browserLanguage();
|
|
2623
3007
|
if (await post('/api/language', { language: mine }).then((response) => response?.ok !== false).catch(() => false)) answer.language = mine;
|
|
2624
3008
|
}
|
|
2625
|
-
if (answer.language && answer.language !== language)
|
|
3009
|
+
if (answer.language && answer.language !== language) sayIn(answer.language);
|
|
2626
3010
|
data = answer;
|
|
2627
3011
|
// A project that came up after Home stopped waiting is open: its card no longer says it did not.
|
|
2628
3012
|
for (const room of answer.rooms ?? []) if (room.open) failed.delete(room.id);
|
|
2629
3013
|
ui.foot.textContent = t('Every project runs on this Mac, on its own, with its own memory.');
|
|
2630
|
-
// The room's corner (app.js, #colophon): the version this Home runs, and NOTICE's own line.
|
|
2631
|
-
if (answer.version) { drawAttribution(ui.colophon, answer.version); void drawColophonKeys(ui.colophon); }
|
|
2632
3014
|
const said = JSON.stringify(answer, (key, value) => (key === 'at' ? undefined : value));
|
|
2633
3015
|
if (polled && said === drawnRooms && Date.now() - drawnRoomsAt < 60000) return;
|
|
2634
3016
|
drawnRooms = said;
|
|
2635
3017
|
drawnRoomsAt = Date.now();
|
|
3018
|
+
// The room's corner (app.js, #colophon): the version this Home runs, and NOTICE's own line —
|
|
3019
|
+
// drawn when the answer changed, not on every poll.
|
|
3020
|
+
if (answer.version) { drawAttribution(ui.colophon, answer.version); void drawColophonKeys(ui.colophon); }
|
|
2636
3021
|
draw();
|
|
3022
|
+
if (!newsAsked) { newsAsked = true; setTimeout(() => void homeNews(), 1200); }
|
|
3023
|
+
}
|
|
3024
|
+
|
|
3025
|
+
// WHAT IS NEW, ON HOME (1.1, 2026-10-28): whoever comes from an older MADRE lands here first now, so
|
|
3026
|
+
// Home says what changed — the same notes and the same board as a project (src/whats-new.mjs, app.js
|
|
3027
|
+
// showWhatsNew), shorter: a card each, and «Start». Once per version, per person (the server
|
|
3028
|
+
// remembers it); never over the welcome, a sheet or a window, nor on a first install.
|
|
3029
|
+
let newsAsked = false;
|
|
3030
|
+
async function homeNews(tries = 0) {
|
|
3031
|
+
const news = await fetch('/api/whats-new', { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null)).catch(() => null);
|
|
3032
|
+
if (!news?.show || !news.notes) return;
|
|
3033
|
+
// The welcome or another window first: the board waits for them to close (a few minutes at most).
|
|
3034
|
+
if (welcomeOpen() || document.querySelector('dialog[open]')) { if (tries < 120) setTimeout(() => void homeNews(tries + 1), 3000); return; }
|
|
3035
|
+
const pick = (value) => (value && typeof value === 'object' && !Array.isArray(value) ? value[language] ?? value.es ?? value.en : value);
|
|
3036
|
+
const notes = news.notes;
|
|
3037
|
+
const dialog = el('dialog', 'whats-new home-news');
|
|
3038
|
+
dialog.setAttribute('aria-label', t("What's new in MADRE {version}", { version: news.version }));
|
|
3039
|
+
const sheet = el('div', 'wn-sheet');
|
|
3040
|
+
const head = el('header', 'wn-head');
|
|
3041
|
+
const words = el('div', 'wn-headline');
|
|
3042
|
+
const logo = document.querySelector('.side-brand .brand-logo, #sm-back .brand-logo')?.cloneNode?.(true);
|
|
3043
|
+
if (logo) { logo.setAttribute('class', 'brand-logo wn-logo'); words.append(logo); }
|
|
3044
|
+
words.append(el('span', 'wn-eyebrow', t("What's new")), el('h2', null, t('You now have {version}', { version: String(news.version).replace(/\.0$/, '') })));
|
|
3045
|
+
if (notes.intro) words.append(el('p', 'wn-intro', pick(notes.intro)));
|
|
3046
|
+
head.append(words, closeKey(() => dialog.close()));
|
|
3047
|
+
const grid = el('div', 'wn-board');
|
|
3048
|
+
for (const item of notes.items ?? []) {
|
|
3049
|
+
const card = el('div', 'wn-card');
|
|
3050
|
+
const shot = el('span', 'wn-shot wn-card-shot');
|
|
3051
|
+
if (item.image) {
|
|
3052
|
+
const image = el('img');
|
|
3053
|
+
image.alt = pick(item.title) ?? '';
|
|
3054
|
+
image.loading = 'lazy';
|
|
3055
|
+
image.decoding = 'async';
|
|
3056
|
+
image.addEventListener('error', () => { shot.classList.add('missing'); image.remove(); });
|
|
3057
|
+
image.addEventListener('load', () => shot.classList.add('loaded'));
|
|
3058
|
+
image.src = pick(item.image);
|
|
3059
|
+
shot.append(image);
|
|
3060
|
+
} else shot.classList.add('missing');
|
|
3061
|
+
card.append(shot, el('b', 'wn-card-title', pick(item.title)), el('span', 'wn-card-line', pick(item.body)));
|
|
3062
|
+
grid.append(card);
|
|
3063
|
+
}
|
|
3064
|
+
const body = el('div', 'wn-body');
|
|
3065
|
+
body.append(grid);
|
|
3066
|
+
const foot = el('footer', 'wn-foot');
|
|
3067
|
+
const changes = news.changes?.[language] ?? news.changes?.es;
|
|
3068
|
+
if (changes) {
|
|
3069
|
+
const link = el('a', 'wn-changes', t('See every change ↗'));
|
|
3070
|
+
link.href = changes; link.target = '_blank'; link.rel = 'noopener noreferrer';
|
|
3071
|
+
foot.append(link);
|
|
3072
|
+
}
|
|
3073
|
+
const start = button('wn-start', t('Start'), () => dialog.close());
|
|
3074
|
+
foot.append(start);
|
|
3075
|
+
sheet.append(head, body, foot);
|
|
3076
|
+
dialog.append(sheet);
|
|
3077
|
+
dialog.addEventListener('close', () => dialog.remove());
|
|
3078
|
+
document.body.append(dialog);
|
|
3079
|
+
dialog.showModal();
|
|
3080
|
+
// Whoever comes from an older MADRE meets MADRE's opening first (2026-10-30), as a new person does in
|
|
3081
|
+
// the welcome (loader.js, playOpening), and the board comes after it — unless this page just played it
|
|
3082
|
+
// (public/terms.js, after the new license was accepted).
|
|
3083
|
+
if (openingPlayed()) start.focus({ preventScroll: true });
|
|
3084
|
+
else void playOpening(dialog, { skipLabel: t('Skip') }).then(() => start.focus({ preventScroll: true }));
|
|
3085
|
+
// Seen once shown, as in a project: a board left open and the page closed is not owed again.
|
|
3086
|
+
void fetch('/api/whats-new/seen', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' }).catch(() => null);
|
|
3087
|
+
}
|
|
3088
|
+
|
|
3089
|
+
// Home in another language, without a reload: what it says now, and every widget and the tour's pill.
|
|
3090
|
+
function sayIn(code) {
|
|
3091
|
+
language = setLanguage(code);
|
|
3092
|
+
root.lang = language;
|
|
3093
|
+
translateStatic();
|
|
3094
|
+
drawAttention();
|
|
3095
|
+
drawDecisions();
|
|
3096
|
+
drawWork();
|
|
3097
|
+
for (const widget of document.querySelectorAll('.sm-widget')) widget.say?.();
|
|
3098
|
+
homeTour.repaint();
|
|
3099
|
+
}
|
|
3100
|
+
// Chosen in the welcome's first step: kept for every project (as Settings › Language keeps it), and
|
|
3101
|
+
// said at once.
|
|
3102
|
+
async function adoptLanguage(code) {
|
|
3103
|
+
try { localStorage.setItem('pulse.language', code); } catch { /* no storage */ }
|
|
3104
|
+
await post('/api/language', { language: code });
|
|
3105
|
+
sayIn(code);
|
|
2637
3106
|
}
|
|
2638
3107
|
|
|
2639
3108
|
async function startRoom(room, { enter = false } = {}) {
|
|
@@ -2702,6 +3171,13 @@ async function closeRoom(room) {
|
|
|
2702
3171
|
const answer = await fetch('/api/salas/close', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ room: room.id }) })
|
|
2703
3172
|
.then(async (response) => ({ ok: response.ok, body: await response.json().catch(() => ({})) })).catch(() => ({ ok: false, body: {} }));
|
|
2704
3173
|
if (answer.body.here) {
|
|
3174
|
+
// Home as a project serves it (2026-10-28): closing that project took this page with it and it
|
|
3175
|
+
// read as all of MADRE off. When Home itself is open on its own address, the page goes there.
|
|
3176
|
+
const home = data?.rooms.find((one) => one.id === data.salas && one.open?.port);
|
|
3177
|
+
if (home && home.id !== room.id && String(home.open.port) !== location.port) {
|
|
3178
|
+
setTimeout(() => { location.href = `${location.protocol}//${location.hostname}:${home.open.port}/salas`; }, 900);
|
|
3179
|
+
return;
|
|
3180
|
+
}
|
|
2705
3181
|
// This page goes with the room that serves it: it says so, and stops asking.
|
|
2706
3182
|
clearInterval(timer);
|
|
2707
3183
|
document.body.classList.add('sm-gone');
|
|
@@ -2728,17 +3204,18 @@ function macroWords() {
|
|
|
2728
3204
|
return {
|
|
2729
3205
|
title: t('Project map'),
|
|
2730
3206
|
back: t('Back to Home'),
|
|
2731
|
-
|
|
3207
|
+
// How to move round it, as keys of this computer; on a phone, where there are none, its line.
|
|
3208
|
+
hint: homeShellOn() ? mapKeys('projects') : t('Drag the space to move it · wheel to come closer · click a project to look at it · drag it to turn it · carry one onto the Coordinator for the Coordinator to read it, or onto another to connect them · ← → from one to the next · Esc to come back'),
|
|
2732
3209
|
bishop: t('Coordinator'),
|
|
2733
3210
|
bishopAbout: t('Your Coordinator. It reads across your projects, signs the connections between them and carries an order from one to another.'),
|
|
2734
3211
|
bishopReads: (n) => (n ? (n === 1 ? t('It reads 1 project by a connection') : t('It reads {n} projects by connections', { n })) : t('It reads no project yet: each one it reads is a connection you sign.')),
|
|
2735
3212
|
notLinked: t('Not connected yet: touch one to connect it'),
|
|
2736
3213
|
talk: t('Talk to the Coordinator'),
|
|
2737
3214
|
asleep: t('Asleep'),
|
|
2738
|
-
recenter: t('RECENTER'),
|
|
3215
|
+
recenter: asLabel(t('RECENTER')),
|
|
2739
3216
|
// The legend under its name, in the Memory map's words.
|
|
2740
3217
|
legend: t('Memory kinds'),
|
|
2741
|
-
kinds: { ...Object.fromEntries(KINDS.map((kind) => [kind, kindWord(kind)])), dim: t('NOT USED') },
|
|
3218
|
+
kinds: { ...Object.fromEntries(KINDS.map((kind) => [kind, kindWord(kind)])), dim: asLabel(t('NOT USED')) },
|
|
2742
3219
|
veins: (n) => t('{n} connections', { n }),
|
|
2743
3220
|
links: t('Connections'),
|
|
2744
3221
|
link: t('Connect…'),
|
|
@@ -2753,12 +3230,12 @@ function macroWords() {
|
|
|
2753
3230
|
const open = rooms.filter((room) => room.open);
|
|
2754
3231
|
const memories = open.reduce((sum, room) => sum + (room.glance?.census?.memories ?? 0), 0);
|
|
2755
3232
|
const waiting = open.filter((room) => room.glance?.waitingCount).length;
|
|
2756
|
-
return [data?.mac ?? null, t('{n} projects', { n: rooms.length }), waiting ? t('{n} waiting for you', { n: waiting }) : null,
|
|
3233
|
+
return [data?.mac ?? null, t('{n} projects', { n: rooms.length }), waiting ? t('{n} waiting for you', { n: waiting }) : null, memoriesCount(memories)].filter(Boolean).join(' · ');
|
|
2757
3234
|
},
|
|
2758
3235
|
state: (room) => stateOf(room).words,
|
|
2759
3236
|
path: homeWord,
|
|
2760
3237
|
ask: askLine,
|
|
2761
|
-
kind: (kind) =>
|
|
3238
|
+
kind: (kind) => kindWord(kind),
|
|
2762
3239
|
counts: (room) => (room.open ? [conversationsCount(room.glance?.chats ?? 0), memoriesCount(room.glance?.census?.memories ?? 0)].join(' · ') : room.lastOpened ? t('Asleep · last open {when}', { when: ago(room.lastOpened) }) : t('Asleep')),
|
|
2763
3240
|
enter: t('Enter the project'),
|
|
2764
3241
|
backToRoom: t('Back to the project'),
|
|
@@ -2823,10 +3300,48 @@ ui.macro.addEventListener('click', async () => {
|
|
|
2823
3300
|
wake: async (room) => { await startRoom(room); },
|
|
2824
3301
|
// Dragged from one universe onto another: the notes of the first would travel to the second.
|
|
2825
3302
|
link: (source, reader) => openLinkSheet({ source: source?.id ?? null, reader: reader?.id ?? null }),
|
|
2826
|
-
|
|
3303
|
+
// Planets or neurons, said once and after the map itself was (homeTour 'home-map').
|
|
3304
|
+
mayTellViews: () => { const seen = homeTour.state(); return Boolean(seen?.bonjourAt && seen.hints?.['home-map'] && !seen.hints['map-views'] && !document.querySelector('.tour-hint')); },
|
|
3305
|
+
toldViews: () => void homeTour.seen('map-views'),
|
|
3306
|
+
closed: () => { macroFrame?.drop(); macroFrame = null; macro = null; document.body.classList.remove('sm-in-macro'); ui.macro.focus(); },
|
|
2827
3307
|
},
|
|
2828
3308
|
});
|
|
3309
|
+
frameMacro();
|
|
2829
3310
|
});
|
|
3311
|
+
// THE PROJECT MAP AS A WINDOW (2026-10-28), as a project's Memory map can be one (app.js,
|
|
3312
|
+
// showNostromoDialog): the whole screen, or a window over Home from a key in its head, carried and
|
|
3313
|
+
// sized as Home's windows are (homeWindow). How it was left is how it opens the next time.
|
|
3314
|
+
const MACRO_WINDOW_KEY = 'pulse.homeMapWindow';
|
|
3315
|
+
let macroFrame = null;
|
|
3316
|
+
const macroFloats = () => { try { return localStorage.getItem(`${MACRO_WINDOW_KEY}.on`) === '1'; } catch { return false; } };
|
|
3317
|
+
function frameMacro() {
|
|
3318
|
+
const layer = macro?.layer;
|
|
3319
|
+
if (!layer || !homeShellOn()) return;
|
|
3320
|
+
let key = layer.querySelector('.nostromo-float');
|
|
3321
|
+
if (!key) {
|
|
3322
|
+
key = button('mother-close nostromo-float', null, () => {
|
|
3323
|
+
const on = !macroFrame;
|
|
3324
|
+
try { localStorage.setItem(`${MACRO_WINDOW_KEY}.on`, on ? '1' : '0'); } catch { /* as long as the page lasts */ }
|
|
3325
|
+
frameMacro();
|
|
3326
|
+
});
|
|
3327
|
+
key.innerHTML = trazo('window'); // trusted: our own SVG
|
|
3328
|
+
const track = layer.querySelector('.nostromo-actions > .surface-modes');
|
|
3329
|
+
if (track) track.before(key); else layer.querySelector('.nostromo-actions')?.append(key);
|
|
3330
|
+
}
|
|
3331
|
+
const floating = macroFloats();
|
|
3332
|
+
if (floating && !macroFrame) {
|
|
3333
|
+
macroFrame = homeWindow({ root: layer, bar: layer.querySelector('.mv-head'), close: () => macro?.close(), key: MACRO_WINDOW_KEY, minW: 480, minH: 360, keys: false, size: { w: 980, h: 680 } });
|
|
3334
|
+
document.body.classList.remove('sm-in-macro');
|
|
3335
|
+
} else if (!floating && macroFrame) {
|
|
3336
|
+
macroFrame.release();
|
|
3337
|
+
macroFrame = null;
|
|
3338
|
+
document.body.classList.add('sm-in-macro');
|
|
3339
|
+
}
|
|
3340
|
+
const said = macroFrame ? t('Fill the screen') : t('Open as a window');
|
|
3341
|
+
key.setAttribute('aria-pressed', String(Boolean(macroFrame)));
|
|
3342
|
+
key.title = said;
|
|
3343
|
+
key.setAttribute('aria-label', said);
|
|
3344
|
+
}
|
|
2830
3345
|
window.addEventListener('resize', () => { if (data) ui.macro.hidden = !data.rooms.length || window.innerWidth < 900; });
|
|
2831
3346
|
|
|
2832
3347
|
ui.stop.addEventListener('click', async () => {
|
|
@@ -2893,12 +3408,12 @@ function drawTopbar() {
|
|
|
2893
3408
|
// browser's own (localStorage), as the room keeps its bar.
|
|
2894
3409
|
const PIN_KEY = 'pulse.lobbyBar';
|
|
2895
3410
|
const PIN_TYPE = 'application/x-madre-room';
|
|
2896
|
-
const PIN_MINUS = '
|
|
2897
|
-
const PIN_ICON = '
|
|
2898
|
-
const UNPIN_ICON = '
|
|
2899
|
-
const ARRANGE_ICON = '
|
|
2900
|
-
const FORGET_ICON = '
|
|
2901
|
-
const MORE_ICON = '
|
|
3411
|
+
const PIN_MINUS = trazo('minus');
|
|
3412
|
+
const PIN_ICON = trazo('pin');
|
|
3413
|
+
const UNPIN_ICON = trazo('unpin');
|
|
3414
|
+
const ARRANGE_ICON = trazo('arrange');
|
|
3415
|
+
const FORGET_ICON = trazo('forget');
|
|
3416
|
+
const MORE_ICON = trazo('more');
|
|
2902
3417
|
const pins = {
|
|
2903
3418
|
saved: null, // what this page decided, for when storage will not keep it
|
|
2904
3419
|
chips: new Map(), // room id → its key on the bar
|
|
@@ -3003,6 +3518,8 @@ function pinsPlace(ids) {
|
|
|
3003
3518
|
}
|
|
3004
3519
|
function drawPins() {
|
|
3005
3520
|
const box = ui.bar.open;
|
|
3521
|
+
// In the chat shell the projects at hand are the sidebar's (drawSideProjects), not the bar's.
|
|
3522
|
+
if (homeShellOn()) { box.hidden = true; pinsFit(); drawSideProjects(); return; }
|
|
3006
3523
|
const ids = pinsShown();
|
|
3007
3524
|
for (const id of ids) {
|
|
3008
3525
|
const room = data.rooms.find((one) => one.id === id);
|
|
@@ -3253,8 +3770,11 @@ function pinsMenu(event, room, at = null) {
|
|
|
3253
3770
|
menu.append(one);
|
|
3254
3771
|
};
|
|
3255
3772
|
const on = pinsShown().includes(room.id);
|
|
3256
|
-
|
|
3257
|
-
|
|
3773
|
+
// In the chat shell the projects at hand live in the sidebar, and it says so; its order is the
|
|
3774
|
+
// menu's and the drop's, so there is no bar to arrange.
|
|
3775
|
+
const side = homeShellOn();
|
|
3776
|
+
item(on ? (side ? t('Remove from the sidebar') : t('Remove from the bar')) : (side ? t('Keep in the sidebar') : t('Pin to the bar')), on ? UNPIN_ICON : PIN_ICON, () => (on ? pinRemove(room.id) : pinAdd(room.id)));
|
|
3777
|
+
if (!side) item(t('Arrange the bar'), ARRANGE_ICON, () => pinsEdit(true));
|
|
3258
3778
|
menu.append(el('i', 'sm-menu-sep'));
|
|
3259
3779
|
// Where it sits among the projects: moved by hand, the order becomes «Yours».
|
|
3260
3780
|
const order = projectsInOrder().all.map((one) => one.id);
|
|
@@ -3563,10 +4083,10 @@ for (const [way, alwaysNew] of [[ui.bishop.go, false], [ui.bishop.tab, true]]) {
|
|
|
3563
4083
|
// level at a time; a search narrows either. Several can be chosen; a folder already in Home says
|
|
3564
4084
|
// so and is not offered again. The sheet never runs past the screen: the tiles take as many rows
|
|
3565
4085
|
// as it holds, and ‹ › turn the page, so nothing scrolls inside it.
|
|
3566
|
-
const SEARCH_GLYPH = '
|
|
3567
|
-
const PAGE_BACK = '
|
|
3568
|
-
const PAGE_ON = '
|
|
3569
|
-
const FOLD_TICK = '
|
|
4086
|
+
const SEARCH_GLYPH = trazo('search');
|
|
4087
|
+
const PAGE_BACK = trazo('back');
|
|
4088
|
+
const PAGE_ON = trazo('next');
|
|
4089
|
+
const FOLD_TICK = trazo('check');
|
|
3570
4090
|
const FOLD_ROWS = 5;
|
|
3571
4091
|
|
|
3572
4092
|
// The tiles and their pages. How many rows is measured, not guessed: from five down to two, the
|
|
@@ -3653,7 +4173,7 @@ function foldTile({ name, path, note = null, project = true, known = false, chec
|
|
|
3653
4173
|
tick.innerHTML = FOLD_TICK;
|
|
3654
4174
|
glyph.append(tick);
|
|
3655
4175
|
const words = el('span', 'sm-fold-words');
|
|
3656
|
-
words.append(el('b', null, name), el('small', null, note ?? homeWord(path)));
|
|
4176
|
+
words.append(el('b', null, name), el('small', note ? 'note' : null, note ?? homeWord(path)));
|
|
3657
4177
|
item.append(box, glyph, words);
|
|
3658
4178
|
if (enter) {
|
|
3659
4179
|
const into = button('sm-into', null, (event) => { event.preventDefault(); enter(); });
|
|
@@ -3711,7 +4231,7 @@ function projectPicker({ onAdded = null, onChange = null, withAdd = true } = {})
|
|
|
3711
4231
|
makeKey.type = 'submit';
|
|
3712
4232
|
const freshError = el('p', 'error');
|
|
3713
4233
|
fresh.append(nameField, whereLine, makeKey, freshError);
|
|
3714
|
-
const parentNow = () => (here?.path && here.path !== here.home ? here.path : here?.home ?? null);
|
|
4234
|
+
const parentNow = () => (here?.path && here.path !== here.home ? here.path : here?.defaultParent ?? here?.home ?? null);
|
|
3715
4235
|
const sayWhere = () => {
|
|
3716
4236
|
whereLine.replaceChildren(el('span', null, t('The folder is made in')), ' ', el('code', null, parentNow() ? homeWord(parentNow()) : '~'), ' ');
|
|
3717
4237
|
const other = button('sm-new-other', t('Choose another place'), () => { touched = true; source = 'browse'; draw(); if (!here) void walk(); });
|
|
@@ -3839,7 +4359,7 @@ function closeKey(onClick) {
|
|
|
3839
4359
|
const key = button('surface-mode close x-close x-only', null, onClick);
|
|
3840
4360
|
key.setAttribute('aria-label', t('Close'));
|
|
3841
4361
|
const icon = el('span', 'x-icon');
|
|
3842
|
-
icon.innerHTML = '
|
|
4362
|
+
icon.innerHTML = trazo('close');
|
|
3843
4363
|
key.append(icon);
|
|
3844
4364
|
track.append(key);
|
|
3845
4365
|
return track;
|
|
@@ -3871,6 +4391,10 @@ const openHomeMarket = (tab = 'shop', focus = null) => openMarket({
|
|
|
3871
4391
|
tab,
|
|
3872
4392
|
focus,
|
|
3873
4393
|
host: {
|
|
4394
|
+
// In the chat shell the Market is a window, as in a project (homeWindow); on a phone, the screen.
|
|
4395
|
+
// It opens as wide as the screen allows (2026-10-30: a box in the middle read cramped); the size
|
|
4396
|
+
// a person gives it is kept under a new name, so the old narrow one is not brought back.
|
|
4397
|
+
window: (parts) => homeWindow({ ...parts, key: 'pulse.homeMarketWindow.wide', size: { w: 1920, h: 1400 } }),
|
|
3874
4398
|
localAi: () => openSettings('local'),
|
|
3875
4399
|
toast: (words) => toast(words),
|
|
3876
4400
|
changed: () => drawColophonKeys(ui.colophon),
|
|
@@ -4002,9 +4526,39 @@ const openCodeProviders = (() => {
|
|
|
4002
4526
|
};
|
|
4003
4527
|
})();
|
|
4004
4528
|
|
|
4005
|
-
|
|
4529
|
+
// What went wrong with an install or a sign-in, in plain words (2026-10-28): the server names the
|
|
4530
|
+
// cause in one word (src/setup-trouble.mjs) and this says it and what to do. Home used to drop these
|
|
4531
|
+
// failures: the person pressed Install, nothing happened, and nothing said why.
|
|
4532
|
+
const TROUBLE_WORDS = {
|
|
4533
|
+
install: {
|
|
4534
|
+
network: () => t('It could not download: there is no internet connection, or something on this network blocked it. Check your connection and try again.'),
|
|
4535
|
+
permission: () => t('This computer did not let MADRE install it. Try again; if it fails again, install it from a terminal (below).'),
|
|
4536
|
+
disk: () => t('There is not enough free space on this computer to install it.'),
|
|
4537
|
+
'npm-missing': () => t('Installing it needs Node and npm, and this computer does not have them. Install Node from nodejs.org, then try again.'),
|
|
4538
|
+
timeout: () => t('It took too long and was stopped. Try again.'),
|
|
4539
|
+
unknown: () => t('It did not install.'),
|
|
4540
|
+
},
|
|
4541
|
+
login: {
|
|
4542
|
+
'refused-account': () => null,
|
|
4543
|
+
network: () => t('It could not connect: there is no internet connection, or something on this network blocked it.'),
|
|
4544
|
+
timeout: () => t('The connection was not finished in time. Start it again.'),
|
|
4545
|
+
cancelled: () => t('You cancelled the connection.'),
|
|
4546
|
+
unknown: () => t('The connection did not finish.'),
|
|
4547
|
+
},
|
|
4548
|
+
};
|
|
4549
|
+
// The card of Diagnostics for each of those (public/troubleshooting.js), opened beside the failure.
|
|
4550
|
+
const TROUBLE_CARDS = {
|
|
4551
|
+
install: { network: 'install-offline', timeout: 'install-offline', permission: 'install-needs-admin', disk: 'disk-full', 'npm-missing': 'node-missing' },
|
|
4552
|
+
login: { network: 'install-offline', timeout: 'sign-in-unfinished', cancelled: 'sign-in-unfinished', unknown: 'sign-in-unfinished' },
|
|
4553
|
+
};
|
|
4554
|
+
const troubleCard = (agent, kind, cause) => (kind === 'login' && cause === 'refused-account' ? (agent === 'gemini' ? 'gemini-ineligible-tier' : 'not-signed-in') : TROUBLE_CARDS[kind]?.[cause] ?? null);
|
|
4555
|
+
function agentsPanel({ onPaint = null, compact = false, explain = null } = {}) {
|
|
4006
4556
|
const list = el('div', 'sm-agents');
|
|
4007
4557
|
const lastLine = new Map(); // agent → what its install or sign-in said last
|
|
4558
|
+
// Installing right now, from a press here (QA 1.1.0, NUE-03): the key says so and waits, instead
|
|
4559
|
+
// of offering «Install» again while npm works; the installer's own last line goes when it ends.
|
|
4560
|
+
const installing = new Set();
|
|
4561
|
+
const trouble = new Map(); // agent → what went wrong last, said in plain words, until it works
|
|
4008
4562
|
const openMore = new Set(); // agents whose connection detail is unfolded
|
|
4009
4563
|
const foldedMore = new Set(); // agents the person folded, even one that would open by itself
|
|
4010
4564
|
let live = null; // the sign-in running right now, as the server tells it
|
|
@@ -4142,19 +4696,43 @@ function agentsPanel({ onPaint = null, compact = false } = {}) {
|
|
|
4142
4696
|
head.append(mark(agent.id, 34), words, chip, el('span', 'sm-chevron'));
|
|
4143
4697
|
item.append(head);
|
|
4144
4698
|
const body = el('div', 'sm-agent-body');
|
|
4699
|
+
// The welcome says first what this agent needs (public/welcome.js): Gemini's key, Cursor's own
|
|
4700
|
+
// installer, a code when MADRE runs on another computer.
|
|
4701
|
+
const why = explain?.(agent, state, answer);
|
|
4702
|
+
if (why) body.append(why);
|
|
4145
4703
|
// Which account it is signed in with, as its own CLI reports it, and which one it asks for.
|
|
4146
4704
|
const facts = el('div', 'sm-agent-facts');
|
|
4147
4705
|
if (agent.detected && agent.version) facts.append(el('code', 'sm-agent-line', `${agent.version}${agent.path ? ` · ${agent.path}` : ''}`));
|
|
4148
4706
|
const said = agent.detected ? sessionDetail(answer.sessions?.[agent.id]) : null;
|
|
4149
4707
|
if (said) facts.append(el('small', 'sm-agent-line', said));
|
|
4150
|
-
|
|
4151
|
-
|
|
4708
|
+
// In the welcome, Gemini's account is already said above its card (welcome.js, explainAgent):
|
|
4709
|
+
// said twice in two ways, it read as two different requirements (QA 1.1.0, NUE-04).
|
|
4710
|
+
if (agent.account && !(compact && agent.id === 'gemini' && !state.ok)) facts.append(el('small', 'sm-agent-note', agent.account));
|
|
4711
|
+
// Installed, the installer's last line («added 2 packages in 4s») has nothing left to say.
|
|
4712
|
+
if (agent.detected && !installing.has(agent.id) && !state.busyNow && !answer.loggingIn) lastLine.delete(agent.id);
|
|
4713
|
+
if (lastLine.has(agent.id) && !state.ok && !trouble.has(agent.id)) {
|
|
4152
4714
|
const said = lastLine.get(agent.id);
|
|
4153
4715
|
const line = el('small', 'sm-agent-line', said.line);
|
|
4154
4716
|
if (said.url) { const link = el('a', null, t('Open the sign-in page')); link.href = said.url; link.target = '_blank'; link.rel = 'noopener'; line.append(' ', link); }
|
|
4155
4717
|
facts.append(line);
|
|
4156
4718
|
}
|
|
4157
4719
|
if (facts.childNodes.length) body.append(facts);
|
|
4720
|
+
// What went wrong, said where it happened, with what the program printed last for whoever
|
|
4721
|
+
// wants to look closer. It goes away once the agent works.
|
|
4722
|
+
if (state.ok) trouble.delete(agent.id);
|
|
4723
|
+
const wrong = trouble.get(agent.id);
|
|
4724
|
+
if (wrong && !state.busyNow) {
|
|
4725
|
+
const box = el('div', `sm-agent-trouble${wrong.tone === 'quiet' ? ' quiet' : ''}`);
|
|
4726
|
+
box.setAttribute('role', 'status');
|
|
4727
|
+
box.append(el('p', null, wrong.words));
|
|
4728
|
+
if (wrong.detail) {
|
|
4729
|
+
const more = el('details', 'sm-agent-trouble-more');
|
|
4730
|
+
more.append(el('summary', null, t('What it said')), el('code', null, wrong.detail));
|
|
4731
|
+
box.append(more);
|
|
4732
|
+
}
|
|
4733
|
+
if (wrong.card) box.append(remedyKey(wrong.card));
|
|
4734
|
+
body.append(box);
|
|
4735
|
+
}
|
|
4158
4736
|
// One button per account the CLI can sign in with: Claude has two, and only the human can
|
|
4159
4737
|
// say which one is paying.
|
|
4160
4738
|
const doorKeys = () => {
|
|
@@ -4172,7 +4750,9 @@ function agentsPanel({ onPaint = null, compact = false } = {}) {
|
|
|
4172
4750
|
if (door.choose) { choosingAccount.add(agent.id); void paint(); return; }
|
|
4173
4751
|
choosingAccount.delete(agent.id);
|
|
4174
4752
|
event.currentTarget.disabled = true;
|
|
4175
|
-
|
|
4753
|
+
trouble.delete(agent.id);
|
|
4754
|
+
const answer = await post(`/api/agents/${agent.id}/login`, { method: door.id });
|
|
4755
|
+
if (!answer.ok) trouble.set(agent.id, { kind: 'login', words: answer.body?.error ?? t('The connection did not finish.') });
|
|
4176
4756
|
void paint();
|
|
4177
4757
|
});
|
|
4178
4758
|
if (door.note) key.title = t(door.note);
|
|
@@ -4184,11 +4764,27 @@ function agentsPanel({ onPaint = null, compact = false } = {}) {
|
|
|
4184
4764
|
if (keyFirst) body.append(keyForm(agent));
|
|
4185
4765
|
const acts = el('div', 'sm-agent-acts');
|
|
4186
4766
|
if (!state.busyNow) {
|
|
4187
|
-
if (!agent.detected &&
|
|
4767
|
+
if (!agent.detected && installing.has(agent.id)) {
|
|
4768
|
+
const wait = button('sm-btn primary small is-busy', t('Installing…'), () => {});
|
|
4769
|
+
wait.disabled = true;
|
|
4770
|
+
wait.setAttribute('aria-busy', 'true');
|
|
4771
|
+
acts.append(wait);
|
|
4772
|
+
} else if (!agent.detected && agent.install?.command) acts.append(button('sm-btn primary small', wrongAt(agent.id, 'install') ? t('Try again') : t('Install'), async (event) => {
|
|
4773
|
+
event.currentTarget.disabled = true;
|
|
4774
|
+
event.currentTarget.textContent = t('Installing…');
|
|
4775
|
+
trouble.delete(agent.id);
|
|
4776
|
+
installing.add(agent.id);
|
|
4777
|
+
const answer = await post(`/api/agents/${agent.id}/install`);
|
|
4778
|
+
if (!answer.ok) { installing.delete(agent.id); trouble.set(agent.id, { kind: 'install', words: answer.body?.error ?? t('It did not install.') }); }
|
|
4779
|
+
void paint();
|
|
4780
|
+
}));
|
|
4188
4781
|
else if (agent.detected && agent.login?.headless) for (const key of doorKeys()) acts.append(key);
|
|
4189
4782
|
}
|
|
4190
|
-
// Installed by hand in a terminal (its own installer): one press looks for it again.
|
|
4191
|
-
|
|
4783
|
+
// Installed by hand in a terminal (its own installer): one press looks for it again. In the
|
|
4784
|
+
// welcome its line is unfolded, and the key says what the person just did.
|
|
4785
|
+
const byHand = !agent.detected && agent.install && !agent.install.command;
|
|
4786
|
+
if (byHand && compact) openWays.add(agent.id);
|
|
4787
|
+
if (byHand) acts.append(button('sm-btn small', compact ? t('I did it') : t('Check again'), async (event) => { event.currentTarget.disabled = true; await post('/api/agents/probe'); void paint(); }));
|
|
4192
4788
|
if (acts.childNodes.length) body.append(acts);
|
|
4193
4789
|
const ask = askBlock(agent);
|
|
4194
4790
|
if (ask) body.append(ask);
|
|
@@ -4214,11 +4810,22 @@ function agentsPanel({ onPaint = null, compact = false } = {}) {
|
|
|
4214
4810
|
try {
|
|
4215
4811
|
const event = JSON.parse(message.data);
|
|
4216
4812
|
if (event.type === 'connection.login.output' || event.type === 'connection.install.output') lastLine.set(event.payload.agent, { line: event.payload.line, url: event.payload.url ?? null });
|
|
4813
|
+
// An install or a sign-in that ended without working says why, in plain words.
|
|
4814
|
+
if (event.type === 'connection.install.finished' || event.type === 'connection.login.finished') {
|
|
4815
|
+
const { agent, trouble: cause, error, tail } = event.payload ?? {};
|
|
4816
|
+
const kind = event.type === 'connection.install.finished' ? 'install' : 'login';
|
|
4817
|
+
if (kind === 'install') { installing.delete(agent); if (!cause) lastLine.delete(agent); }
|
|
4818
|
+
if (cause) {
|
|
4819
|
+
const words = TROUBLE_WORDS[kind][cause]?.() ?? error ?? TROUBLE_WORDS[kind].unknown();
|
|
4820
|
+
trouble.set(agent, { kind, words: cause === 'refused-account' ? error : words, tone: cause === 'cancelled' ? 'quiet' : null, detail: (tail ?? []).slice(-3).join('\n') || error || null, card: troubleCard(agent, kind, cause) });
|
|
4821
|
+
} else trouble.delete(agent);
|
|
4822
|
+
}
|
|
4217
4823
|
if (/^connection\./.test(event.type)) void paint();
|
|
4218
4824
|
} catch { /* not ours */ }
|
|
4219
4825
|
};
|
|
4220
4826
|
} catch { /* no stream: the poll keeps it current */ }
|
|
4221
4827
|
};
|
|
4828
|
+
const wrongAt = (id, kind) => trouble.get(id)?.kind === kind;
|
|
4222
4829
|
const stop = () => { clearInterval(poll); poll = 0; stream?.close(); stream = null; };
|
|
4223
4830
|
return { node: list, paint, live: liveOn, stop };
|
|
4224
4831
|
}
|
|
@@ -4279,107 +4886,31 @@ function wizardScene(kind) {
|
|
|
4279
4886
|
}
|
|
4280
4887
|
return scene;
|
|
4281
4888
|
}
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
if (note) page.append(el('p', 'hint', note));
|
|
4308
|
-
page.append(body, actions);
|
|
4309
|
-
inner.append(head, scene, page);
|
|
4310
|
-
};
|
|
4311
|
-
async function agentsStep(options) {
|
|
4312
|
-
const actions = el('div', 'actions');
|
|
4313
|
-
const next = button('sm-btn primary', t('Continue'), () => { step = 1; projectsStep(); });
|
|
4314
|
-
actions.append(next);
|
|
4315
|
-
const fresh = agentsPanel({
|
|
4316
|
-
compact: true,
|
|
4317
|
-
onPaint: (ready, answer) => {
|
|
4318
|
-
next.textContent = ready ? t('Continue') : t('Continue without agents');
|
|
4319
|
-
// The scene lights the agents that are connected, and their wire to MADRE.
|
|
4320
|
-
for (const agent of answer.agents) {
|
|
4321
|
-
const on = agentState(agent, answer).ok;
|
|
4322
|
-
scene?.querySelector(`.sm-scene-node[data-agent="${agent.id}"]`)?.classList.toggle('on', on);
|
|
4323
|
-
scene?.querySelector(`.sm-wire[data-agent="${agent.id}"]`)?.classList.toggle('on', on);
|
|
4324
|
-
}
|
|
4325
|
-
},
|
|
4326
|
-
});
|
|
4327
|
-
frame(t('Connect your agents'), t('Agents are the AI tools that write code, such as Claude Code or Codex. MADRE works with the ones already on this computer: each one is connected once, and every project uses it.'), fresh.node, actions, options);
|
|
4328
|
-
panel = fresh;
|
|
4329
|
-
await fresh.paint();
|
|
4330
|
-
fresh.live();
|
|
4331
|
-
}
|
|
4332
|
-
function projectsStep(options) {
|
|
4333
|
-
// What is chosen here is added on the way to the next step: one key, not two.
|
|
4334
|
-
const actions = el('div', 'actions');
|
|
4335
|
-
const next = button('sm-btn primary', t('Continue'), async () => {
|
|
4336
|
-
if (picker.count()) {
|
|
4337
|
-
next.disabled = true;
|
|
4338
|
-
const added = await picker.add();
|
|
4339
|
-
next.disabled = false;
|
|
4340
|
-
if (!added) return;
|
|
4341
|
-
}
|
|
4342
|
-
step = 2;
|
|
4343
|
-
openStep();
|
|
4344
|
-
});
|
|
4345
|
-
const picker = projectPicker({ withAdd: false, onChange: (n) => { next.textContent = n ? t('Add and continue') : t('Continue'); } });
|
|
4346
|
-
actions.append(button('sm-btn', t('Back'), () => { step = 0; void agentsStep({ back: true }); }), next);
|
|
4347
|
-
frame(t('Add your projects'), t('A project is a folder you work in. Choose yours: adding them does not open them; in the next step you pick which to open.'), picker.node, actions, options);
|
|
4348
|
-
}
|
|
4349
|
-
function openStep() {
|
|
4350
|
-
const projects = (data?.rooms ?? []).filter((room) => room.id !== data?.salas);
|
|
4351
|
-
const chosen = new Set();
|
|
4352
|
-
const pages = foldPages({ snug: true });
|
|
4353
|
-
const list = el('div', 'sm-picker');
|
|
4354
|
-
const foot = el('div', 'sm-picker-foot');
|
|
4355
|
-
foot.append(pages.pager);
|
|
4356
|
-
list.append(pages.grid, foot);
|
|
4357
|
-
pages.show(projects, {
|
|
4358
|
-
draw: (room) => foldTile({
|
|
4359
|
-
name: room.name,
|
|
4360
|
-
path: room.root ?? '',
|
|
4361
|
-
note: room.open ? t('Already open') : null,
|
|
4362
|
-
checked: Boolean(room.open) || chosen.has(room.id),
|
|
4363
|
-
known: Boolean(room.open),
|
|
4364
|
-
onToggle: (on) => { if (on) chosen.add(room.id); else chosen.delete(room.id); },
|
|
4365
|
-
}),
|
|
4366
|
-
empty: () => t('No projects yet. You can add them from Home whenever you like.'),
|
|
4367
|
-
});
|
|
4368
|
-
const actions = el('div', 'actions');
|
|
4369
|
-
const go = button('sm-btn primary', t('Done'), async () => {
|
|
4370
|
-
go.disabled = true;
|
|
4371
|
-
for (const id of chosen) {
|
|
4372
|
-
go.textContent = t('Opening {name}…', { name: projects.find((room) => room.id === id)?.name ?? id });
|
|
4373
|
-
await startRoom({ id });
|
|
4374
|
-
}
|
|
4375
|
-
wizard.close();
|
|
4376
|
-
});
|
|
4377
|
-
actions.append(button('sm-btn', t('Back'), () => { step = 1; projectsStep({ back: true }); }), go);
|
|
4378
|
-
frame(t('Open what you will use'), t('Each open project runs on this Mac on its own. The rest stay in Home, asleep, until you open them.'), list, actions);
|
|
4379
|
-
}
|
|
4380
|
-
wizard.addEventListener('close', () => { stop(); wizard.remove(); wizard = null; void loadAgents(); const after = wizardThen; wizardThen = null; after?.(); });
|
|
4381
|
-
wizard.showModal();
|
|
4382
|
-
void agentsStep();
|
|
4889
|
+
// THE WELCOME (2026-10-28, public/welcome.js): seven steps that leave MADRE ready — agents, an AI on
|
|
4890
|
+
// this computer, the memory's search and the first project —, adapted to where MADRE runs. It took
|
|
4891
|
+
// the place of the three steps of 1.0 (agents, projects, open). Home hands it its own panel of
|
|
4892
|
+
// agents and its picker of folders, so the welcome and Home never say a thing two ways.
|
|
4893
|
+
const welcomeHost = {
|
|
4894
|
+
agentsPanel: (options) => agentsPanel(options),
|
|
4895
|
+
projectPicker: (options) => projectPicker(options),
|
|
4896
|
+
mark: (id, size) => mark(id, size),
|
|
4897
|
+
closeKey: (onClick) => closeKey(onClick),
|
|
4898
|
+
agentState: (agent, answer) => agentState(agent, answer),
|
|
4899
|
+
projects: () => (data ? projectsInOrder().all : []),
|
|
4900
|
+
openProject: (room) => startRoom(room, { enter: true }),
|
|
4901
|
+
setLanguage: (code) => adoptLanguage(code),
|
|
4902
|
+
openLinks: () => openLinkSheet(),
|
|
4903
|
+
openMarket: () => void openHomeMarket('shop'),
|
|
4904
|
+
chapters: () => homeTour.openChapters('home'),
|
|
4905
|
+
saved: (welcome) => { welcomeSeen = welcome; drawAttention(); },
|
|
4906
|
+
closed: () => { void loadAgents(); void refresh(); },
|
|
4907
|
+
};
|
|
4908
|
+
function openHomeWelcome({ at = null, then = null } = {}) {
|
|
4909
|
+
welcomed = true;
|
|
4910
|
+
const opened = openWelcome({ at, then, host: welcomeHost });
|
|
4911
|
+
// The welcome covers Home now (its opening, or its window over the stage): the boot's ground goes.
|
|
4912
|
+
bootDone();
|
|
4913
|
+
return opened;
|
|
4383
4914
|
}
|
|
4384
4915
|
|
|
4385
4916
|
// ---- AJUSTES, as the room's (app.js, SETTINGS_SECTIONS and its sheets; 2026-10-10): a board of
|
|
@@ -4397,14 +4928,14 @@ const SET_SECTIONS = [
|
|
|
4397
4928
|
// The room's own icons where the room has the category (app.js, SETTINGS_CATS); the bar, BISHOP
|
|
4398
4929
|
// and the projects drawn here in the same hand: 20×20, one round stroke.
|
|
4399
4930
|
const SET_CATS = {
|
|
4400
|
-
look: { name: 'Appearance', icon: '
|
|
4401
|
-
bar: { name: 'Top bar', icon: '
|
|
4402
|
-
agents: { name: 'Agents', icon: '
|
|
4403
|
-
bishop: { name: 'Coordinator', icon: '
|
|
4404
|
-
local: { name: 'Local AI', icon: '
|
|
4405
|
-
projects: { name: 'Projects', icon: '
|
|
4406
|
-
release: { name: 'Version', icon: '
|
|
4407
|
-
manual: { name: 'User manual', icon: '
|
|
4931
|
+
look: { name: 'Appearance', icon: trazoDrawing('appearance') },
|
|
4932
|
+
bar: { name: 'Top bar', icon: trazoDrawing('arrange') },
|
|
4933
|
+
agents: { name: 'Agents', icon: trazoDrawing('agents') },
|
|
4934
|
+
bishop: { name: 'Coordinator', icon: trazoDrawing('coordinator') },
|
|
4935
|
+
local: { name: 'Local AI', icon: trazoDrawing('spark') },
|
|
4936
|
+
projects: { name: 'Projects', icon: trazoDrawing('folder') },
|
|
4937
|
+
release: { name: 'Version', icon: trazoDrawing('refresh') },
|
|
4938
|
+
manual: { name: 'User manual', icon: trazoDrawing('book') },
|
|
4408
4939
|
};
|
|
4409
4940
|
const SET_ORDER = ['look', 'bar', 'agents', 'bishop', 'local', 'projects', 'release'];
|
|
4410
4941
|
// The words the search knows, each pointing to the category that holds it (app.js, SETTINGS_INDEX).
|
|
@@ -4414,12 +4945,14 @@ const SET_INDEX = [
|
|
|
4414
4945
|
['bishop', 'Talk to the Coordinator'], ['bishop', 'Open the Coordinator in a new tab'],
|
|
4415
4946
|
['local', 'Ollama'], ['local', 'Automatic'], ['local', 'One by one'], ['local', 'Manual'],
|
|
4416
4947
|
['projects', 'Add a project'], ['projects', 'See the welcome again'], ['projects', 'The tour of MADRE 1.0'],
|
|
4417
|
-
['release', 'Check now'],
|
|
4948
|
+
['release', 'Check now'], ['release', 'Uninstall MADRE'],
|
|
4418
4949
|
];
|
|
4419
4950
|
const THEME_WORDS = { auto: () => t('Automatic'), light: () => t('Light'), dark: () => t('Dark') };
|
|
4420
|
-
|
|
4421
|
-
const
|
|
4422
|
-
const
|
|
4951
|
+
// In the chat shell the projects at hand live in the sidebar, and Settings calls them so (2026-10-28).
|
|
4952
|
+
const SIDEBAR_CAT = trazoDrawing('sidebar');
|
|
4953
|
+
const catName = (id) => (id === 'bar' && homeShellOn() ? t('Sidebar') : t(SET_CATS[id].name));
|
|
4954
|
+
const setIcon = (id) => { const span = el('span', 'settings-icon'); span.innerHTML = `<svg viewBox="0 0 20 20" aria-hidden="true">${id === 'bar' && homeShellOn() ? SIDEBAR_CAT : SET_CATS[id].icon}</svg>`; span.style.setProperty('--cat', 'var(--phosphor)'); return span; }; // trusted: our own SVG strings
|
|
4955
|
+
const CHEVRON = trazo('chevron');
|
|
4423
4956
|
const chevron = (className) => { const mark = el('span', `${className} chev-icon`); mark.innerHTML = CHEVRON; return mark; }; // trusted: our own SVG string
|
|
4424
4957
|
const fold = (text) => String(text).normalize('NFD').replace(/\p{M}/gu, '').toLowerCase();
|
|
4425
4958
|
const bishopRoom = () => data?.rooms.find((room) => room.id === data.salas) ?? null;
|
|
@@ -4468,9 +5001,13 @@ function customSeg(options, current, pick, size = '') {
|
|
|
4468
5001
|
// The user manual (1.0.5): its own page in Home's language, and the same manual in PDF.
|
|
4469
5002
|
function openManual() { window.open(`/manual?lang=${language}`, '_blank', 'noopener'); }
|
|
4470
5003
|
function setStatus(id) {
|
|
4471
|
-
if (id === 'manual') return { line: t('
|
|
5004
|
+
if (id === 'manual') return { line: t('With pictures, step by step. Also as a PDF.') };
|
|
4472
5005
|
const looks = readLooks();
|
|
4473
|
-
|
|
5006
|
+
// The new design shows no wallpaper (salas-mac.css, .sm-sky), so the summary no longer names one
|
|
5007
|
+
// that is nowhere to be seen (QA 1.1.0, ACT-06).
|
|
5008
|
+
if (id === 'look') return { line: document.documentElement.classList.contains('chat-shell')
|
|
5009
|
+
? `${THEME_WORDS[looks.theme]()} · ${ACCENT_WORDS[looks.accent]()}`
|
|
5010
|
+
: `${THEME_WORDS[looks.theme]()} · ${WALLPAPER_WORDS[looks.wallpaper]()} · ${ACCENT_WORDS[looks.accent]()}` };
|
|
4474
5011
|
if (id === 'bar') {
|
|
4475
5012
|
if (!pinsStored()) return { line: t('The open projects, as they open') };
|
|
4476
5013
|
const count = pinsShown().length;
|
|
@@ -4519,7 +5056,7 @@ function setQuick(id) {
|
|
|
4519
5056
|
}
|
|
4520
5057
|
add(t('Theme'), seg);
|
|
4521
5058
|
}
|
|
4522
|
-
if (id === 'bar') add(t('Arrange the bar'), sxButton(t('Arrange'), (event) => { event.stopPropagation(); settingsSheet?.close(); pinsEdit(true); }));
|
|
5059
|
+
if (id === 'bar' && !homeShellOn()) add(t('Arrange the bar'), sxButton(t('Arrange'), (event) => { event.stopPropagation(); settingsSheet?.close(); pinsEdit(true); }));
|
|
4523
5060
|
if (id === 'agents' && agentsSeen) {
|
|
4524
5061
|
for (const agent of agentsSeen.agents.filter((one) => one.id !== 'madre' && one.detected)) {
|
|
4525
5062
|
const state = agentState(agent, agentsSeen);
|
|
@@ -4566,6 +5103,38 @@ function lookPreview(looks) {
|
|
|
4566
5103
|
grid.append(card);
|
|
4567
5104
|
});
|
|
4568
5105
|
preview.append(bar, grid);
|
|
5106
|
+
// Home as it looks now (2026-10-28), in the chat shell: the sidebar, the bar, and flat cards on the
|
|
5107
|
+
// canvas, in the theme and accent chosen — the old preview drew the Home of glass and pills.
|
|
5108
|
+
if (root.classList.contains('home-shell')) {
|
|
5109
|
+
preview.classList.add('shell');
|
|
5110
|
+
const side = el('div', 'hps-side');
|
|
5111
|
+
const brand = el('i', 'hps-brand');
|
|
5112
|
+
side.append(brand);
|
|
5113
|
+
for (const [words, on] of [[t('Home'), true], [t('Coordinator'), false], [t('Market'), false]]) side.append(el('span', `hps-row${on ? ' on' : ''}`, words));
|
|
5114
|
+
side.append(el('small', 'hps-label', t('Projects')));
|
|
5115
|
+
names.forEach((name, index) => { const row = el('span', 'hps-row hps-project'); row.append(el('i', index ? 'asleep' : null), name); side.append(row); });
|
|
5116
|
+
const main = el('div', 'hps-main');
|
|
5117
|
+
const top = el('div', 'hps-top');
|
|
5118
|
+
top.append(el('b', null, t('Home')), el('span', 'hps-keys'));
|
|
5119
|
+
const tiles = el('div', 'hps-tiles');
|
|
5120
|
+
const coordTile = el('div', 'hps-tile hps-coord');
|
|
5121
|
+
const coordHead = el('div', 'hp-head');
|
|
5122
|
+
coordHead.append(el('span', 'hp-mark'), el('b', null, t('Coordinator')));
|
|
5123
|
+
coordTile.append(coordHead, el('span', 'hps-key on', t('Talk to the Coordinator')));
|
|
5124
|
+
const waiting = el('div', 'hps-tile hps-wait');
|
|
5125
|
+
waiting.append(el('b', null, t('Waiting on you')), el('strong', null, '0'));
|
|
5126
|
+
const cards = el('div', 'hps-tile hps-cards');
|
|
5127
|
+
names.forEach((name, index) => {
|
|
5128
|
+
const card = el('div', 'hps-card');
|
|
5129
|
+
const state = el('small', 'hp-state');
|
|
5130
|
+
state.append(el('i'), index ? t('Asleep') : t('Active'));
|
|
5131
|
+
card.append(el('b', null, name), state, el('span', 'hp-chat'), el('span', `hps-key${index ? '' : ' on'}`, t('Open')));
|
|
5132
|
+
cards.append(card);
|
|
5133
|
+
});
|
|
5134
|
+
tiles.append(coordTile, waiting, cards);
|
|
5135
|
+
main.append(top, tiles);
|
|
5136
|
+
preview.replaceChildren(side, main);
|
|
5137
|
+
}
|
|
4569
5138
|
return preview;
|
|
4570
5139
|
}
|
|
4571
5140
|
|
|
@@ -4671,9 +5240,12 @@ function fillLook(host) {
|
|
|
4671
5240
|
}
|
|
4672
5241
|
paperBox.append(tune);
|
|
4673
5242
|
}
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
5243
|
+
// The chat shell's look has no picture behind Home or a project (2026-10-26): no wallpaper to choose.
|
|
5244
|
+
if (!document.documentElement.classList.contains('chat-shell')) {
|
|
5245
|
+
sxBlock(page, t('Wallpaper'), photo
|
|
5246
|
+
? t('The project\'s background can be a photograph, shown as a layer or as a mesh of its colors: choose how strong it looks and how much the photograph blurs.')
|
|
5247
|
+
: t('Behind Home, and behind the conversation of the project served at this address. Light and dark each have their own.')).rows.append(paperBox);
|
|
5248
|
+
}
|
|
4677
5249
|
|
|
4678
5250
|
// Home's own: its cards, its text, the order of its projects. The conversation's bubbles and text
|
|
4679
5251
|
// are each project's, in its own Settings.
|
|
@@ -4703,17 +5275,20 @@ function fillLook(host) {
|
|
|
4703
5275
|
host.append(frame);
|
|
4704
5276
|
}
|
|
4705
5277
|
function fillBar(host) {
|
|
4706
|
-
const
|
|
5278
|
+
const side = homeShellOn();
|
|
5279
|
+
const block = side
|
|
5280
|
+
? sxBlock(host, t('Sidebar'), t('The projects you keep at hand in the sidebar, in the order you choose. A project comes to it from its card: right-click it, or drag it onto the list.'))
|
|
5281
|
+
: sxBlock(host, t('Top bar'), t('The projects you keep at hand, in the order you choose. A project comes to the bar from its card: right-click it, or drag it to the bar.'));
|
|
4707
5282
|
const ids = pinsShown();
|
|
4708
|
-
if (!ids.length) sxRow(block, t('Nothing pinned'), null);
|
|
5283
|
+
if (!ids.length) sxRow(block, side ? t('No project in the sidebar yet') : t('Nothing pinned'), null);
|
|
4709
5284
|
for (const id of ids) {
|
|
4710
5285
|
const room = data.rooms.find((one) => one.id === id);
|
|
4711
5286
|
sxRow(block, room.name, stateOf(room).words, sxButton(t('Remove'), () => pinRemove(id)));
|
|
4712
5287
|
}
|
|
4713
5288
|
const acts = el('div', 'sx-actions end');
|
|
4714
5289
|
if (pinsStored()) acts.append(sxButton(t('Back to default'), () => pinsReset()));
|
|
4715
|
-
acts.append(sxButton(t('Arrange the bar'), () => { settingsSheet?.close(); pinsEdit(true); }, { tone: 'primary' }));
|
|
4716
|
-
host.append(acts);
|
|
5290
|
+
if (!side) acts.append(sxButton(t('Arrange the bar'), () => { settingsSheet?.close(); pinsEdit(true); }, { tone: 'primary' }));
|
|
5291
|
+
if (acts.childElementCount) host.append(acts);
|
|
4717
5292
|
}
|
|
4718
5293
|
function fillAgents(host, keep) {
|
|
4719
5294
|
// The project's AJUSTES › Agents, here too: a sentence, then a card per agent.
|
|
@@ -4753,7 +5328,7 @@ async function loadLocal({ probe = false } = {}) {
|
|
|
4753
5328
|
if (ollama?.ollama) localOllama = ollama;
|
|
4754
5329
|
if (answer) localSeen = answer;
|
|
4755
5330
|
localFailed = !answer;
|
|
4756
|
-
settingsSheet?.sync({ detail: true });
|
|
5331
|
+
settingsSheet?.sync({ detail: true, only: 'local' });
|
|
4757
5332
|
return answer;
|
|
4758
5333
|
}
|
|
4759
5334
|
async function saveLocal(patch) {
|
|
@@ -4761,7 +5336,7 @@ async function saveLocal(patch) {
|
|
|
4761
5336
|
if (!answer.ok) { toast(answer.body?.error ?? t('Home did not answer.')); return; }
|
|
4762
5337
|
localSeen = answer.body;
|
|
4763
5338
|
if (localSeen.later?.length) toast(t('{names} will use it when restarted: it was started before this setting existed.', { names: localSeen.later.join(', ') }));
|
|
4764
|
-
settingsSheet?.sync({ detail: true });
|
|
5339
|
+
settingsSheet?.sync({ detail: true, only: 'local' });
|
|
4765
5340
|
}
|
|
4766
5341
|
// The rail every settings sheet uses (app.js, sxSeg; styles.css, .sx-seg): the mark moves when chosen.
|
|
4767
5342
|
function sxSeg(options, current, pick, { label = null } = {}) {
|
|
@@ -4847,6 +5422,30 @@ function drawLocalServer(host) {
|
|
|
4847
5422
|
if (!info) { sxRow(block, t('Reading…'), null); return; }
|
|
4848
5423
|
const recheck = sxButton(t('Check again'), async () => { recheck.disabled = true; await loadLocal({ probe: true }); });
|
|
4849
5424
|
sxRow(block, t('Server'), info.running ? t('Running · {host}', { host: info.host }) : t('Not running'), recheck);
|
|
5425
|
+
// Where Ollama is (2026-10-28, src/server.mjs, /api/local-ai/host): this computer's, or another
|
|
5426
|
+
// one's — Windows' own from inside WSL, a computer with a graphics card —, tried before it is kept.
|
|
5427
|
+
const local = /^https?:\/\/(127\.0\.0\.1|localhost|\[::1\])(:\d+)?$/i.test(info.host ?? '');
|
|
5428
|
+
const address = el('form', 'sm-agent-key-form sm-ollama-host');
|
|
5429
|
+
const field = el('input');
|
|
5430
|
+
field.type = 'text';
|
|
5431
|
+
field.spellcheck = false;
|
|
5432
|
+
field.autocomplete = 'off';
|
|
5433
|
+
field.value = local ? '' : info.host ?? '';
|
|
5434
|
+
field.placeholder = 'http://192.168.1.40:11434';
|
|
5435
|
+
field.setAttribute('aria-label', t('Ollama address'));
|
|
5436
|
+
const test = sxButton(t('Test'), () => {});
|
|
5437
|
+
test.type = 'submit';
|
|
5438
|
+
const keep = async (host) => {
|
|
5439
|
+
test.disabled = true;
|
|
5440
|
+
const answer = await post('/api/local-ai/host', { host });
|
|
5441
|
+
test.disabled = false;
|
|
5442
|
+
if (!answer.ok) { toast(answer.body?.error ?? t('Home did not answer.')); return; }
|
|
5443
|
+
await loadLocal({ probe: true });
|
|
5444
|
+
};
|
|
5445
|
+
address.addEventListener('submit', (event) => { event.preventDefault(); void keep(field.value.trim()); });
|
|
5446
|
+
address.append(field, test);
|
|
5447
|
+
if (!local) address.append(sxButton(t('This computer'), () => void keep(null)));
|
|
5448
|
+
sxRow(block, t('Ollama address'), local ? t('This computer. Write another computer\'s address to use its AI.') : t('Another computer\'s. Every project uses it.'), address, { stack: true });
|
|
4850
5449
|
if (!info.running) {
|
|
4851
5450
|
const step = info.binary
|
|
4852
5451
|
? { label: t('Start Ollama'), path: '/api/ollama/start', note: t('Wakes Ollama on this computer. Nothing leaves it.') }
|
|
@@ -4884,7 +5483,7 @@ function drawLocalServer(host) {
|
|
|
4884
5483
|
const EMBEDDING = /embed|minilm|bge|nomic/i;
|
|
4885
5484
|
// The model that fits this computer best, said the way the room's tags say things: a small pill in
|
|
4886
5485
|
// the accent beside its name, never a grey bar the width of the row (2026-10-20).
|
|
4887
|
-
const RECOMMENDED_ICON = '
|
|
5486
|
+
const RECOMMENDED_ICON = trazo('star-filled');
|
|
4888
5487
|
function recommendedChip() {
|
|
4889
5488
|
const chip = el('span', 'sx-recommend');
|
|
4890
5489
|
chip.innerHTML = RECOMMENDED_ICON; // trusted: our own SVG string
|
|
@@ -4920,13 +5519,15 @@ function drawLocalModel(host) {
|
|
|
4920
5519
|
const more = sxBlock(host, t('More models for your computer'), t('Only the ones that fit in its memory. Each downloads once and stays in Ollama.'));
|
|
4921
5520
|
for (const one of localAllModels ? runs : runs.slice(0, 5)) {
|
|
4922
5521
|
const hint = [one.maker, t(one.note), one.run === 'slow' ? t('Slow without a graphics card') : null].filter(Boolean).join(' · ');
|
|
4923
|
-
const get = sxButton(t('Download'), async () => {
|
|
5522
|
+
const get = sxButton(pulling.has(one.ollama) ? t('Downloading…') : t('Download'), async () => {
|
|
4924
5523
|
get.disabled = true;
|
|
4925
5524
|
const answer = await post('/api/ollama/pull', { model: one.ollama });
|
|
4926
|
-
if (!answer.ok) { toast(answer.body?.error ?? t('Home did not answer.')); get.disabled = false; return; }
|
|
5525
|
+
if (!answer.ok) { toast(answer.status === 409 ? t('Another download is running. When it ends, try this one.') : answer.body?.error ?? t('Home did not answer.')); get.disabled = false; return; }
|
|
4927
5526
|
get.textContent = t('Downloading…');
|
|
4928
5527
|
watchPull(one.ollama);
|
|
4929
5528
|
}, { tone: one.recommended ? 'primary' : null });
|
|
5529
|
+
// Redrawn while it downloads: it stays «Downloading…», not a second «Download».
|
|
5530
|
+
if (pulling.has(one.ollama)) get.disabled = true;
|
|
4930
5531
|
const row = sxRow(more, one.label, hint, get);
|
|
4931
5532
|
if (one.recommended) row.querySelector('.sx-words b')?.after(recommendedChip());
|
|
4932
5533
|
}
|
|
@@ -4953,13 +5554,14 @@ function watchPull(model) {
|
|
|
4953
5554
|
function fillProjects(host) {
|
|
4954
5555
|
const block = sxBlock(host, t('Projects'), t('A project is a folder: MADRE gives it its own conversations and its own memory. Adding it does not open it; you open it from its card.'));
|
|
4955
5556
|
sxRow(block, t('Add a project'), null, sxButton(t('Add'), () => { settingsSheet?.close(); openAddSheet(); }, { tone: 'primary' }));
|
|
4956
|
-
sxRow(block, t('See the welcome again'),
|
|
5557
|
+
sxRow(block, t('See the welcome again'), t('Agents, AI on your computer, memory and a project, step by step.'), sxButton(t('Open'), () => { settingsSheet?.close(); openHomeWelcome({ at: 'hello' }); }));
|
|
4957
5558
|
const back = homeTour.path() === 'back';
|
|
4958
5559
|
sxRow(block, back ? t('The tour of MADRE 1.0') : t('Getting to know MADRE'), back ? t('Everything new, chapter by chapter. ? opens the gestures anywhere.') : t('The essentials, chapter by chapter. ? opens the gestures anywhere.'), sxButton(t('See the tour'), () => { settingsSheet?.close(); homeTour.openChapters(); }));
|
|
4959
5560
|
}
|
|
4960
5561
|
function fillRelease(host) {
|
|
4961
5562
|
const info = versionSeen;
|
|
4962
|
-
|
|
5563
|
+
// Up to date there is nothing to restart with (QA 1.1.0, ACT-14).
|
|
5564
|
+
const block = sxBlock(host, t('Version'), info ? (info.available ? t('You run {version}. Home restarts with it from here.', { version: info.current }) : t('You run {version}, the newest.', { version: info.current })) : null);
|
|
4963
5565
|
const check = info?.enabled ? sxButton(t('Check now'), async () => {
|
|
4964
5566
|
check.disabled = true;
|
|
4965
5567
|
const answer = await fetch('/api/version?force=1', { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null)).catch(() => null);
|
|
@@ -4970,13 +5572,14 @@ function fillRelease(host) {
|
|
|
4970
5572
|
}) : null;
|
|
4971
5573
|
sxRow(block, `MADRE ${info?.current ?? ''}`.trim(), info ? (info.available ? t('{version} available', { version: info.latest }) : info.enabled === false ? t('not checked') : t('up to date')) : t('Reading…'), check);
|
|
4972
5574
|
// The one thing the daily usage notice says about this copy (src/heartbeat.mjs), in sight.
|
|
4973
|
-
if (info?.
|
|
5575
|
+
if (info?.copyId) {
|
|
4974
5576
|
const copy = sxButton(t('Copy'), async () => {
|
|
4975
|
-
try { await navigator.clipboard.writeText(info.
|
|
5577
|
+
try { await navigator.clipboard.writeText(info.copyId); copy.textContent = t('Copied'); setTimeout(() => { copy.textContent = t('Copy'); }, 1400); } catch { toast(t('Select it and copy it.'), 'error'); }
|
|
4976
5578
|
});
|
|
4977
|
-
const row = sxRow(block, t('This copy\'s identifier'), t('Random
|
|
4978
|
-
row.querySelector('.sx-words')?.append(el('code', 'sm-install-id', info.
|
|
5579
|
+
const row = sxRow(block, t('This copy\'s identifier'), t('Random and unique: this copy made it for itself. It lets the author tell one copy\'s errors from another\'s and find the fix for yours, without knowing who you are: no name, no projects.'), copy);
|
|
5580
|
+
row.querySelector('.sx-words')?.append(el('code', 'sm-install-id', info.copyId));
|
|
4979
5581
|
}
|
|
5582
|
+
drawDonate(host);
|
|
4980
5583
|
if (info?.available) {
|
|
4981
5584
|
const notes = el('a', 'sx-btn', t('What it brings'));
|
|
4982
5585
|
notes.href = info.release ?? 'https://madre.run';
|
|
@@ -5001,8 +5604,22 @@ function fillRelease(host) {
|
|
|
5001
5604
|
const late = sxBlock(host, t('Projects on an older MADRE'), t('They keep running the version they started with until you restart them. What is running in them stops.'), { aside: behind.length > 1 ? sxButton(t('Restart all'), () => void restartAll(), { tone: 'primary' }) : null });
|
|
5002
5605
|
for (const room of behind) sxRow(late, roomLabel(room), `MADRE ${room.open.version}`, sxButton(t('Restart'), () => { settingsSheet?.close(); void restartRoom(room); }));
|
|
5003
5606
|
}
|
|
5607
|
+
// Uninstalling MADRE (2026-10-29): what goes and what stays is said before anything happens
|
|
5608
|
+
// (public/power.js, askUninstall).
|
|
5609
|
+
const leave = sxBlock(host, t('Uninstall MADRE'), t('Takes away what MADRE put on this computer: its conversations, memory and settings, and its folder inside your projects. Your projects and your AIs stay.'));
|
|
5610
|
+
sxRow(leave, t('Remove MADRE from this computer'), t('You will see the whole list before anything is removed.'), sxButton(t('Uninstall…'), () => void askUninstall(), { tone: 'danger' }));
|
|
5004
5611
|
drawLegal(host);
|
|
5005
5612
|
}
|
|
5613
|
+
// Supporting MADRE (2026-10-30): a donation on GitHub Sponsors, in the person's browser, under the
|
|
5614
|
+
// version and this copy's identifier, as a project's Settings › Version has it (app.js).
|
|
5615
|
+
function drawDonate(host) {
|
|
5616
|
+
const give = sxBlock(host, t('Support MADRE'), t('MADRE is free and made by one person. A donation helps keep it going and growing.'));
|
|
5617
|
+
const go = el('a', 'sx-btn primary', t('Donate'));
|
|
5618
|
+
go.href = SPONSORS_URL;
|
|
5619
|
+
go.target = '_blank';
|
|
5620
|
+
go.rel = 'noopener';
|
|
5621
|
+
sxRow(give, t('Donate on GitHub'), t('Once or every month, the amount you choose. GitHub keeps no commission.'), go);
|
|
5622
|
+
}
|
|
5006
5623
|
async function updateHome(info, key, said) {
|
|
5007
5624
|
key.disabled = true;
|
|
5008
5625
|
said.textContent = '';
|
|
@@ -5044,7 +5661,7 @@ function openSettings(section = null) {
|
|
|
5044
5661
|
win.id = 'settings';
|
|
5045
5662
|
const head = el('header', 'custom-head settings-head');
|
|
5046
5663
|
const search = el('label', 'settings-search');
|
|
5047
|
-
search.innerHTML = '
|
|
5664
|
+
search.innerHTML = trazo('search'); // trusted: our own SVG
|
|
5048
5665
|
const input = el('input');
|
|
5049
5666
|
input.type = 'search';
|
|
5050
5667
|
input.placeholder = t('Search any setting');
|
|
@@ -5052,11 +5669,25 @@ function openSettings(section = null) {
|
|
|
5052
5669
|
input.spellcheck = false;
|
|
5053
5670
|
input.setAttribute('aria-label', t('Search any setting'));
|
|
5054
5671
|
search.append(input);
|
|
5055
|
-
head.append(el('span', 'custom-title', t('
|
|
5672
|
+
head.append(el('span', 'custom-title', t('Settings')), search, closeKey(() => dialog.close()));
|
|
5056
5673
|
const body = el('div', 'sm-settings-body');
|
|
5057
5674
|
win.append(head, body);
|
|
5058
5675
|
dialog.append(win);
|
|
5059
5676
|
document.body.append(dialog);
|
|
5677
|
+
// A window of Home in the chat shell (2026-10-28), as a project's Settings is one: not modal,
|
|
5678
|
+
// carried by its head, sized by its sides, its place kept (homeWindow). Its own × stays.
|
|
5679
|
+
const framed = homeWindow({ root: dialog, bar: head, close: () => dialog.close(), key: 'pulse.homeSettingsWindow', minW: 560, minH: 420, keys: false, size: { w: 980, h: 700 } });
|
|
5680
|
+
if (framed) {
|
|
5681
|
+
dialog.classList.add('sm-settings-framed');
|
|
5682
|
+
// Not modal, so Escape is asked here; it steps back the same way the modal sheet's does.
|
|
5683
|
+
dialog.addEventListener('keydown', (event) => {
|
|
5684
|
+
if (event.key !== 'Escape' || event.defaultPrevented) return;
|
|
5685
|
+
event.preventDefault();
|
|
5686
|
+
const ask = new Event('cancel', { cancelable: true });
|
|
5687
|
+
dialog.dispatchEvent(ask);
|
|
5688
|
+
if (!ask.defaultPrevented) dialog.close();
|
|
5689
|
+
});
|
|
5690
|
+
}
|
|
5060
5691
|
|
|
5061
5692
|
const stop = () => { for (const one of state.stops.splice(0)) one(); };
|
|
5062
5693
|
const card = (id) => {
|
|
@@ -5082,7 +5713,7 @@ function openSettings(section = null) {
|
|
|
5082
5713
|
for (const [name, sub, ids] of SET_SECTIONS) {
|
|
5083
5714
|
const section = el('section', 'settings-section');
|
|
5084
5715
|
const top = el('header');
|
|
5085
|
-
top.append(el('b', null, t(name)), el('span', null, t(sub)));
|
|
5716
|
+
top.append(el('b', null, t(name)), el('span', null, t(homeShellOn() && sub === 'How Home looks and what its bar holds' ? 'How Home looks and what its sidebar holds' : sub)));
|
|
5086
5717
|
const cards = el('div', 'settings-cards');
|
|
5087
5718
|
for (const id of ids) cards.append(card(id));
|
|
5088
5719
|
section.append(top, cards);
|
|
@@ -5128,9 +5759,9 @@ function openSettings(section = null) {
|
|
|
5128
5759
|
stop();
|
|
5129
5760
|
if (state.query.trim()) { body.replaceChildren(results()); return; }
|
|
5130
5761
|
if (!state.open) { body.replaceChildren(board()); return; }
|
|
5131
|
-
//
|
|
5132
|
-
//
|
|
5133
|
-
const full =
|
|
5762
|
+
// Every category opens over the board from the side, Appearance too, as in a project's Settings
|
|
5763
|
+
// (2026-10-28: it took the whole window, and read as another screen rather than one of its sheets).
|
|
5764
|
+
const full = false;
|
|
5134
5765
|
const sheet = el('div', `settings-sheet${full ? ' full' : ''}`);
|
|
5135
5766
|
const scroll = el('div', 'settings-scroll');
|
|
5136
5767
|
scroll.append(detail(state.open));
|
|
@@ -5170,8 +5801,11 @@ function openSettings(section = null) {
|
|
|
5170
5801
|
// What the lobby learns while the window is open (an agent signs in, a version is found, a
|
|
5171
5802
|
// project opens) reaches the cards and the sheet's line; a card that says the same is left alone,
|
|
5172
5803
|
// so nothing under the pointer or the keyboard is drawn again for nothing.
|
|
5173
|
-
|
|
5804
|
+
// `only`: draw the open category again only when it is that one (a model downloading reloads Local
|
|
5805
|
+
// AI every few seconds, and redrew whatever was open — a key half pasted in Agents was lost).
|
|
5806
|
+
const sync = ({ detail: again = false, only = null } = {}) => {
|
|
5174
5807
|
if (state.query.trim()) return;
|
|
5808
|
+
if (only && state.open !== only) again = false;
|
|
5175
5809
|
for (const old of body.querySelectorAll('.settings-card')) {
|
|
5176
5810
|
const fresh = card(old.dataset.cat);
|
|
5177
5811
|
if (fresh.outerHTML !== old.outerHTML) old.replaceWith(fresh);
|
|
@@ -5186,12 +5820,12 @@ function openSettings(section = null) {
|
|
|
5186
5820
|
// say so, and Appearance is drawn again with it.
|
|
5187
5821
|
const paintLooks = () => { sync({ detail: state.open === 'look' }); };
|
|
5188
5822
|
const show = (wanted) => {
|
|
5189
|
-
if (!dialog.open) dialog.showModal();
|
|
5823
|
+
if (!dialog.open) { if (framed) { dialog.show(); framed.raise(); } else dialog.showModal(); }
|
|
5190
5824
|
if (wanted && SET_FILL[wanted]) openCategory(wanted); else draw();
|
|
5191
5825
|
};
|
|
5192
5826
|
const close = () => dialog.close();
|
|
5193
5827
|
settingsSheet = { show, paintLooks, sync, close };
|
|
5194
|
-
dialog.addEventListener('close', () => { stop(); dialog.remove(); settingsSheet = null; });
|
|
5828
|
+
dialog.addEventListener('close', () => { stop(); framed?.drop(); dialog.remove(); settingsSheet = null; });
|
|
5195
5829
|
show(section);
|
|
5196
5830
|
}
|
|
5197
5831
|
ui.gear.addEventListener('click', () => openSettings());
|
|
@@ -5206,6 +5840,9 @@ function translateStatic() {
|
|
|
5206
5840
|
ui.add.textContent = t('Add a project');
|
|
5207
5841
|
ui.bar.crumb.textContent = t('Home');
|
|
5208
5842
|
ui.bar.open.setAttribute('aria-label', t('Projects on the bar'));
|
|
5843
|
+
document.querySelector('.sm-topbar:not(.sm-tb-home)')?.setAttribute('aria-label', t('Home'));
|
|
5844
|
+
document.querySelector('.sm-tb-home')?.setAttribute('aria-label', t('Reload and settings'));
|
|
5845
|
+
ui.colophon.setAttribute('aria-label', t('MADRE version'));
|
|
5209
5846
|
ui.bar.agents.setAttribute('aria-label', t('Agents'));
|
|
5210
5847
|
ui.bar.links.querySelector('span').textContent = t('Connections');
|
|
5211
5848
|
document.querySelector('#sm-tb-market span')?.replaceChildren(t('Market'));
|
|
@@ -5244,7 +5881,335 @@ function translateStatic() {
|
|
|
5244
5881
|
ui.memory.title.textContent = t('Memory');
|
|
5245
5882
|
ui.decisions.title.textContent = t('Recent decisions');
|
|
5246
5883
|
ui.attention.title.textContent = t('Needs you');
|
|
5247
|
-
|
|
5884
|
+
// A claim the room found false is said as everywhere else: a doubtful memory, not «aberration».
|
|
5885
|
+
for (const kind of KINDS) KIND_WORDS[kind] = t(kind === 'aberration' ? 'DOUBTFUL MEMORY' : kind.toUpperCase());
|
|
5886
|
+
sayHomeShell();
|
|
5887
|
+
}
|
|
5888
|
+
|
|
5889
|
+
// ---- HOME IN THE CHAT SHELL (2026-10-27) ------------------------------------------------------
|
|
5890
|
+
// Home framed as a project is (app.js, chatShell): a sidebar at the left that one key shows and
|
|
5891
|
+
// hides — MADRE, the ways to go, the projects at hand, the version and the house's keys at its
|
|
5892
|
+
// foot —, a bar of 48 px over the canvas with the page's name, the agents and the tools as quiet
|
|
5893
|
+
// icons, and the widgets flat on the canvas. The same classes as the room's sidebar (styles.css,
|
|
5894
|
+
// .side-*), so moving between Home and a project feels like one place. The projects at hand are
|
|
5895
|
+
// the ones the bar held (the pins: the open ones, until the person chooses), and a card dropped on
|
|
5896
|
+
// the list pins it there. Not on a phone, where the bar keeps them as before.
|
|
5897
|
+
const SIDE_KEY = 'pulse.homeSide';
|
|
5898
|
+
const SIDEBAR_GLYPH = trazo('sidebar');
|
|
5899
|
+
const HOME_GLYPH = trazo('home');
|
|
5900
|
+
// The Market drawn one way everywhere (2026-10-30): the basket with the modules inside; only the top bar's key moves on hover.
|
|
5901
|
+
const MARKET_GLYPH = trazo('market-key');
|
|
5902
|
+
const COORDINATOR_GLYPH = trazo('coordinator');
|
|
5903
|
+
const ALL_GLYPH = trazo('list');
|
|
5904
|
+
const homeShell = { side: null, list: null, said: '', open: false };
|
|
5905
|
+
const homeShellOn = () => root.classList.contains('home-shell');
|
|
5906
|
+
// A phone keeps Home as it was; a narrow window gets the sidebar over the canvas, shut at first.
|
|
5907
|
+
const SHELL_PHONE = '(max-width: 560px)';
|
|
5908
|
+
const SHELL_NARROW = '(max-width: 960px)';
|
|
5909
|
+
function sideKey(icon, label, run) {
|
|
5910
|
+
const key = button('shell-key', null, (event) => { event.stopPropagation(); run(); });
|
|
5911
|
+
key.innerHTML = icon; // trusted: our own SVG strings
|
|
5912
|
+
key.setAttribute('aria-label', label);
|
|
5913
|
+
key.title = label;
|
|
5914
|
+
return key;
|
|
5915
|
+
}
|
|
5916
|
+
function sideRow(icon, label, run, { here = false } = {}) {
|
|
5917
|
+
const row = button('side-row', null, run);
|
|
5918
|
+
row.innerHTML = icon; // trusted: our own SVG strings
|
|
5919
|
+
row.append(el('span', null, label));
|
|
5920
|
+
if (here) row.setAttribute('aria-current', 'page');
|
|
5921
|
+
return row;
|
|
5922
|
+
}
|
|
5923
|
+
function setSide(open, { keep = true } = {}) {
|
|
5924
|
+
homeShell.open = open;
|
|
5925
|
+
root.classList.toggle('home-side', open);
|
|
5926
|
+
homeShell.side?.toggleAttribute('inert', !open);
|
|
5927
|
+
if (keep && !window.matchMedia(SHELL_NARROW).matches) { try { localStorage.setItem(SIDE_KEY, open ? 'open' : 'shut'); } catch { /* as long as the page lasts */ } }
|
|
5928
|
+
}
|
|
5929
|
+
function buildHomeShell() {
|
|
5930
|
+
if (!root.classList.contains('chat-shell') || homeShell.side) return;
|
|
5931
|
+
const side = el('aside', 'sm-side');
|
|
5932
|
+
side.id = 'sm-side';
|
|
5933
|
+
const head = el('div', 'side-head');
|
|
5934
|
+
const brand = document.getElementById('sm-back')?.cloneNode(true);
|
|
5935
|
+
if (brand) { brand.removeAttribute('id'); brand.className = 'side-brand'; }
|
|
5936
|
+
homeShell.add = sideKey(ADD_ICON, t('Add a project'), () => ui.add.click());
|
|
5937
|
+
homeShell.hide = sideKey(SIDEBAR_GLYPH, t('Hide the sidebar'), () => setSide(false));
|
|
5938
|
+
head.append(homeShell.hide, ...(brand ? [brand] : []), el('span', 'side-grow'), homeShell.add);
|
|
5939
|
+
const nav = el('nav', 'side-nav');
|
|
5940
|
+
homeShell.rows = {
|
|
5941
|
+
add: sideRow(ADD_ICON, t('Add a project'), () => ui.add.click()),
|
|
5942
|
+
home: sideRow(HOME_GLYPH, t('Home'), () => window.scrollTo({ top: 0, behavior: motionStill() ? 'auto' : 'smooth' }), { here: true }),
|
|
5943
|
+
coordinator: sideRow(COORDINATOR_GLYPH, t('Coordinator'), () => openBishop()),
|
|
5944
|
+
market: sideRow(MARKET_GLYPH, t('Market'), () => openHomeMarket('shop')),
|
|
5945
|
+
};
|
|
5946
|
+
nav.append(...Object.values(homeShell.rows));
|
|
5947
|
+
const scroll = el('div', 'side-scroll');
|
|
5948
|
+
homeShell.label = el('div', 'side-label', t('Projects'));
|
|
5949
|
+
homeShell.list = el('div', 'side-projects');
|
|
5950
|
+
scroll.append(homeShell.label, homeShell.list);
|
|
5951
|
+
// A project's card dropped on the list keeps it here, where it was let go.
|
|
5952
|
+
scroll.addEventListener('dragover', (event) => {
|
|
5953
|
+
if (!pins.dropping || !event.dataTransfer?.types.includes(PIN_TYPE)) return;
|
|
5954
|
+
event.preventDefault();
|
|
5955
|
+
event.dataTransfer.dropEffect = 'copy';
|
|
5956
|
+
scroll.classList.add('is-drop');
|
|
5957
|
+
});
|
|
5958
|
+
scroll.addEventListener('dragleave', (event) => { if (!scroll.contains(event.relatedTarget)) scroll.classList.remove('is-drop'); });
|
|
5959
|
+
scroll.addEventListener('drop', (event) => {
|
|
5960
|
+
const id = event.dataTransfer?.getData(PIN_TYPE);
|
|
5961
|
+
scroll.classList.remove('is-drop');
|
|
5962
|
+
if (!id) return;
|
|
5963
|
+
event.preventDefault();
|
|
5964
|
+
const rows = [...homeShell.list.querySelectorAll('[data-room]')];
|
|
5965
|
+
const at = rows.findIndex((row) => { const box = row.getBoundingClientRect(); return event.clientY < box.top + box.height / 2; });
|
|
5966
|
+
pinsDropEnd();
|
|
5967
|
+
pinAdd(id, at < 0 ? rows.length : at);
|
|
5968
|
+
});
|
|
5969
|
+
const foot = el('div', 'side-foot');
|
|
5970
|
+
const who = el('div', 'side-who');
|
|
5971
|
+
homeShell.version = el('b', null, 'MADRE');
|
|
5972
|
+
const copy = el('a', 'side-copy', `© ${YEAR} ${AUTHOR}`);
|
|
5973
|
+
copy.href = AUTHOR_URL;
|
|
5974
|
+
copy.target = '_blank';
|
|
5975
|
+
copy.rel = 'noopener';
|
|
5976
|
+
who.append(homeShell.version, copy);
|
|
5977
|
+
homeShell.settings = sideKey(ui.gear.innerHTML, t('Settings'), () => openSettings());
|
|
5978
|
+
homeShell.power = sideKey(POWER_ICON, t('Restart or turn off MADRE'), () => openPowerMenu(homeShell.power));
|
|
5979
|
+
homeShell.power.setAttribute('aria-haspopup', 'menu');
|
|
5980
|
+
foot.append(who, homeShell.settings, homeShell.power);
|
|
5981
|
+
side.append(head, nav, scroll, foot);
|
|
5982
|
+
document.body.prepend(side);
|
|
5983
|
+
homeShell.side = side;
|
|
5984
|
+
arrangeHomeBar();
|
|
5985
|
+
// In the bar, while the sidebar is shut: its key, before the page's name.
|
|
5986
|
+
homeShell.show = sideKey(SIDEBAR_GLYPH, t('Show the sidebar'), () => setSide(true));
|
|
5987
|
+
homeShell.show.classList.add('sm-side-show');
|
|
5988
|
+
document.querySelector('.sm-top > .sm-topbar:first-child')?.prepend(homeShell.show);
|
|
5989
|
+
// Over the canvas on a narrow window: a press outside, or Escape, puts it away.
|
|
5990
|
+
homeShell.scrim = el('div', 'sm-side-scrim');
|
|
5991
|
+
homeShell.scrim.addEventListener('click', () => setSide(false, { keep: false }));
|
|
5992
|
+
document.body.append(homeShell.scrim);
|
|
5993
|
+
document.addEventListener('keydown', (event) => {
|
|
5994
|
+
if (event.key === 'Escape' && homeShell.open && window.matchMedia(SHELL_NARROW).matches && !document.querySelector('dialog[open]')) setSide(false, { keep: false });
|
|
5995
|
+
});
|
|
5996
|
+
const place = () => {
|
|
5997
|
+
const was = homeShellOn();
|
|
5998
|
+
const on = !window.matchMedia(SHELL_PHONE).matches;
|
|
5999
|
+
root.classList.toggle('home-shell', on);
|
|
6000
|
+
if (on !== was && data) drawPins();
|
|
6001
|
+
let kept = null;
|
|
6002
|
+
try { kept = localStorage.getItem(SIDE_KEY); } catch { /* no storage */ }
|
|
6003
|
+
if (window.matchMedia(SHELL_NARROW).matches) setSide(false, { keep: false });
|
|
6004
|
+
else setSide(kept ? kept === 'open' : true, { keep: false });
|
|
6005
|
+
};
|
|
6006
|
+
window.matchMedia(SHELL_PHONE).addEventListener?.('change', place);
|
|
6007
|
+
window.matchMedia(SHELL_NARROW).addEventListener?.('change', place);
|
|
6008
|
+
place();
|
|
6009
|
+
}
|
|
6010
|
+
// The projects at hand, each with its state as the room's sidebar says it: a press goes there, or
|
|
6011
|
+
// wakes it and goes in; ⌘-press opens it in a new tab. The rest are one row away, on Home itself.
|
|
6012
|
+
function drawSideProjects() {
|
|
6013
|
+
if (!homeShell.list || !data) return;
|
|
6014
|
+
if (data.version) homeShell.version.textContent = `MADRE ${data.version}`;
|
|
6015
|
+
const ids = pinsShown();
|
|
6016
|
+
const rooms = ids.map((id) => data.rooms.find((one) => one.id === id)).filter(Boolean);
|
|
6017
|
+
const said = JSON.stringify([language, rooms.map((room) => [room.id, room.name, room.open?.port ?? 0, busy.get(room.id) ?? stateOf(room).key, room.glance?.waitingCount ?? 0])]);
|
|
6018
|
+
if (said === homeShell.said) return;
|
|
6019
|
+
homeShell.said = said;
|
|
6020
|
+
homeShell.label.textContent = t('Projects');
|
|
6021
|
+
const MOOD = { calm: 'calm', working: 'working', waiting: 'waiting', outdated: 'quiet', quiet: 'quiet', asleep: 'asleep' };
|
|
6022
|
+
const rows = rooms.map((room) => {
|
|
6023
|
+
const state = stateOf(room);
|
|
6024
|
+
const waking = busy.get(room.id) === 'starting';
|
|
6025
|
+
const row = el(room.open ? 'a' : 'button', `side-project${room.open ? '' : ' asleep'}`);
|
|
6026
|
+
row.dataset.room = room.id;
|
|
6027
|
+
row.append(el('i', `side-dot ${waking ? 'working' : MOOD[state.key] ?? 'calm'}`), el('span', 'side-project-name', room.name));
|
|
6028
|
+
if (state.key === 'waiting') row.append(el('small', 'side-count', String(room.glance.waitingCount)));
|
|
6029
|
+
row.title = `${room.name} · ${waking ? t('Waking…') : state.words}`;
|
|
6030
|
+
if (room.open) row.href = addressOf(room);
|
|
6031
|
+
else { row.type = 'button'; row.addEventListener('click', (event) => { if (busy.has(room.id)) return; if (event.metaKey || event.ctrlKey) void startRoom(room); else void startRoom(room, { enter: true }); }); }
|
|
6032
|
+
row.addEventListener('contextmenu', (event) => pinsMenu(event, room));
|
|
6033
|
+
return row;
|
|
6034
|
+
});
|
|
6035
|
+
const all = sideRow(ALL_GLYPH, t('All your projects'), () => document.getElementById('sm-drawer')?.scrollIntoView({ behavior: motionStill() ? 'auto' : 'smooth', block: 'start' }));
|
|
6036
|
+
all.classList.add('side-all');
|
|
6037
|
+
if (!rooms.length) rows.push(el('p', 'side-empty', t('Open a project and it shows here.')));
|
|
6038
|
+
homeShell.list.replaceChildren(...rows, all);
|
|
6039
|
+
}
|
|
6040
|
+
function sayHomeShell() {
|
|
6041
|
+
if (!homeShell.side) return;
|
|
6042
|
+
homeShell.side.setAttribute('aria-label', t('Home'));
|
|
6043
|
+
const words = { add: t('Add a project'), home: t('Home'), coordinator: t('Coordinator'), market: t('Market') };
|
|
6044
|
+
for (const [key, row] of Object.entries(homeShell.rows)) row.querySelector('span').textContent = words[key];
|
|
6045
|
+
for (const [key, label] of [[homeShell.add, t('Add a project')], [homeShell.hide, t('Hide the sidebar')], [homeShell.show, t('Show the sidebar')], [homeShell.settings, t('Settings')], [homeShell.power, t('Restart or turn off MADRE')]]) { key.title = label; key.setAttribute('aria-label', label); }
|
|
6046
|
+
homeShell.said = '';
|
|
6047
|
+
drawSideProjects();
|
|
6048
|
+
}
|
|
6049
|
+
// ---- WINDOWS IN HOME (2026-10-28), as a project's are (app.js, marketAsWindow and its helpers):
|
|
6050
|
+
// the sheet carried by its bar, sized by its sides and corners, always whole inside the browser
|
|
6051
|
+
// window, the one touched last in front, and its place kept for the next time. Over the sidebar,
|
|
6052
|
+
// as a project's windows stand over its sidebar; the Market is the one that opens this way.
|
|
6053
|
+
const HOME_WINDOW_LAYER = 44;
|
|
6054
|
+
const HOME_WINDOW_INSET = 8;
|
|
6055
|
+
const homeWindows = [];
|
|
6056
|
+
function homeWindowForward(node) {
|
|
6057
|
+
const at = homeWindows.indexOf(node);
|
|
6058
|
+
if (at >= 0) homeWindows.splice(at, 1);
|
|
6059
|
+
homeWindows.push(node);
|
|
6060
|
+
homeWindows.forEach((one, index) => { one.style.zIndex = String(HOME_WINDOW_LAYER + index); one.classList.toggle('front', index === homeWindows.length - 1); });
|
|
6061
|
+
}
|
|
6062
|
+
// Depth of field in Home (2026-10-30), as in a project (app.js, paintDepth): while windows float
|
|
6063
|
+
// over Home, the page behind them — its bar and its widgets — recedes under one veil, a little more
|
|
6064
|
+
// for each window up to three, and clears the moment the last one closes. The sidebar stands over
|
|
6065
|
+
// the veil and stays sharp, as a project's does. One veil, not a filter on each piece, so the glass
|
|
6066
|
+
// of what is behind keeps working.
|
|
6067
|
+
const homeVeil = el('div', 'desk-veil');
|
|
6068
|
+
homeVeil.setAttribute('aria-hidden', 'true');
|
|
6069
|
+
document.body.append(homeVeil);
|
|
6070
|
+
function paintHomeDepth() {
|
|
6071
|
+
const open = [...document.querySelectorAll('.home-window')].filter((one) => one.isConnected && !one.hidden && (one.tagName !== 'DIALOG' || one.open) && one.getClientRects().length && !one.classList.contains('leaving'));
|
|
6072
|
+
const depth = Math.min(3, open.length);
|
|
6073
|
+
if (depth) homeVeil.style.setProperty('--desk-depth', String(depth)); else homeVeil.style.removeProperty('--desk-depth');
|
|
6074
|
+
root.classList.toggle('desk-behind', depth > 0);
|
|
6075
|
+
}
|
|
6076
|
+
let homeDepthFrame = 0;
|
|
6077
|
+
const scheduleHomeDepth = () => { cancelAnimationFrame(homeDepthFrame); homeDepthFrame = requestAnimationFrame(paintHomeDepth); };
|
|
6078
|
+
if (typeof MutationObserver === 'function') {
|
|
6079
|
+
// A window opened, closed, shown or put away, by whatever road.
|
|
6080
|
+
new MutationObserver(scheduleHomeDepth).observe(document.body, { subtree: true, childList: true, attributes: true, attributeFilter: ['hidden', 'open'] });
|
|
6081
|
+
document.addEventListener?.('close', scheduleHomeDepth, true);
|
|
6082
|
+
}
|
|
6083
|
+
function homeWindowBox(box, { minW, minH }) {
|
|
6084
|
+
const w = Math.round(Math.max(minW, Math.min(box.w, window.innerWidth - 2 * HOME_WINDOW_INSET)));
|
|
6085
|
+
const h = Math.round(Math.max(minH, Math.min(box.h, window.innerHeight - 2 * HOME_WINDOW_INSET)));
|
|
6086
|
+
// Partly past a side is allowed; the bar always stays in reach, never under the top edge.
|
|
6087
|
+
const x = Math.round(Math.max(120 - w, Math.min(window.innerWidth - 120, box.x)));
|
|
6088
|
+
const y = Math.round(Math.max(HOME_WINDOW_INSET, Math.min(window.innerHeight - 48, box.y)));
|
|
6089
|
+
return { x, y, w, h };
|
|
6090
|
+
}
|
|
6091
|
+
function homeWindow({ root, bar, close, key, minW = 360, minH = 360, keys = true, size = { w: 1040, h: 780 } }) {
|
|
6092
|
+
if (!homeShellOn()) return null;
|
|
6093
|
+
let framed = true;
|
|
6094
|
+
root.classList.add('surface', 'window', 'home-window');
|
|
6095
|
+
scheduleHomeDepth();
|
|
6096
|
+
let kept = null;
|
|
6097
|
+
try { kept = JSON.parse(localStorage.getItem(key) ?? 'null'); } catch { /* no storage */ }
|
|
6098
|
+
const fresh = () => {
|
|
6099
|
+
const w = Math.min(size.w, window.innerWidth - 32);
|
|
6100
|
+
const h = Math.min(size.h, window.innerHeight - 90);
|
|
6101
|
+
return { x: Math.max(16, Math.round((window.innerWidth - w) / 2)), y: 56, w, h };
|
|
6102
|
+
};
|
|
6103
|
+
let want = kept?.w && kept?.h ? kept : fresh();
|
|
6104
|
+
let box = null;
|
|
6105
|
+
const place = (next) => {
|
|
6106
|
+
want = { ...next };
|
|
6107
|
+
box = homeWindowBox(next, { minW, minH });
|
|
6108
|
+
root.style.left = `${box.x}px`;
|
|
6109
|
+
root.style.top = `${box.y}px`;
|
|
6110
|
+
root.style.width = `${box.w}px`;
|
|
6111
|
+
root.style.height = `${box.h}px`;
|
|
6112
|
+
};
|
|
6113
|
+
const remember = () => { try { localStorage.setItem(key, JSON.stringify(box)); } catch { /* as long as the page lasts */ } };
|
|
6114
|
+
place(want);
|
|
6115
|
+
// Its close, at the right of its bar, as every window's (styles.css, .surface-modes, .x-close).
|
|
6116
|
+
const group = el('span', 'surface-modes');
|
|
6117
|
+
const shut = button('surface-mode close x-close x-only', null, () => close());
|
|
6118
|
+
shut.setAttribute('aria-label', t('Close'));
|
|
6119
|
+
shut.innerHTML = `<span class="x-icon">${trazo('close')}</span>`; // trusted: our own SVG
|
|
6120
|
+
group.append(shut);
|
|
6121
|
+
if (keys) bar.append(group);
|
|
6122
|
+
// Carried by its bar, wherever the bar is not a key, a field or a tab.
|
|
6123
|
+
const hold = (handle, change, skip = () => false) => handle.addEventListener('pointerdown', (event) => {
|
|
6124
|
+
if (event.button !== 0 || !framed || skip(event)) return;
|
|
6125
|
+
event.preventDefault();
|
|
6126
|
+
event.stopPropagation();
|
|
6127
|
+
homeWindowForward(root);
|
|
6128
|
+
try { handle.setPointerCapture(event.pointerId); } catch { /* a pointer the page no longer holds */ }
|
|
6129
|
+
const start = { ...box };
|
|
6130
|
+
const from = { x: event.clientX, y: event.clientY };
|
|
6131
|
+
let frame = 0;
|
|
6132
|
+
root.classList.add('moving');
|
|
6133
|
+
const move = (moving) => { cancelAnimationFrame(frame); frame = requestAnimationFrame(() => place(change(start, moving.clientX - from.x, moving.clientY - from.y))); };
|
|
6134
|
+
const finish = () => {
|
|
6135
|
+
cancelAnimationFrame(frame);
|
|
6136
|
+
root.classList.remove('moving');
|
|
6137
|
+
for (const [type, run] of [['pointermove', move], ['pointerup', finish], ['pointercancel', finish], ['lostpointercapture', finish]]) handle.removeEventListener(type, run);
|
|
6138
|
+
remember();
|
|
6139
|
+
};
|
|
6140
|
+
handle.addEventListener('pointermove', move);
|
|
6141
|
+
handle.addEventListener('pointerup', finish);
|
|
6142
|
+
handle.addEventListener('pointercancel', finish);
|
|
6143
|
+
handle.addEventListener('lostpointercapture', finish);
|
|
6144
|
+
});
|
|
6145
|
+
hold(bar, (start, dx, dy) => ({ ...start, x: start.x + dx, y: start.y + dy }), (event) => Boolean(event.target.closest('button, input, label, a, select, textarea, [role="tab"]')));
|
|
6146
|
+
for (const side of ['n', 's', 'e', 'w', 'ne', 'nw', 'se', 'sw']) {
|
|
6147
|
+
const edge = el('div', `win-edge ${side}`);
|
|
6148
|
+
edge.setAttribute('aria-hidden', 'true');
|
|
6149
|
+
root.append(edge);
|
|
6150
|
+
hold(edge, (start, dx, dy) => {
|
|
6151
|
+
const next = { ...start };
|
|
6152
|
+
if (side.includes('e')) next.w = start.w + dx;
|
|
6153
|
+
if (side.includes('s')) next.h = start.h + dy;
|
|
6154
|
+
if (side.includes('w')) { next.w = Math.max(minW, start.w - dx); next.x = start.x + start.w - next.w; }
|
|
6155
|
+
if (side.includes('n')) { next.h = Math.max(minH, start.h - dy); next.y = start.y + start.h - next.h; }
|
|
6156
|
+
return next;
|
|
6157
|
+
});
|
|
6158
|
+
}
|
|
6159
|
+
root.addEventListener('pointerdown', () => { if (framed) homeWindowForward(root); }, true);
|
|
6160
|
+
const refit = () => { if (root.isConnected && framed) place(want); };
|
|
6161
|
+
window.addEventListener('resize', refit);
|
|
6162
|
+
homeWindowForward(root);
|
|
6163
|
+
return {
|
|
6164
|
+
raise: () => homeWindowForward(root),
|
|
6165
|
+
// Another size for now, not kept: a window fitted to what it shows (openHomeAdd).
|
|
6166
|
+
resize: (next) => { if (framed) place({ ...want, ...next }); },
|
|
6167
|
+
drop: () => {
|
|
6168
|
+
window.removeEventListener('resize', refit);
|
|
6169
|
+
const at = homeWindows.indexOf(root);
|
|
6170
|
+
if (at >= 0) homeWindows.splice(at, 1);
|
|
6171
|
+
homeWindows.at(-1)?.classList.add('front');
|
|
6172
|
+
},
|
|
6173
|
+
// Back to the whole screen: the same node, its place and its sides put away.
|
|
6174
|
+
release: () => {
|
|
6175
|
+
framed = false;
|
|
6176
|
+
window.removeEventListener('resize', refit);
|
|
6177
|
+
const at = homeWindows.indexOf(root);
|
|
6178
|
+
if (at >= 0) homeWindows.splice(at, 1);
|
|
6179
|
+
for (const side of ['left', 'top', 'width', 'height', 'z-index']) root.style.removeProperty(side);
|
|
6180
|
+
root.classList.remove('surface', 'window', 'home-window', 'front');
|
|
6181
|
+
scheduleHomeDepth();
|
|
6182
|
+
for (const edge of root.querySelectorAll(':scope > .win-edge')) edge.remove();
|
|
6183
|
+
group.remove();
|
|
6184
|
+
},
|
|
6185
|
+
};
|
|
6186
|
+
}
|
|
6187
|
+
// The bar's keys by family, a hairline between them as in a project (styles.css, .bar-family): the
|
|
6188
|
+
// projects' own — how they connect and their map —, then MADRE's — the Market and the modules —,
|
|
6189
|
+
// then Home's own after its line. The modules wear the project's piece, the same key there and here.
|
|
6190
|
+
function arrangeHomeBar() {
|
|
6191
|
+
const links = $('sm-tb-links');
|
|
6192
|
+
const market = $('sm-tb-market');
|
|
6193
|
+
const modules = $('sm-tb-modules');
|
|
6194
|
+
if (!links || !market || !modules) return;
|
|
6195
|
+
links.after(ui.macro);
|
|
6196
|
+
const line = el('span', 'sm-family');
|
|
6197
|
+
line.setAttribute('aria-hidden', 'true');
|
|
6198
|
+
market.before(line);
|
|
6199
|
+
modules.querySelector('svg')?.replaceWith(Object.assign(document.createElement('span'), { innerHTML: MODULES_GLYPH }).firstElementChild);
|
|
6200
|
+
// The map keeps its own key (salas-mac.html): since Trazo MADRE (2026-10-28) it is the planet with
|
|
6201
|
+
// its ring, as in the side panel, and its moons still go round while the pointer stays.
|
|
6202
|
+
}
|
|
6203
|
+
const MODULES_GLYPH = trazo('puzzle');
|
|
6204
|
+
|
|
6205
|
+
buildHomeShell();
|
|
6206
|
+
// «En marcha» (2026-10-30): the same key and panel as in a project (public/activity.js). Home's own
|
|
6207
|
+
// conversations are the Coordinator's, on this room's page.
|
|
6208
|
+
{
|
|
6209
|
+
const key = $('sm-tb-activity');
|
|
6210
|
+
const words = key?.querySelector(':scope > span');
|
|
6211
|
+
if (words) words.textContent = t('Running now');
|
|
6212
|
+
if (key) mountActivity({ key, badge: $('sm-tb-activity-count'), openChat: ({ chat, messageId }) => { location.href = `/#chat=${encodeURIComponent(chat)}${messageId ? `:${encodeURIComponent(messageId)}` : ''}`; }, toast: (said) => toast(said) });
|
|
5248
6213
|
}
|
|
5249
6214
|
|
|
5250
6215
|
translateStatic();
|
|
@@ -5281,8 +6246,8 @@ void loadVersion();
|
|
|
5281
6246
|
void loadWork();
|
|
5282
6247
|
void loadDecisions();
|
|
5283
6248
|
void loadReminders({ opening: true });
|
|
5284
|
-
// `#welcome`: the
|
|
5285
|
-
if (location.hash === '#welcome') { history.replaceState(null, '', location.pathname);
|
|
6249
|
+
// `#welcome`: the welcome again, on purpose (to connect an agent or add projects in steps).
|
|
6250
|
+
if (location.hash === '#welcome') { history.replaceState(null, '', location.pathname); openHomeWelcome(); }
|
|
5286
6251
|
// Sent here for the Macroverso (the key in BISHOP's room): straight into it, on a large screen.
|
|
5287
6252
|
if (location.hash === '#macroverso' && data && !ui.macro.hidden) { history.replaceState(null, '', location.pathname); ui.macro.click(); }
|
|
5288
6253
|
// Sent here for the Market (a project's MODULES, or a module offered in the conversation): straight in,
|