@jossuealcala/madre 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.en.md +21 -1
- package/CHANGELOG.md +21 -1
- package/README.en.md +3 -3
- package/README.md +3 -3
- package/SECURITY.md +11 -6
- package/bin/madre.mjs +74 -11
- package/docs/REFERENCE.md +13 -7
- package/docs/SDK.md +8 -8
- package/docs/en/REFERENCE.md +10 -6
- package/docs/en/SDK.md +8 -8
- package/docs/en/training/README.md +1 -1
- package/docs/sdk/connector-module.mjs +1 -1
- package/docs/sdk/hello-module.mjs +1 -1
- package/docs/training/README.md +1 -1
- package/docs/training/train.sh +3 -0
- package/package.json +4 -2
- package/public/activity.js +9 -0
- package/public/app.js +988 -171
- package/public/attribution.js +9 -0
- package/public/brands.js +27 -13
- package/public/en.js +1 -2
- package/public/es.js +834 -257
- package/public/index.html +3 -0
- package/public/macroverso.js +24 -5
- package/public/manual-content.js +32 -2
- package/public/market-view.js +116 -9
- package/public/market.js +15 -0
- package/public/news-scenes.js +185 -0
- package/public/notices.js +66 -0
- package/public/power.js +1 -1
- package/public/resay.js +3 -0
- package/public/salas-mac.css +229 -26
- package/public/salas-mac.html +3 -0
- package/public/salas-mac.js +454 -37
- package/public/styles.css +393 -17
- package/public/tips.js +124 -0
- package/public/tour-chapters.js +75 -75
- package/public/tour.js +36 -8
- package/public/troubleshooting.js +215 -22
- package/public/welcome-scene.js +358 -0
- package/public/welcome.js +514 -273
- package/src/adapters/gemini-rest.mjs +236 -0
- package/src/adapters/gemini.mjs +9 -7
- package/src/adapters/grok.mjs +288 -0
- package/src/adapters/process.mjs +14 -3
- package/src/auth-probe.mjs +32 -0
- package/src/bridge/policy.mjs +1 -1
- package/src/capabilities.mjs +30 -0
- package/src/checkpoint.mjs +115 -1
- package/src/codex-route.mjs +113 -0
- package/src/credentials.mjs +46 -8
- package/src/dataset.mjs +18 -7
- package/src/event-store.mjs +10 -2
- package/src/ficha.mjs +142 -0
- package/src/files.mjs +36 -2
- package/src/lease.mjs +5 -0
- package/src/market-check.mjs +1 -1
- package/src/market-remote.mjs +135 -1
- package/src/mcp/image-server.mjs +1 -1
- package/src/mcp/memory-server.mjs +10 -0
- package/src/memory-tools.mjs +3 -0
- package/src/memory.mjs +29 -4
- package/src/models.mjs +21 -3
- package/src/modules/ahp.mjs +8 -3
- package/src/modules/bishop-exam.mjs +41 -12
- package/src/modules/bishop.mjs +2 -2
- package/src/modules/choices.mjs +12 -10
- package/src/modules/fetch-alone.mjs +7 -0
- package/src/modules/helpers.mjs +23 -5
- package/src/modules/image-studio.mjs +13 -27
- package/src/modules/index.mjs +54 -11
- package/src/modules/isolated.mjs +160 -0
- package/src/modules/ollama.mjs +35 -6
- package/src/modules/playwright.mjs +46 -17
- package/src/modules/run-alone.mjs +122 -0
- package/src/modules/runs.mjs +11 -8
- package/src/modules/sdk.mjs +4 -2
- package/src/notices-key.mjs +8 -0
- package/src/notices.mjs +185 -0
- package/src/ollama.mjs +57 -15
- package/src/outbound.mjs +45 -8
- package/src/room/archivist.mjs +30 -5
- package/src/room/busy.mjs +16 -0
- package/src/room/control.mjs +36 -6
- package/src/room/guard.mjs +32 -2
- package/src/room/prompt.mjs +32 -5
- package/src/room/vectors.mjs +7 -1
- package/src/room.mjs +94 -28
- package/src/router.mjs +1 -1
- package/src/runs.mjs +39 -0
- package/src/runtime-detection.mjs +46 -6
- package/src/salas.mjs +151 -15
- package/src/server.mjs +577 -80
- package/src/service.mjs +116 -0
- package/src/setup-trouble.mjs +20 -1
- package/src/skill-check.mjs +269 -0
- package/src/skills-import.mjs +128 -0
- package/src/skills.mjs +492 -0
- package/src/tour.mjs +14 -3
- package/src/whats-new.mjs +48 -0
- package/src/rumbo.mjs +0 -337
package/public/salas-mac.js
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
import { browserLanguage, sessionDetail, setLanguage, t } from './i18n.js';
|
|
11
11
|
import { brandOf, monogram } from './brands.js';
|
|
12
|
+
import { installTips } from './tips.js';
|
|
12
13
|
import { SPONSORS_URL, startReviewAsk } from './review-ask.js';
|
|
14
|
+
import { mountNotices } from './notices.js';
|
|
13
15
|
import { startTour } from './tour.js';
|
|
14
16
|
import { dropStickyHover } from './touch.js';
|
|
15
17
|
import { AUTHOR, AUTHOR_URL, YEAR, drawAttribution, drawColophonKeys, drawLegal } from './attribution.js';
|
|
@@ -29,6 +31,7 @@ import { trazo, trazoDrawing } from './icons.js';
|
|
|
29
31
|
import { tellFailures } from './page-errors.js';
|
|
30
32
|
import { mountActivity } from './activity.js';
|
|
31
33
|
import { ensureTerms } from './terms.js';
|
|
34
|
+
import { createNewsScene } from './news-scenes.js';
|
|
32
35
|
|
|
33
36
|
// Nothing of MADRE starts before its license and privacy notice are accepted on this computer
|
|
34
37
|
// (public/terms.js, src/terms.mjs): the page waits here.
|
|
@@ -80,6 +83,7 @@ const failed = new Map(); // room id → what went wrong, said on its card
|
|
|
80
83
|
const conversationsCount = (n) => (n === 1 ? t('1 conversation') : t('{n} conversations', { n }));
|
|
81
84
|
const memoriesCount = (n) => (n === 1 ? t('1 memory') : t('{n} memories', { n }));
|
|
82
85
|
const revoking = new Set(); // link ids whose row asks before revoking
|
|
86
|
+
const linksOpen = new Set(); // link ids unfolded in the list (2026-11-07: folded by default)
|
|
83
87
|
|
|
84
88
|
// The room's looks, from this browser: the same keys the room's own page keeps (app.js, LOOKS),
|
|
85
89
|
// so a choice made here is the room's too when the room is served at this address.
|
|
@@ -160,6 +164,8 @@ function applyLooks() {
|
|
|
160
164
|
// The person's picture as this browser last knew it, before the first look is painted.
|
|
161
165
|
paintCustomWall(rememberedWall());
|
|
162
166
|
applyLooks();
|
|
167
|
+
// One small solid label for every key that explains itself (public/tips.js).
|
|
168
|
+
installTips();
|
|
163
169
|
function saveLooks({ theme, accent, wallpaper, style, bubbles, text }) {
|
|
164
170
|
// The first value of each look is the room as it always was, kept as no choice at all (app.js, saveLook).
|
|
165
171
|
const keep = (key, value, first) => { if (value === first) localStorage.removeItem(key); else localStorage.setItem(key, value); };
|
|
@@ -968,21 +974,33 @@ const LINK_ARROW = '<svg viewBox="0 0 60 16" aria-hidden="true"><path d="M58 8H6
|
|
|
968
974
|
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>';
|
|
969
975
|
function linkRow(enlace) {
|
|
970
976
|
const { source, reader } = endsOf(enlace);
|
|
971
|
-
|
|
977
|
+
// Folded by default (2026-11-07): one even row per connection — the pair centred, its kind and its
|
|
978
|
+
// readings under it — so a person with many finds theirs without scrolling; it unfolds in place.
|
|
979
|
+
const node = el('details', `sm-link${revoking.has(enlace.id) ? ' revoking' : ''}`);
|
|
972
980
|
node.dataset.link = enlace.id;
|
|
973
|
-
node.
|
|
981
|
+
node.open = linksOpen.has(enlace.id) || revoking.has(enlace.id);
|
|
982
|
+
node.addEventListener('toggle', () => { if (node.open) linksOpen.add(enlace.id); else linksOpen.delete(enlace.id); });
|
|
983
|
+
const summary = el('summary', 'sm-link-summary');
|
|
984
|
+
const body = el('div', 'sm-link-body');
|
|
974
985
|
// Who looks up whom, as the map draws it.
|
|
975
986
|
const pair = el('div', 'sm-link-pair');
|
|
976
987
|
const arrow = el('span', 'sm-link-arrow');
|
|
977
988
|
arrow.innerHTML = enlace.direction === 'both' ? LINK_BOTH : LINK_ARROW; // trusted: our own SVG strings
|
|
978
989
|
arrow.append(el('small', null, enlace.direction === 'both' ? t('read each other') : t('looks up')));
|
|
979
|
-
|
|
990
|
+
const left = LINK_MARK(reader);
|
|
991
|
+
const right = LINK_MARK(source);
|
|
992
|
+
left.classList.add('left');
|
|
993
|
+
right.classList.add('right');
|
|
994
|
+
pair.append(left, arrow, right);
|
|
980
995
|
// The drawing says it; the sentence is kept for whoever hears the page.
|
|
981
996
|
const who = el('span');
|
|
982
997
|
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 }));
|
|
983
998
|
pair.setAttribute('role', 'img');
|
|
984
999
|
pair.setAttribute('aria-label', who.textContent);
|
|
985
|
-
|
|
1000
|
+
summary.append(pair);
|
|
1001
|
+
// In order (2026-11-07): who reads whom, then what crosses, then on what terms, then the switches,
|
|
1002
|
+
// and at the foot how much it was read and the way out. Each part under its own small heading.
|
|
1003
|
+
const section = (title) => { const part = el('div', 'sm-link-part'); part.append(el('span', 'sm-link-part-title', title)); body.append(part); return part; };
|
|
986
1004
|
// What crosses, until when, and whether orders go.
|
|
987
1005
|
const tags = el('div', 'sm-link-tags');
|
|
988
1006
|
for (const kind of enlace.kinds ?? []) {
|
|
@@ -991,15 +1009,24 @@ function linkRow(enlace) {
|
|
|
991
1009
|
tag.append(el('i', `k-${kind}`), word.slice(0, 1).toLocaleUpperCase(language) + word.slice(1));
|
|
992
1010
|
tags.append(tag);
|
|
993
1011
|
}
|
|
994
|
-
|
|
995
|
-
|
|
1012
|
+
section(t('What crosses')).append(tags);
|
|
1013
|
+
const terms = el('div', 'sm-link-tags terms');
|
|
1014
|
+
terms.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')));
|
|
1015
|
+
terms.append(el('span', 'sm-link-tag plain', enlace.orders?.allowed ? t('orders up to #{n}', { n: enlace.orders.maxMode }) : t('no orders')));
|
|
996
1016
|
// D-S13: a link BISHOP signed on its own says so, so it is never mistaken for one you signed.
|
|
997
|
-
if (enlace.signed?.by === 'bishop')
|
|
998
|
-
|
|
1017
|
+
if (enlace.signed?.by === 'bishop') terms.append(el('span', 'sm-link-tag plain', t('signed by the Coordinator')));
|
|
1018
|
+
section(t('Terms')).append(terms);
|
|
999
1019
|
const traffic = enlace.traffic ?? {};
|
|
1000
1020
|
// S-021: the last reading says who read, as the room that asked said it.
|
|
1001
1021
|
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');
|
|
1002
|
-
|
|
1022
|
+
const trafficLine = el('p', 'traffic', [t('{n} reads in 24 h', { n: traffic.reads24h ?? 0 }), last].join(' · '));
|
|
1023
|
+
// Under the pair, folded: what kind of connection it is and how much it was read.
|
|
1024
|
+
const meta = el('span', 'sm-link-meta');
|
|
1025
|
+
meta.append(el('b', null, source === data.salas || reader === data.salas ? t('With the Coordinator') : t('Between projects')), el('span', null, t('{n} reads in 24 h', { n: traffic.reads24h ?? 0 })));
|
|
1026
|
+
const dots = el('span', 'sm-link-dots');
|
|
1027
|
+
for (const kind of enlace.kinds ?? []) dots.append(el('i', `k-${kind}`));
|
|
1028
|
+
meta.append(dots);
|
|
1029
|
+
summary.append(meta, el('span', 'sm-link-chevron'));
|
|
1003
1030
|
// What else it allows, each a switch that says what it does (Fase 3e, D-S15, D-S16, D-S17).
|
|
1004
1031
|
const options = el('div', 'sm-link-options');
|
|
1005
1032
|
const option = (on, title, says, path, payload) => {
|
|
@@ -1026,11 +1053,14 @@ function linkRow(enlace) {
|
|
|
1026
1053
|
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 }));
|
|
1027
1054
|
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 }));
|
|
1028
1055
|
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 }));
|
|
1029
|
-
|
|
1056
|
+
section(t('What it allows')).append(options);
|
|
1030
1057
|
const actions = el('div', 'sm-actions');
|
|
1031
1058
|
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(); }));
|
|
1032
1059
|
else actions.append(button('sm-btn ghost small', t('Cancel the connection'), () => { revoking.add(enlace.id); draw(); }));
|
|
1033
|
-
|
|
1060
|
+
const foot = el('div', 'sm-link-foot');
|
|
1061
|
+
foot.append(trafficLine, actions);
|
|
1062
|
+
body.append(foot);
|
|
1063
|
+
node.append(summary, body);
|
|
1034
1064
|
return node;
|
|
1035
1065
|
}
|
|
1036
1066
|
// How a connection works, in three steps under the sheet's title, as the project map says its own
|
|
@@ -1534,6 +1564,12 @@ const WIDGETS = {
|
|
|
1534
1564
|
// MADRE's course (2026-11-01, src/rumbo.mjs): the variables that decide where the project goes,
|
|
1535
1565
|
// from madre.run's funnel, GitHub and npm. Only in the author's copy run from source.
|
|
1536
1566
|
'w-rumbo': { kind: 'rumbo', owner: true, name: () => t('MADRE\'s course'), about: () => t('The variables that decide where MADRE goes: from a visit to a habit, what the numbers decide, and GitHub and npm. Only you see this.'), size: 12, sizes: [12] },
|
|
1567
|
+
// The author's error log (2026-11-05, src/madre-logs.mjs): ~/madre-logs as agents add and close
|
|
1568
|
+
// errors, read from this Mac's disk every few seconds. Only in the author's copy run from source.
|
|
1569
|
+
'w-madrelogs': { kind: 'madrelogs', owner: true, every: 5000, name: () => 'madre-logs', about: () => t('MADRE\'s errors as they are added and fixed: what is still to fix by class and type, what waits to be verified, and the last changes. Read from this Mac; only you see this.'), size: 8, rows: 8 },
|
|
1570
|
+
// The author's notices (Q-11, src/notices.mjs): written here, signed on this computer, read by every
|
|
1571
|
+
// copy. Only in the author's copy run from source, with the token and the notices' key.
|
|
1572
|
+
'w-notices': { kind: 'notices', owner: true, every: 60000, name: () => t('Notices to every copy'), about: () => t('Write a notice that every copy of MADRE shows, with or without diagnostics: signed on this computer, read from madre.run. Only you see this.'), size: 8, rows: 0 },
|
|
1537
1573
|
'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 },
|
|
1538
1574
|
// Your agenda (2026-10-28): every project's reminders by when they are due — late, today, tomorrow,
|
|
1539
1575
|
// this week, later —, each settled here, and a new one written as you would say it. Read from the
|
|
@@ -1566,6 +1602,8 @@ const TILE_ICONS = {
|
|
|
1566
1602
|
'w-installs': trazo('download'),
|
|
1567
1603
|
'w-environments': trazo('globe'),
|
|
1568
1604
|
'w-rumbo': trazo('trending'),
|
|
1605
|
+
'w-madrelogs': trazo('list'),
|
|
1606
|
+
'w-notices': trazo('broadcast'),
|
|
1569
1607
|
};
|
|
1570
1608
|
const tileIcon = (id) => { const box = el('span', 'sm-tile-icon'); box.innerHTML = TILE_ICONS[id] ?? ''; return box; }; // trusted: our own SVG strings
|
|
1571
1609
|
const known = (id) => Object.hasOwn(HOME_TILES, id) || Object.hasOwn(WIDGETS, id);
|
|
@@ -1976,6 +2014,10 @@ function meter(value, tone = null) {
|
|
|
1976
2014
|
const toneFor = (share) => (share >= 0.85 ? 'hot' : share >= 0.6 ? 'warm' : null);
|
|
1977
2015
|
const OS_WORDS = { darwin: 'macOS', linux: 'Linux', win32: 'Windows', other: () => t('other') };
|
|
1978
2016
|
const osWord = (name) => { const word = OS_WORDS[name] ?? name; return typeof word === 'function' ? word() : word; };
|
|
2017
|
+
// What is being written in the notices' widget, kept across its re-readings (it reads every minute).
|
|
2018
|
+
const freshNoticeDraft = () => ({ level: 'info', titleEs: '', titleEn: '', bodyEs: '', bodyEn: '', link: '', min: '', max: '', os: [], days: 7 });
|
|
2019
|
+
const noticeDraft = freshNoticeDraft();
|
|
2020
|
+
const noticeFlash = { text: '' };
|
|
1979
2021
|
const WIDGET_PAINT = {
|
|
1980
2022
|
// The agenda: what is late and what is today first, then tomorrow, this week and later; a line per
|
|
1981
2023
|
// reminder with its project and its keys; and a box for a new one, in the person's own words.
|
|
@@ -2130,7 +2172,7 @@ const WIDGET_PAINT = {
|
|
|
2130
2172
|
const SYSTEMS = { darwin: 'macOS', linux: 'Linux', win32: 'Windows', wsl: 'WSL', other: t('other') };
|
|
2131
2173
|
const CHANNELS = { npx: 'npx', global: t('installed (npm -g)'), project: t('inside a project'), source: t('from source') };
|
|
2132
2174
|
const LANGS = { es: t('Spanish'), en: t('English') };
|
|
2133
|
-
const AGENT_NAMES = { claude: 'Claude', codex: 'Codex', gemini: 'Gemini', opencode: 'OpenCode', cursor: 'Cursor' };
|
|
2175
|
+
const AGENT_NAMES = { claude: 'Claude', codex: 'Codex', gemini: 'Gemini', opencode: 'OpenCode', cursor: 'Cursor', grok: 'Grok' };
|
|
2134
2176
|
const said = (list, words = {}) => (list ?? []).filter((one) => one.name !== '?').slice(0, 5).map((one) => `${words[one.name] ?? one.name} ${share(one.n)}`).join(' · ') || '—';
|
|
2135
2177
|
const lines = el('div', 'sm-usage-lines sm-env-lines');
|
|
2136
2178
|
for (const [label, text] of [
|
|
@@ -2170,6 +2212,92 @@ const WIDGET_PAINT = {
|
|
|
2170
2212
|
// habit with its leak marked, what the numbers decide, every variable with how sure it is, the
|
|
2171
2213
|
// weeks, and the project's record on GitHub and npm. Read again every 20 s; each source keeps its
|
|
2172
2214
|
// own clock on the server.
|
|
2215
|
+
// The author's notices (Q-11): write one for every copy, see how it will read, send it, and take
|
|
2216
|
+
// back one that is out. Only in the author's copy run from source (src/server.mjs, ownerCanNotify).
|
|
2217
|
+
notices(body, reading, { again } = {}) {
|
|
2218
|
+
const d = noticeDraft;
|
|
2219
|
+
const LEVEL_NAMES = { info: () => t('Information'), important: () => t('Important'), security: () => t('Security') };
|
|
2220
|
+
const form = el('form', 'sm-notice-form');
|
|
2221
|
+
const field = (label, node) => { const row = el('label', 'sm-notice-field'); if (!node.matches('div')) node.setAttribute('aria-label', label); row.append(el('small', null, label), node); return row; };
|
|
2222
|
+
const input = (key, max, placeholder = '') => { const node = el('input'); node.type = 'text'; node.maxLength = max; node.value = d[key] ?? ''; node.placeholder = placeholder; node.addEventListener('input', () => { d[key] = node.value; preview(); }); return node; };
|
|
2223
|
+
const area = (key, max) => { const node = el('textarea'); node.maxLength = max; node.rows = 3; node.value = d[key] ?? ''; node.addEventListener('input', () => { d[key] = node.value; preview(); }); return node; };
|
|
2224
|
+
const level = el('select');
|
|
2225
|
+
for (const one of ['info', 'important', 'security']) { const option = el('option', null, LEVEL_NAMES[one]()); option.value = one; option.selected = d.level === one; level.append(option); }
|
|
2226
|
+
level.addEventListener('change', () => { d.level = level.value; preview(); });
|
|
2227
|
+
const days = el('select');
|
|
2228
|
+
for (const n of [1, 3, 7, 14, 30]) { const option = el('option', null, n === 1 ? t('1 day') : t('{n} days', { n })); option.value = String(n); option.selected = d.days === n; days.append(option); }
|
|
2229
|
+
days.addEventListener('change', () => { d.days = Number(days.value); });
|
|
2230
|
+
const systems = el('div', 'sm-notice-systems');
|
|
2231
|
+
for (const [id, name] of [['darwin', 'macOS'], ['linux', 'Linux'], ['win32', 'Windows'], ['wsl', 'WSL']]) {
|
|
2232
|
+
const box = el('input'); box.type = 'checkbox'; box.checked = d.os.includes(id);
|
|
2233
|
+
box.addEventListener('change', () => { d.os = box.checked ? [...new Set([...d.os, id])] : d.os.filter((one) => one !== id); });
|
|
2234
|
+
const label = el('label'); label.append(box, ` ${name}`); systems.append(label);
|
|
2235
|
+
}
|
|
2236
|
+
form.append(
|
|
2237
|
+
field(t('Level'), level),
|
|
2238
|
+
field(t('Title · Spanish'), input('titleEs', 80)), field(t('Title · English'), input('titleEn', 80)),
|
|
2239
|
+
field(t('Text · Spanish'), area('bodyEs', 400)), field(t('Text · English'), area('bodyEn', 400)),
|
|
2240
|
+
field(t('Link (madre.run only, optional)'), input('link', 200, 'https://madre.run/…')),
|
|
2241
|
+
field(t('From version (optional)'), input('min', 12, '1.1.3')), field(t('Up to version (optional)'), input('max', 12)),
|
|
2242
|
+
field(t('Systems (none: all)'), systems), field(t('Shows for'), days),
|
|
2243
|
+
);
|
|
2244
|
+
// How it will read, in both languages, in the same card every copy draws (public/notices.js).
|
|
2245
|
+
const look = el('div', 'sm-notice-preview');
|
|
2246
|
+
function preview() {
|
|
2247
|
+
look.replaceChildren();
|
|
2248
|
+
for (const [lang, title, words] of [['es', d.titleEs, d.bodyEs], ['en', d.titleEn, d.bodyEn]]) {
|
|
2249
|
+
const card = el('section', `madre-notice is-${d.level}`);
|
|
2250
|
+
const box = el('div', 'madre-notice-words');
|
|
2251
|
+
box.append(el('small', 'madre-notice-kind', `${lang.toUpperCase()} · ${LEVEL_NAMES[d.level]()}`), el('b', 'madre-notice-title', title || '—'), el('p', 'madre-notice-body', words || '—'));
|
|
2252
|
+
card.append(box);
|
|
2253
|
+
look.append(card);
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
preview();
|
|
2257
|
+
// Said once, after the widget reads again with what was just sent.
|
|
2258
|
+
const said = el('small', 'sm-notice-said', noticeFlash.text);
|
|
2259
|
+
noticeFlash.text = '';
|
|
2260
|
+
let armed = false;
|
|
2261
|
+
const send = button('sm-btn primary small', t('Send to every copy'), async (event) => {
|
|
2262
|
+
event.preventDefault();
|
|
2263
|
+
if (!armed) { armed = true; send.textContent = t('Sure? It reaches every copy · Send'); setTimeout(() => { armed = false; send.textContent = t('Send to every copy'); }, 5000); return; }
|
|
2264
|
+
send.disabled = true;
|
|
2265
|
+
const now = new Date();
|
|
2266
|
+
const stamp = now.toISOString().slice(0, 10).replaceAll('-', '');
|
|
2267
|
+
const slug = String(d.titleEs || d.titleEn).normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 30) || 'aviso';
|
|
2268
|
+
const notice = {
|
|
2269
|
+
id: `${stamp}-${slug}`.slice(0, 40).replace(/-+$/, ''), level: d.level,
|
|
2270
|
+
title: { es: d.titleEs.trim(), en: d.titleEn.trim() }, body: { es: d.bodyEs.trim(), en: d.bodyEn.trim() },
|
|
2271
|
+
link: d.link.trim() || null, to: { min: d.min.trim() || null, max: d.max.trim() || null, os: d.os },
|
|
2272
|
+
from: now.toISOString(), until: new Date(now.getTime() + d.days * 86_400_000).toISOString(),
|
|
2273
|
+
};
|
|
2274
|
+
const answer = await fetch('/api/owner/notices', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ notice }) }).then(async (response) => ({ ok: response.ok, body: await response.json().catch(() => ({})) })).catch(() => ({ ok: false, body: {} }));
|
|
2275
|
+
if (answer.ok) { Object.assign(noticeDraft, freshNoticeDraft()); noticeFlash.text = t('Sent: every copy shows it within 15 minutes.'); again?.(); }
|
|
2276
|
+
else { said.textContent = answer.body.error ?? t('It was not sent.'); send.disabled = false; }
|
|
2277
|
+
});
|
|
2278
|
+
form.append(look, send, said);
|
|
2279
|
+
// What is out now, with its way back.
|
|
2280
|
+
const out = el('div', 'sm-notice-list');
|
|
2281
|
+
const list = reading.notices ?? [];
|
|
2282
|
+
if (!reading.read) out.append(el('p', 'sm-hint', t('madre.run could not be read just now.')));
|
|
2283
|
+
else if (!list.length) out.append(el('p', 'sm-hint', t('No notice is out.')));
|
|
2284
|
+
for (const one of list) {
|
|
2285
|
+
const row = el('div', `sm-notice-row is-${one.level}`);
|
|
2286
|
+
const when = one.when === 'later' ? t('from {date}', { date: new Date(one.from).toLocaleString() }) : one.when === 'over' ? t('ended') : t('until {date}', { date: new Date(one.until).toLocaleString() });
|
|
2287
|
+
row.append(el('b', null, one.title?.[language] ?? one.title?.es ?? one.id), el('small', null, `${LEVEL_NAMES[one.level]()} · ${when}`));
|
|
2288
|
+
let sure = false;
|
|
2289
|
+
const back = button('sm-btn small', t('Take back'), async () => {
|
|
2290
|
+
if (!sure) { sure = true; back.textContent = t('Sure? Take back'); setTimeout(() => { sure = false; back.textContent = t('Take back'); }, 5000); return; }
|
|
2291
|
+
back.disabled = true;
|
|
2292
|
+
const ok = await fetch('/api/owner/notices/retire', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id: one.id }) }).then((response) => response.ok).catch(() => false);
|
|
2293
|
+
if (ok) again?.(); else { back.disabled = false; back.textContent = t('Take back'); }
|
|
2294
|
+
});
|
|
2295
|
+
row.append(back);
|
|
2296
|
+
out.append(row);
|
|
2297
|
+
}
|
|
2298
|
+
if (reading.unverified) out.append(el('p', 'sm-hint', t('{n} served by madre.run do not carry your signature: no copy shows them.', { n: reading.unverified })));
|
|
2299
|
+
body.append(out, form);
|
|
2300
|
+
},
|
|
2173
2301
|
rumbo(body, reading) {
|
|
2174
2302
|
if (!reading.available) { body.append(el('p', 'sm-hint', reading.status ? t('madre.run answered {status}.', { status: reading.status }) : t('madre.run could not be reached.'))); return; }
|
|
2175
2303
|
const n = (value) => (value === null || value === undefined ? '—' : Number(value).toLocaleString());
|
|
@@ -2503,6 +2631,119 @@ const WIDGET_PAINT = {
|
|
|
2503
2631
|
// What fails in every copy, the widest first (2026-10-28). Each with what it is (its MU code when
|
|
2504
2632
|
// Diagnostics knows it), how many copies and times, which versions and systems, MADRE's own lines
|
|
2505
2633
|
// it went through, and the author's word on it.
|
|
2634
|
+
// madre-logs (2026-11-05): what is to fix, grouped by level (P0 and P1 first), each error in a row
|
|
2635
|
+
// of its own: id and level on the left, what happens and its state, then its class, type and
|
|
2636
|
+
// origin as tags. Then what waits to be verified, folded, and what the agents saved last.
|
|
2637
|
+
madrelogs(body, reading) {
|
|
2638
|
+
const { counts } = reading;
|
|
2639
|
+
const lead = el('div', 'sm-logs-lead');
|
|
2640
|
+
const figure = (n, words, tone) => { const one = el('div', `sm-logs-fig${tone ? ` ${tone}` : ''}`); one.append(el('b', null, String(n)), el('span', null, words)); return one; };
|
|
2641
|
+
lead.append(figure(counts.toFix, t('to fix'), counts.toFix ? 'is-due' : ''), figure(counts.inProgress, t('in progress'), counts.inProgress ? 'is-busy' : ''), figure(counts.toVerify, t('to verify')), figure(counts.verified, t('verified')));
|
|
2642
|
+
body.append(lead);
|
|
2643
|
+
const tags = (label, list) => {
|
|
2644
|
+
const row = el('div', 'sm-logs-tally');
|
|
2645
|
+
row.append(el('span', 'sm-logs-tally-label', label));
|
|
2646
|
+
const box = el('div', 'sm-logs-chips');
|
|
2647
|
+
for (const one of list) box.append(el('span', 'sm-logs-chip', `${one.name} ${one.n}`));
|
|
2648
|
+
row.append(box);
|
|
2649
|
+
return row;
|
|
2650
|
+
};
|
|
2651
|
+
// Who is working now (madre-logs' EN-CURSO.md): Claude, Codex and Antigravity each with its badge.
|
|
2652
|
+
const AGENTS = { claude: 'Claude', codex: 'Codex', antigravity: 'Antigravity' };
|
|
2653
|
+
// Whoever the row names, in its own words when they say more than the agent's name: the author
|
|
2654
|
+
// works with two Claude accounts (2026-11-08) and «claude-personal» is which one.
|
|
2655
|
+
const badge = (agent, who) => {
|
|
2656
|
+
const said = String(who ?? '').split('·')[0].trim();
|
|
2657
|
+
const known = AGENTS[agent] ?? null;
|
|
2658
|
+
return el('span', `sm-logs-agent ag-${agent ?? 'other'}`, said && said.toLowerCase() !== (known ?? '').toLowerCase() ? said : known ?? said);
|
|
2659
|
+
};
|
|
2660
|
+
const loose = reading.unregistered ?? [];
|
|
2661
|
+
if (reading.working?.length || loose.length) {
|
|
2662
|
+
const now = el('section', 'sm-logs-group sm-logs-working');
|
|
2663
|
+
const head = el('header', 'sm-logs-group-head');
|
|
2664
|
+
head.append(el('span', null, t('Working now')), el('small', null, String((reading.working?.length ?? 0) + loose.length)));
|
|
2665
|
+
now.append(head);
|
|
2666
|
+
// At work in the last minutes without its row in EN-CURSO.md: what it works on cannot be said.
|
|
2667
|
+
// One that took its row out a few minutes ago finished: its session may still be writing.
|
|
2668
|
+
for (const one of loose) {
|
|
2669
|
+
const row = el('div', `sm-logs-work ${one.finished ? 'is-done' : 'is-loose'}`);
|
|
2670
|
+
const top = el('div', 'sm-logs-top');
|
|
2671
|
+
top.append(badge(one.agent), el('b', 'sm-logs-title', one.finished ? t('Finished its work') : t('Working without registering in EN-CURSO.md')), el('small', 'sm-logs-when', ago(one.finished ?? one.at)));
|
|
2672
|
+
row.append(top, el('small', 'sm-logs-zone', one.finished ? t('It took its row out of EN-CURSO.md; it may still be saving or answering.') : t('Nobody can tell which error it has. Ask it to follow rule 12 of ~/madre-logs/AGENTS.md.')));
|
|
2673
|
+
now.append(row);
|
|
2674
|
+
}
|
|
2675
|
+
for (const work of reading.working ?? []) {
|
|
2676
|
+
const row = el('div', 'sm-logs-work');
|
|
2677
|
+
const top = el('div', 'sm-logs-top');
|
|
2678
|
+
top.append(badge(work.agent, work.who), el('b', 'sm-logs-title', work.what));
|
|
2679
|
+
row.append(top);
|
|
2680
|
+
if (work.zone) row.append(el('small', 'sm-logs-zone', work.zone));
|
|
2681
|
+
now.append(row);
|
|
2682
|
+
}
|
|
2683
|
+
body.append(now);
|
|
2684
|
+
}
|
|
2685
|
+
if (reading.byClase.length) body.append(tags(t('Class'), reading.byClase), tags(t('Type'), reading.byTipo));
|
|
2686
|
+
const STATE = { 'en-curso': t('in progress'), abierto: t('open'), investigando: t('investigating'), decision: t('your decision'), arreglado: t('fixed'), publicado: t('published'), verificado: t('verified') };
|
|
2687
|
+
const GROUPS = [
|
|
2688
|
+
[t('Urgent · P0 and P1'), (one) => one.nivel === 'P0' || one.nivel === 'P1', 'lv-urgent'],
|
|
2689
|
+
[t('Minor · P2'), (one) => one.nivel === 'P2', 'lv-minor'],
|
|
2690
|
+
[t('To investigate'), (one) => one.nivel === 'Investigar', 'lv-look'],
|
|
2691
|
+
[t('To watch'), (one) => one.nivel === 'Vigilar', 'lv-watch'],
|
|
2692
|
+
[t('Your decision'), (one) => one.nivel === 'Decisión', 'lv-decide'],
|
|
2693
|
+
// Planned work, not a failure (madre-logs, 2026-11-08): a lot of a plan the author already
|
|
2694
|
+
// asked for. Last, and it never looks urgent.
|
|
2695
|
+
[t('Planned work'), (one) => one.nivel === 'Obra', 'lv-work'],
|
|
2696
|
+
];
|
|
2697
|
+
const card = (one, tone) => {
|
|
2698
|
+
const row = el('article', `sm-logs-item ${tone} is-${one.estado}`);
|
|
2699
|
+
const side = el('div', 'sm-logs-side');
|
|
2700
|
+
side.append(el('code', 'sm-logs-id', one.id), el('span', 'sm-logs-level', one.nivel === 'Investigar' ? t('Investigate') : one.nivel === 'Vigilar' ? t('Watch') : one.nivel === 'Decisión' ? t('Decide') : one.nivel === 'Obra' ? t('Build') : one.nivel));
|
|
2701
|
+
const main = el('div', 'sm-logs-main');
|
|
2702
|
+
const top = el('div', 'sm-logs-top');
|
|
2703
|
+
top.append(el('b', 'sm-logs-title', one.title));
|
|
2704
|
+
if (one.estado === 'en-curso' && (one.agent || one.responsable)) top.append(badge(one.agent, one.responsable));
|
|
2705
|
+
top.append(el('span', 'sm-logs-state', STATE[one.estado] ?? one.estado));
|
|
2706
|
+
const meta = el('div', 'sm-logs-meta');
|
|
2707
|
+
for (const word of [one.clase, one.tipo, one.origen].filter(Boolean)) meta.append(el('span', null, word));
|
|
2708
|
+
if (one.commit) meta.append(el('code', null, one.commit));
|
|
2709
|
+
main.append(top, meta);
|
|
2710
|
+
row.append(side, main);
|
|
2711
|
+
return row;
|
|
2712
|
+
};
|
|
2713
|
+
const left = [...reading.toFix];
|
|
2714
|
+
for (const [title, fits, tone] of GROUPS) {
|
|
2715
|
+
const these = left.filter(fits);
|
|
2716
|
+
if (!these.length) continue;
|
|
2717
|
+
const group = el('section', `sm-logs-group ${tone}`);
|
|
2718
|
+
const head = el('header', 'sm-logs-group-head');
|
|
2719
|
+
head.append(el('span', null, title), el('small', null, String(these.length)));
|
|
2720
|
+
group.append(head);
|
|
2721
|
+
for (const one of these) group.append(card(one, tone));
|
|
2722
|
+
body.append(group);
|
|
2723
|
+
}
|
|
2724
|
+
if (reading.toVerify.length) {
|
|
2725
|
+
const wait = el('details', 'sm-logs-group sm-logs-wait');
|
|
2726
|
+
const head = el('summary', 'sm-logs-group-head');
|
|
2727
|
+
head.append(el('span', null, t('Fixed, to verify')), el('small', null, String(reading.toVerify.length)));
|
|
2728
|
+
wait.append(head);
|
|
2729
|
+
for (const one of reading.toVerify) wait.append(card(one, 'lv-done'));
|
|
2730
|
+
body.append(wait);
|
|
2731
|
+
}
|
|
2732
|
+
if (reading.log.length) {
|
|
2733
|
+
const moves = el('section', 'sm-logs-group sm-logs-moves');
|
|
2734
|
+
const head = el('header', 'sm-logs-group-head');
|
|
2735
|
+
head.append(el('span', null, t('Last changes')));
|
|
2736
|
+
moves.append(head);
|
|
2737
|
+
for (const one of reading.log.slice(0, 5)) {
|
|
2738
|
+
const row = el('div', 'sm-logs-move');
|
|
2739
|
+
row.append(el('span', null, one.said), el('small', null, ago(one.at)));
|
|
2740
|
+
row.title = `${one.hash} · ${one.said}`;
|
|
2741
|
+
moves.append(row);
|
|
2742
|
+
}
|
|
2743
|
+
body.append(moves);
|
|
2744
|
+
}
|
|
2745
|
+
body.append(el('small', 'sm-w-foot', t('From ~/madre-logs · INDICE.md has the whole table')));
|
|
2746
|
+
},
|
|
2506
2747
|
errors(body, reading, { again } = {}) {
|
|
2507
2748
|
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; }
|
|
2508
2749
|
const open = reading.errors.filter((one) => one.status !== 'ignored' && one.status !== 'fixed');
|
|
@@ -2649,7 +2890,7 @@ function makeWidget(id) {
|
|
|
2649
2890
|
// The first time it shows, what it is (homeTour is set up below this, so it is read late).
|
|
2650
2891
|
if (!node.dataset.guided) { node.dataset.guided = '1'; setTimeout(() => { try { guideWidget(node, spec.kind); } catch { /* the tour is not up yet */ } }, 1500); }
|
|
2651
2892
|
};
|
|
2652
|
-
node.start = () => { if (timer) return; void read(); timer = setInterval(() => void read(), 20000); };
|
|
2893
|
+
node.start = () => { if (timer) return; void read(); timer = setInterval(() => void read(), spec.every ?? 20000); };
|
|
2653
2894
|
node.stop = () => { clearInterval(timer); timer = 0; };
|
|
2654
2895
|
// Said again in the language Home settled on: a widget is made once, before the first answer
|
|
2655
2896
|
// tells Home which language MADRE speaks (a new MADRE starts in Spanish and may adopt English),
|
|
@@ -2711,6 +2952,31 @@ homeTour.firstOpen('home-settings', ui.gear, {
|
|
|
2711
2952
|
title: () => t('Home settings'),
|
|
2712
2953
|
text: () => t('How Home looks and what its bar holds, your agents, the Coordinator, which projects use the local AI, your projects and the version. ⌘ , opens it from anywhere.'),
|
|
2713
2954
|
});
|
|
2955
|
+
// The other main keys of Home (1.1, 2026-11-08): what each one is, said once, the first time it is pressed.
|
|
2956
|
+
homeTour.firstOpen('home-activity', $('sm-tb-activity'), {
|
|
2957
|
+
opened: () => document.querySelector('.activity-panel:not([hidden])'),
|
|
2958
|
+
title: () => t('Running now'),
|
|
2959
|
+
text: () => t('Everything MADRE is doing right now in your open projects: an AI answering, a command being run, something installing. If something takes too long, you stop it from here.'),
|
|
2960
|
+
});
|
|
2961
|
+
homeTour.firstOpen('home-market', $('sm-tb-market'), {
|
|
2962
|
+
opened: () => document.querySelector('.mk[role="dialog"]'),
|
|
2963
|
+
title: () => t('Market'),
|
|
2964
|
+
text: () => t('Extra features for MADRE, made by its author and by the community: images, reminders, GitHub and more. Each one tells you what it does and what it touches before you install it.'),
|
|
2965
|
+
after: 700,
|
|
2966
|
+
});
|
|
2967
|
+
homeTour.firstOpen('home-modules', $('sm-tb-modules'), {
|
|
2968
|
+
opened: () => document.querySelector('.mk[role="dialog"]'),
|
|
2969
|
+
title: () => t('Modules'),
|
|
2970
|
+
text: () => t('The modules you already have, and in which projects each one is on. Switch one on only where you need it.'),
|
|
2971
|
+
after: 700,
|
|
2972
|
+
});
|
|
2973
|
+
homeTour.firstOpen('home-agents', ui.bar.agents, {
|
|
2974
|
+
// Beside the list of agents it opened, under its title: Settings here is a window, not a modal sheet.
|
|
2975
|
+
opened: () => topSheet()?.querySelector('.settings-detail .settings-detail-head, .settings-detail') ?? topSheet(),
|
|
2976
|
+
inside: (box) => box.closest('.sm-settings-window') ?? box,
|
|
2977
|
+
title: () => t('Your AIs'),
|
|
2978
|
+
text: () => t('Each circle is one of your AIs, with a light that says whether it is ready. One that looks switched off still needs you to sign in: press it and MADRE takes you there.'),
|
|
2979
|
+
});
|
|
2714
2980
|
// What each widget shows, the first time it is on Home: its own line, and how to change it.
|
|
2715
2981
|
const WIDGET_GUIDE = {
|
|
2716
2982
|
system: () => t('How busy this Mac\'s processor is and how much memory is free. It updates on its own.'),
|
|
@@ -3304,18 +3570,29 @@ async function homeNews(tries = 0) {
|
|
|
3304
3570
|
const dialog = el('dialog', 'whats-new home-news');
|
|
3305
3571
|
dialog.setAttribute('aria-label', t("What's new in MADRE {version}", { version: news.version }));
|
|
3306
3572
|
const sheet = el('div', 'wn-sheet');
|
|
3573
|
+
// The sheet takes the focus, not «Start»: a key already marked looked chosen for you (2026-11-08).
|
|
3574
|
+
// Tab reaches each thing from here.
|
|
3575
|
+
sheet.tabIndex = -1;
|
|
3307
3576
|
const head = el('header', 'wn-head');
|
|
3308
3577
|
const words = el('div', 'wn-headline');
|
|
3309
3578
|
const logo = document.querySelector('.side-brand .brand-logo, #sm-back .brand-logo')?.cloneNode?.(true);
|
|
3310
3579
|
if (logo) { logo.setAttribute('class', 'brand-logo wn-logo'); words.append(logo); }
|
|
3311
|
-
words
|
|
3580
|
+
// Its own words when the version has them (1.1.3: «Good to see you again»), with no label above.
|
|
3581
|
+
words.append(el('h2', null, pick(notes.title) ?? t('You now have {version}', { version: String(news.version).replace(/\.0$/, '') })));
|
|
3312
3582
|
if (notes.intro) words.append(el('p', 'wn-intro', pick(notes.intro)));
|
|
3313
3583
|
head.append(words, closeKey(() => dialog.close()));
|
|
3314
3584
|
const grid = el('div', 'wn-board');
|
|
3585
|
+
const scenes = [];
|
|
3315
3586
|
for (const item of notes.items ?? []) {
|
|
3316
3587
|
const card = el('div', 'wn-card');
|
|
3317
3588
|
const shot = el('span', 'wn-shot wn-card-shot');
|
|
3318
|
-
|
|
3589
|
+
// A moving picture of what it is (1.1.3, public/news-scenes.js) in place of a screenshot.
|
|
3590
|
+
if (item.scene) {
|
|
3591
|
+
const scene = createNewsScene(item.scene);
|
|
3592
|
+
scenes.push(scene);
|
|
3593
|
+
shot.classList.add('scene');
|
|
3594
|
+
shot.append(scene.node);
|
|
3595
|
+
} else if (item.image) {
|
|
3319
3596
|
const image = el('img');
|
|
3320
3597
|
image.alt = pick(item.title) ?? '';
|
|
3321
3598
|
image.loading = 'lazy';
|
|
@@ -3341,14 +3618,14 @@ async function homeNews(tries = 0) {
|
|
|
3341
3618
|
foot.append(start);
|
|
3342
3619
|
sheet.append(head, body, foot);
|
|
3343
3620
|
dialog.append(sheet);
|
|
3344
|
-
dialog.addEventListener('close', () => dialog.remove());
|
|
3621
|
+
dialog.addEventListener('close', () => { for (const scene of scenes) scene.stop(); dialog.remove(); });
|
|
3345
3622
|
document.body.append(dialog);
|
|
3346
3623
|
dialog.showModal();
|
|
3347
3624
|
// Whoever comes from an older MADRE meets MADRE's opening first (2026-10-30), as a new person does in
|
|
3348
3625
|
// the welcome (loader.js, playOpening), and the board comes after it — unless this page just played it
|
|
3349
3626
|
// (public/terms.js, after the new license was accepted).
|
|
3350
|
-
if (openingPlayed())
|
|
3351
|
-
else void playOpening(dialog, { skipLabel: t('Skip') }).then(() =>
|
|
3627
|
+
if (openingPlayed()) sheet.focus({ preventScroll: true });
|
|
3628
|
+
else void playOpening(dialog, { skipLabel: t('Skip') }).then(() => sheet.focus({ preventScroll: true }));
|
|
3352
3629
|
// Seen once shown, as in a project: a board left open and the page closed is not owed again.
|
|
3353
3630
|
void fetch('/api/whats-new/seen', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' }).catch(() => null);
|
|
3354
3631
|
}
|
|
@@ -3413,7 +3690,7 @@ async function adoptLanguage(code) {
|
|
|
3413
3690
|
sayIn(code);
|
|
3414
3691
|
}
|
|
3415
3692
|
|
|
3416
|
-
async function startRoom(room, { enter = false } = {}) {
|
|
3693
|
+
async function startRoom(room, { enter = false, draft = null } = {}) {
|
|
3417
3694
|
busy.set(room.id, 'starting');
|
|
3418
3695
|
failed.delete(room.id);
|
|
3419
3696
|
draw();
|
|
@@ -3423,7 +3700,9 @@ async function startRoom(room, { enter = false } = {}) {
|
|
|
3423
3700
|
busy.delete(room.id);
|
|
3424
3701
|
if (!answer.ok) failed.set(room.id, answer.body.error ?? t('The project did not open.'));
|
|
3425
3702
|
// Opened from its card, the person goes in: that is what «Open» means.
|
|
3426
|
-
|
|
3703
|
+
// From the welcome, with the first message already written: the project's page finds it in its address
|
|
3704
|
+
// (#escribe=, app.js) and leaves it in the box, for the person to send.
|
|
3705
|
+
else if (enter && answer.body.port) { leaveTo(`http://127.0.0.1:${answer.body.port}/${draft ? `#escribe=${encodeURIComponent(draft)}` : ''}`); return answer; }
|
|
3427
3706
|
await refresh();
|
|
3428
3707
|
return answer;
|
|
3429
3708
|
}
|
|
@@ -4310,6 +4589,39 @@ function toast(words, tone = 'done', action = null) {
|
|
|
4310
4589
|
const post = (url, payload) => fetch(url, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(payload ?? {}) })
|
|
4311
4590
|
.then(async (response) => ({ ok: response.ok, status: response.status, body: await response.json().catch(() => ({})) }))
|
|
4312
4591
|
.catch(() => ({ ok: false, status: 0, body: {} }));
|
|
4592
|
+
// Home's Settings sheet is as wide as you pull it, as a project's is (app.js, gripSettingsSheet;
|
|
4593
|
+
// 2026-11-07): a grip on its edge, the width kept apart from the projects', twice on it to reset.
|
|
4594
|
+
function gripHomeSettings(sheet) {
|
|
4595
|
+
let kept = null;
|
|
4596
|
+
try { kept = Number(localStorage.getItem('pulse.homeSettingsSheet')) || null; } catch { /* no storage */ }
|
|
4597
|
+
if (kept) sheet.style.setProperty('--sheet-w', `${kept}px`);
|
|
4598
|
+
const grip = el('div', 'settings-grip');
|
|
4599
|
+
grip.setAttribute('aria-hidden', 'true');
|
|
4600
|
+
grip.addEventListener('pointerdown', (event) => {
|
|
4601
|
+
event.preventDefault();
|
|
4602
|
+
const startX = event.clientX;
|
|
4603
|
+
const startWidth = sheet.getBoundingClientRect().width;
|
|
4604
|
+
const room = sheet.parentElement?.getBoundingClientRect().width ?? 980;
|
|
4605
|
+
try { grip.setPointerCapture(event.pointerId); } catch { /* a pointer the page no longer holds */ }
|
|
4606
|
+
sheet.classList.add('dragging');
|
|
4607
|
+
const move = (moving) => {
|
|
4608
|
+
const width = Math.round(Math.max(360, Math.min(room - 120, startWidth + startX - moving.clientX)));
|
|
4609
|
+
sheet.style.setProperty('--sheet-w', `${width}px`);
|
|
4610
|
+
};
|
|
4611
|
+
const done = () => {
|
|
4612
|
+
grip.removeEventListener('pointermove', move);
|
|
4613
|
+
sheet.classList.remove('dragging');
|
|
4614
|
+
try { localStorage.setItem('pulse.homeSettingsSheet', String(Math.round(sheet.getBoundingClientRect().width))); } catch { /* no storage */ }
|
|
4615
|
+
};
|
|
4616
|
+
grip.addEventListener('pointermove', move);
|
|
4617
|
+
grip.addEventListener('pointerup', done, { once: true });
|
|
4618
|
+
grip.addEventListener('pointercancel', done, { once: true });
|
|
4619
|
+
});
|
|
4620
|
+
// Twice on the grip goes back to the width it opens with.
|
|
4621
|
+
grip.addEventListener('dblclick', () => { sheet.style.removeProperty('--sheet-w'); try { localStorage.removeItem('pulse.homeSettingsSheet'); } catch { /* no storage */ } });
|
|
4622
|
+
sheet.prepend(grip);
|
|
4623
|
+
}
|
|
4624
|
+
|
|
4313
4625
|
function mark(id, size = 40) {
|
|
4314
4626
|
const brand = brandOf(id);
|
|
4315
4627
|
const node = el('span', 'sm-mark');
|
|
@@ -4727,7 +5039,7 @@ void loadMarket({ toast: (words, action) => toast(words, action ? 'news' : 'done
|
|
|
4727
5039
|
// `compact` is the welcome's first step: there, a connected agent is done, and a button to change
|
|
4728
5040
|
// the account it signs in with is a question nobody asked on their first minute.
|
|
4729
5041
|
// Who makes each agent, said under its name as the project's AJUSTES says it.
|
|
4730
|
-
const VENDOR_WORDS = { codex: 'OpenAI', claude: 'Anthropic', gemini: 'Google', opencode: 'OpenCode', cursor: 'Cursor' };
|
|
5042
|
+
const VENDOR_WORDS = { codex: 'OpenAI', claude: 'Anthropic', gemini: 'Google', opencode: 'OpenCode', cursor: 'Cursor', grok: 'xAI' };
|
|
4731
5043
|
|
|
4732
5044
|
// OpenCode's providers in Home, the same block as the project's AJUSTES › Agents › OpenCode: a line
|
|
4733
5045
|
// per provider with a key or an account and its switch for the chat, one row to add another, and
|
|
@@ -4844,6 +5156,10 @@ const TROUBLE_WORDS = {
|
|
|
4844
5156
|
disk: () => t('There is not enough free space on this computer to install it.'),
|
|
4845
5157
|
'npm-missing': () => t('Installing it needs Node and npm, and this computer does not have them. Install Node from nodejs.org, then try again.'),
|
|
4846
5158
|
'zstd-missing': () => t('Installing it needs zstd, which this Linux does not have. In a terminal: sudo apt install -y zstd, then try again.'),
|
|
5159
|
+
dns: () => t('This computer could not find the address it downloads from (DNS). In WSL, close it from Windows and open it again; with a VPN on, try without it.'),
|
|
5160
|
+
'ollama-closed': () => t('Ollama closed the connection while downloading the model. Check that Ollama is still running and try again; what already arrived stays.'),
|
|
5161
|
+
// D-29: the registry's own error, not the person's connection, and not MADRE stopping it.
|
|
5162
|
+
registry: () => t('Ollama\'s model server did not answer (an error on its side). It is not your connection: try again in a few minutes; what already arrived stays.'),
|
|
4847
5163
|
timeout: () => t('It took too long and was stopped. Try again.'),
|
|
4848
5164
|
unknown: () => t('It did not install.'),
|
|
4849
5165
|
},
|
|
@@ -4857,7 +5173,7 @@ const TROUBLE_WORDS = {
|
|
|
4857
5173
|
};
|
|
4858
5174
|
// The card of Diagnostics for each of those (public/troubleshooting.js), opened beside the failure.
|
|
4859
5175
|
const TROUBLE_CARDS = {
|
|
4860
|
-
install: { network: 'install-offline', timeout: 'install-offline', permission: 'install-needs-admin', disk: 'disk-full', 'npm-missing': 'node-missing' },
|
|
5176
|
+
install: { network: 'install-offline', dns: 'name-lookup', timeout: 'install-offline', permission: 'install-needs-admin', disk: 'disk-full', 'npm-missing': 'node-missing', 'ollama-closed': 'model-download', registry: 'model-download' },
|
|
4861
5177
|
login: { network: 'install-offline', timeout: 'sign-in-unfinished', cancelled: 'sign-in-unfinished', unknown: 'sign-in-unfinished' },
|
|
4862
5178
|
};
|
|
4863
5179
|
const troubleCard = (agent, kind, cause) => (kind === 'login' && cause === 'refused-account' ? (agent === 'gemini' ? 'gemini-ineligible-tier' : 'not-signed-in') : TROUBLE_CARDS[kind]?.[cause] ?? null);
|
|
@@ -5014,6 +5330,8 @@ function agentsPanel({ onPaint = null, compact = false, explain = null } = {}) {
|
|
|
5014
5330
|
if (agent.detected && agent.version) facts.append(el('code', 'sm-agent-line', `${agent.version}${agent.path ? ` · ${agent.path}` : ''}`));
|
|
5015
5331
|
const said = agent.detected ? sessionDetail(answer.sessions?.[agent.id]) : null;
|
|
5016
5332
|
if (said) facts.append(el('small', 'sm-agent-line', said));
|
|
5333
|
+
// Through its API it only answers: said where its connection is, with the way to the rest.
|
|
5334
|
+
if (agent.viaApi) facts.append(el('small', 'sm-agent-note', t('Answers through Google\'s API with your key: it does not read your projects or write in them. Install the Gemini CLI for that.')));
|
|
5017
5335
|
// In the welcome, Gemini's account is already said above its card (welcome.js, explainAgent):
|
|
5018
5336
|
// said twice in two ways, it read as two different requirements (QA 1.1.0, NUE-04).
|
|
5019
5337
|
if (agent.account && !(compact && agent.id === 'gemini' && !state.ok)) facts.append(el('small', 'sm-agent-note', agent.account));
|
|
@@ -5052,7 +5370,7 @@ function agentsPanel({ onPaint = null, compact = false, explain = null } = {}) {
|
|
|
5052
5370
|
const choosing = choosingAccount.has(agent.id);
|
|
5053
5371
|
const doors = !state.ok ? (methods.length ? methods : [{ id: null, label: null, note: agent.login?.note }])
|
|
5054
5372
|
: methods.length > 1 && choosing ? methods
|
|
5055
|
-
: [{ id: methods.length === 1 ? methods[0].id : null, label: null, note: methods.length === 1 ? methods[0].note : agent.login?.note, choose: methods.length > 1 }];
|
|
5373
|
+
: [{ id: methods.length === 1 ? methods[0].id : null, label: methods.length === 1 ? methods[0].label : null, note: methods.length === 1 ? methods[0].note : agent.login?.note, choose: methods.length > 1 }];
|
|
5056
5374
|
return doors.map((door) => {
|
|
5057
5375
|
const name = door.label ? t(door.label) : state.ok ? t('Sign in again') : t('Sign in');
|
|
5058
5376
|
const key = button(`sm-btn ${(state.ok && !choosing) || agent.key?.first ? '' : 'primary'} small`, name, async (event) => {
|
|
@@ -5069,16 +5387,18 @@ function agentsPanel({ onPaint = null, compact = false, explain = null } = {}) {
|
|
|
5069
5387
|
});
|
|
5070
5388
|
};
|
|
5071
5389
|
// Gemini's key is its way in (agent.key.first): the field before the Google door.
|
|
5072
|
-
const keyFirst = Boolean(agent.detected && agent.key?.first);
|
|
5390
|
+
const keyFirst = Boolean((agent.detected || agent.id === 'gemini') && agent.key?.first);
|
|
5073
5391
|
if (keyFirst) body.append(keyForm(agent));
|
|
5074
5392
|
const acts = el('div', 'sm-agent-acts');
|
|
5075
5393
|
if (!state.busyNow) {
|
|
5076
|
-
|
|
5394
|
+
// Gemini answering through its API can still get its CLI, for what the API cannot do.
|
|
5395
|
+
const canInstall = !agent.detected || agent.viaApi;
|
|
5396
|
+
if (canInstall && installing.has(agent.id)) {
|
|
5077
5397
|
const wait = button('sm-btn primary small is-busy', t('Installing…'), () => {});
|
|
5078
5398
|
wait.disabled = true;
|
|
5079
5399
|
wait.setAttribute('aria-busy', 'true');
|
|
5080
5400
|
acts.append(wait);
|
|
5081
|
-
} else if (
|
|
5401
|
+
} else if (canInstall && agent.install?.command) acts.append(button(`sm-btn ${agent.viaApi ? '' : 'primary'} small`, wrongAt(agent.id, 'install') ? t('Try again') : agent.viaApi ? t('Install the Gemini CLI') : t('Install'), async (event) => {
|
|
5082
5402
|
event.currentTarget.disabled = true;
|
|
5083
5403
|
event.currentTarget.textContent = t('Installing…');
|
|
5084
5404
|
trouble.delete(agent.id);
|
|
@@ -5098,10 +5418,10 @@ function agentsPanel({ onPaint = null, compact = false, explain = null } = {}) {
|
|
|
5098
5418
|
const ask = askBlock(agent);
|
|
5099
5419
|
if (ask) body.append(ask);
|
|
5100
5420
|
// A key, pasted here; OpenCode's are its providers', in the block below.
|
|
5101
|
-
if (agent.detected && agent.key && agent.id !== 'opencode' && !keyFirst) body.append(keyForm(agent));
|
|
5421
|
+
if ((agent.detected || agent.id === 'gemini') && agent.key && agent.id !== 'opencode' && !keyFirst) body.append(keyForm(agent));
|
|
5102
5422
|
// The same install or sign-in typed in a terminal, folded for whoever prefers it. Signed in,
|
|
5103
5423
|
// OpenCode's providers are added in the block below; its terminal is for a first sign-in.
|
|
5104
|
-
const way = !agent.detected ? agent.install && [agent.install.display, ...(agent.install.alternatives ?? []).map((line) => `# ${t(line)}`)]
|
|
5424
|
+
const way = !agent.detected || agent.viaApi ? agent.install && [agent.install.display, ...(agent.install.alternatives ?? []).map((line) => `# ${t(line)}`)]
|
|
5105
5425
|
: agent.login?.terminal && !(agent.id === 'opencode' && state.ok) ? [agent.login.terminal.command, ...(agent.login.terminal.note ? [`# ${t(agent.login.terminal.note)}`] : [])] : null;
|
|
5106
5426
|
if (way && !state.busyNow) body.append(terminalWay(way, agent.id));
|
|
5107
5427
|
if (agent.id === 'opencode' && agent.detected) body.append(openCodeProviders.node());
|
|
@@ -5206,7 +5526,10 @@ const welcomeHost = {
|
|
|
5206
5526
|
closeKey: (onClick) => closeKey(onClick),
|
|
5207
5527
|
agentState: (agent, answer) => agentState(agent, answer),
|
|
5208
5528
|
projects: () => (data ? projectsInOrder().all : []),
|
|
5209
|
-
openProject: (room) => startRoom(room, { enter: true }),
|
|
5529
|
+
openProject: (room, { draft = null } = {}) => startRoom(room, { enter: true, draft }),
|
|
5530
|
+
// Started ahead, quietly (1.1): the welcome's last step wakes the project it will open, so «Open» goes
|
|
5531
|
+
// straight in instead of waiting on Home. The promise says when it is up.
|
|
5532
|
+
warmProject: (room) => (room?.open ? Promise.resolve(true) : fetch('/api/salas/start', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ room: room.id }) }).then((response) => response.ok, () => false)),
|
|
5210
5533
|
setLanguage: (code) => adoptLanguage(code),
|
|
5211
5534
|
openLinks: () => openLinkSheet(),
|
|
5212
5535
|
openMarket: () => void openHomeMarket('shop'),
|
|
@@ -5232,7 +5555,7 @@ function openHomeWelcome({ at = null, then = null } = {}) {
|
|
|
5232
5555
|
// in that room. Nothing scrolls inside the window: the screen behind it does.
|
|
5233
5556
|
const SET_SECTIONS = [
|
|
5234
5557
|
['You', 'How Home looks and what its bar holds', ['look', 'bar']],
|
|
5235
|
-
['The agents', 'Who works on this Mac', ['agents', 'bishop', 'local']],
|
|
5558
|
+
['The agents', 'Who works on this Mac', ['agents', 'bishop', 'memory', 'local']],
|
|
5236
5559
|
['System', 'The projects of this Mac, the version and the manual', ['projects', 'release', 'manual']],
|
|
5237
5560
|
];
|
|
5238
5561
|
// The room's own icons where the room has the category (app.js, SETTINGS_CATS); the bar, BISHOP
|
|
@@ -5242,12 +5565,13 @@ const SET_CATS = {
|
|
|
5242
5565
|
bar: { name: 'Top bar', icon: trazoDrawing('arrange') },
|
|
5243
5566
|
agents: { name: 'Agents', icon: trazoDrawing('agents') },
|
|
5244
5567
|
bishop: { name: 'Coordinator', icon: trazoDrawing('coordinator') },
|
|
5568
|
+
memory: { name: 'Memory', icon: trazoDrawing('chip') },
|
|
5245
5569
|
local: { name: 'Local AI', icon: trazoDrawing('spark') },
|
|
5246
5570
|
projects: { name: 'Projects', icon: trazoDrawing('folder') },
|
|
5247
5571
|
release: { name: 'Version', icon: trazoDrawing('refresh') },
|
|
5248
5572
|
manual: { name: 'User manual', icon: trazoDrawing('book') },
|
|
5249
5573
|
};
|
|
5250
|
-
const SET_ORDER = ['look', 'bar', 'agents', 'bishop', 'local', 'projects', 'release'];
|
|
5574
|
+
const SET_ORDER = ['look', 'bar', 'agents', 'bishop', 'memory', 'local', 'projects', 'release'];
|
|
5251
5575
|
// The words the search knows, each pointing to the category that holds it (app.js, SETTINGS_INDEX).
|
|
5252
5576
|
const SET_INDEX = [
|
|
5253
5577
|
['look', 'Preview'], ['look', 'Theme'], ['look', 'Accent'], ['look', 'Wallpaper'], ['look', 'Intensity'], ['look', 'Blur'], ['look', 'Project cards'], ['look', 'Text'], ['look', 'Project order'], ['look', 'Language'],
|
|
@@ -5330,6 +5654,8 @@ function setStatus(id) {
|
|
|
5330
5654
|
return { line: t('{n} of {total} signed in', { n: here.length - off.length, total: here.length }), warn: off.length ? t('{agents} without a session', { agents: off.map((agent) => agent.label ?? agent.id).join(', ') }) : null };
|
|
5331
5655
|
}
|
|
5332
5656
|
if (id === 'bishop') { const room = bishopRoom(); return { line: room ? stateOf(room).words : t('Reading…') }; }
|
|
5657
|
+
// Home's own, never the projects' (L-10): /api/settings is asked of Home's room.
|
|
5658
|
+
if (id === 'memory') { const stats = agentsSeen?.settings?.memory?.stats; return { line: stats ? memoriesCount(stats.memories ?? 0) : t('Reading…') }; }
|
|
5333
5659
|
if (id === 'local') {
|
|
5334
5660
|
if (!localSeen) return { line: localFailed ? t('Home did not answer.') : t('Reading…') };
|
|
5335
5661
|
const on = localSeen.projects.filter((one) => one.on).length;
|
|
@@ -5367,14 +5693,19 @@ function setQuick(id) {
|
|
|
5367
5693
|
add(t('Theme'), seg);
|
|
5368
5694
|
}
|
|
5369
5695
|
if (id === 'bar' && !homeShellOn()) add(t('Arrange the bar'), sxButton(t('Arrange'), (event) => { event.stopPropagation(); settingsSheet?.close(); pinsEdit(true); }));
|
|
5696
|
+
// The agents as a quick way in (2026-11-07): each one's mark and its session, three to a row; a tile
|
|
5697
|
+
// opens that agent in the panel (the card itself wires the click, openSettings › card).
|
|
5370
5698
|
if (id === 'agents' && agentsSeen) {
|
|
5699
|
+
rows.classList.add('agents-grid');
|
|
5371
5700
|
for (const agent of agentsSeen.agents.filter((one) => one.id !== 'madre' && one.detected)) {
|
|
5372
5701
|
const state = agentState(agent, agentsSeen);
|
|
5373
|
-
const
|
|
5374
|
-
const
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5702
|
+
const label = agent.label ?? agent.id;
|
|
5703
|
+
const tile = el('button', 'settings-quick-tile agent');
|
|
5704
|
+
tile.type = 'button';
|
|
5705
|
+
tile.dataset.agent = label;
|
|
5706
|
+
tile.setAttribute('aria-label', `${label} · ${state.ok ? t('signed in') : state.key === 'bad' ? t('no session') : t('unknown')}`);
|
|
5707
|
+
tile.append(mark(agent.id, 26), el('span', `state session-lamp ${state.ok ? 'on ok' : state.key === 'bad' ? 'off bad' : 'wait'}`, state.ok ? t('signed in') : state.key === 'bad' ? t('no session') : t('unknown')));
|
|
5708
|
+
rows.append(tile);
|
|
5378
5709
|
}
|
|
5379
5710
|
}
|
|
5380
5711
|
return rows.children.length ? rows : null;
|
|
@@ -5615,6 +5946,28 @@ function fillBishop(host) {
|
|
|
5615
5946
|
sxRow(block, t('Talk to the Coordinator'), room ? stateOf(room).words : null, sxButton(t('Open'), () => { settingsSheet?.close(); openBishop(); }, { tone: 'primary' }));
|
|
5616
5947
|
sxRow(block, t('Open the Coordinator in a new tab'), null, sxButton(t('Open'), () => openBishop({ newTab: true })));
|
|
5617
5948
|
}
|
|
5949
|
+
// MEMORY (L-10, 2026-11-05): what Home itself remembers — the Coordinator and what is said here —
|
|
5950
|
+
// and nothing of the projects. The Memory tile on Home adds up the open projects, and that was read
|
|
5951
|
+
// as Home's; each project keeps its own in its own Settings. Asked of Home's room, the routes a
|
|
5952
|
+
// project's Settings › What it remembers asks of its own; the rest of the settings stay there.
|
|
5953
|
+
async function fillMemory(host) {
|
|
5954
|
+
const block = sxBlock(host, t('Home\'s memory'), t('What Home remembers: the Coordinator and what is said here. Each project keeps its own memory, in its own Settings.'));
|
|
5955
|
+
sxRow(block, t('Reading…'), null);
|
|
5956
|
+
const ask = (path) => fetch(path, { cache: 'no-store' }).then((answer) => (answer.ok ? answer.json() : null)).catch(() => null);
|
|
5957
|
+
const [dash, settings] = await Promise.all([ask('/api/memory/dashboard').then((one) => one?.dashboard ?? null), ask('/api/settings').then((one) => one?.settings?.memory ?? null)]);
|
|
5958
|
+
if (!block.isConnected) return;
|
|
5959
|
+
block.rows.replaceChildren();
|
|
5960
|
+
if (!dash && !settings) sxRow(block, t('Home did not answer.'), null);
|
|
5961
|
+
else {
|
|
5962
|
+
const totals = dash?.totals ?? settings?.stats ?? {};
|
|
5963
|
+
sxRow(block, t('Memories'), totals.pending ? t('{n} exchanges still to sort', { n: totals.pending }) : null, el('b', null, memoriesCount(totals.memories ?? 0)));
|
|
5964
|
+
const kinds = KINDS.filter((kind) => dash?.kinds?.[kind]).map((kind) => `${kindWord(kind)} · ${dash.kinds[kind]}`);
|
|
5965
|
+
if (kinds.length) sxRow(block, t('By kind'), kinds.join(' · '));
|
|
5966
|
+
if (settings) sxRow(block, t('Who takes notes'), settings.enabled === false ? t('Off') : settings.archivist === 'ollama' ? t('Local AI') : settings.archivist && settings.archivist !== 'auto' ? `@${settings.archivist}` : t('Automatic · the cheapest one'));
|
|
5967
|
+
}
|
|
5968
|
+
const more = sxBlock(host, t('The rest'), t('Who may take notes, how often and how it searches are set in the Coordinator, in its Settings › What it remembers.'));
|
|
5969
|
+
sxRow(more, t('Talk to the Coordinator'), null, sxButton(t('Open'), () => { settingsSheet?.close(); openBishop(); }, { tone: 'primary' }));
|
|
5970
|
+
}
|
|
5618
5971
|
// LOCAL AI (src/local-ai.mjs): whether every project uses Ollama, the ones picked here, or each
|
|
5619
5972
|
// one as it decides in its own Settings. The switch of each project is the same one its Settings
|
|
5620
5973
|
// show. Since 2026-10-20 Ollama itself is governed here too, as the agents are: the server, the
|
|
@@ -5856,6 +6209,16 @@ function watchPull(model) {
|
|
|
5856
6209
|
const look = async () => {
|
|
5857
6210
|
await loadLocal({ probe: true });
|
|
5858
6211
|
if ((localOllama?.ollama?.models ?? []).some((one) => one.name.replace(/:latest$/, '') === model)) { pulling.delete(model); toast(t('{model} is ready. Choose it in Settings › Local AI.', { model })); return; }
|
|
6212
|
+
if (localOllama?.lastPull?.model === model && !localOllama.lastPull.ok && !localOllama.pulling) {
|
|
6213
|
+
pulling.delete(model);
|
|
6214
|
+
// Said in Home's words for why (the same ones as an install), not Go's error as it came: a
|
|
6215
|
+
// download cut by DNS or the network read as «pull model manifest: … i/o timeout».
|
|
6216
|
+
const said = localOllama.lastPull;
|
|
6217
|
+
if (said.cancelled) return;
|
|
6218
|
+
toast(TROUBLE_WORDS.install[said.trouble]?.() ?? (said.detail || t('The download stopped: {error}', { error: model })));
|
|
6219
|
+
settingsSheet?.sync({ detail: true, only: 'local' });
|
|
6220
|
+
return;
|
|
6221
|
+
}
|
|
5859
6222
|
if (Date.now() - started > 60 * 60 * 1000) { pulling.delete(model); return; }
|
|
5860
6223
|
setTimeout(look, 8000);
|
|
5861
6224
|
};
|
|
@@ -5867,6 +6230,49 @@ function fillProjects(host) {
|
|
|
5867
6230
|
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' }); }));
|
|
5868
6231
|
const back = homeTour.path() === 'back';
|
|
5869
6232
|
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(); }));
|
|
6233
|
+
void drawService(host);
|
|
6234
|
+
}
|
|
6235
|
+
// MADRE as a service of this Linux (src/service.mjs, L-3, Carlos's server): Home starts with the
|
|
6236
|
+
// computer and again if it falls, with the projects that were open. Only where it can be: a Mac,
|
|
6237
|
+
// or a Linux without systemd for the user, shows nothing.
|
|
6238
|
+
async function drawService(host) {
|
|
6239
|
+
const state = await fetch('/api/madre/service', { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null)).catch(() => null);
|
|
6240
|
+
if (!state?.supported || !host.isConnected) return;
|
|
6241
|
+
const block = sxBlock(host, t('When this computer starts'), t('For a server: Home opens with it, and again if it falls, with the projects that were open. A project you close stays closed.'));
|
|
6242
|
+
const said = el('p', 'sx-hint');
|
|
6243
|
+
const paint = (now) => {
|
|
6244
|
+
block.rows.replaceChildren();
|
|
6245
|
+
const key = sxButton(now.enabled ? t('Turn off') : t('Turn on'), async () => {
|
|
6246
|
+
key.disabled = true;
|
|
6247
|
+
said.textContent = '';
|
|
6248
|
+
const answer = await post('/api/madre/service', { on: !now.enabled });
|
|
6249
|
+
if (!answer.ok) { key.disabled = false; said.textContent = answer.body?.error ?? t('It did not change.'); return; }
|
|
6250
|
+
paint(answer.body);
|
|
6251
|
+
}, { tone: now.enabled ? null : 'primary' });
|
|
6252
|
+
sxRow(block, now.enabled ? t('Starts with the computer') : t('Does not start on its own'), now.enabled ? t('Home starts with this computer.') : t('MADRE starts only when you open it.'), key);
|
|
6253
|
+
if (now.enabled && !now.linger) sxRow(block, t('One more step, once'), t('For it to start before anyone signs in, this computer asks for its password. Run this in its terminal: {command}', { command: now.lingerCommand }), null, { stack: true });
|
|
6254
|
+
block.rows.append(said);
|
|
6255
|
+
};
|
|
6256
|
+
paint(state);
|
|
6257
|
+
}
|
|
6258
|
+
// The author's notices (Q-11): info and important ones can be turned off; security ones always show.
|
|
6259
|
+
function noticesRow(block) {
|
|
6260
|
+
const wrap = el('label', 'settings-switch');
|
|
6261
|
+
const box = el('input');
|
|
6262
|
+
box.type = 'checkbox';
|
|
6263
|
+
box.checked = true;
|
|
6264
|
+
box.disabled = true;
|
|
6265
|
+
box.setAttribute('aria-label', t('Notices from MADRE'));
|
|
6266
|
+
wrap.append(box, el('i'));
|
|
6267
|
+
sxRow(block, t('Notices from MADRE'), t('What MADRE\'s author tells every copy: a new version, a fix, a service stop. Nothing about you is sent to receive them. Security notices always show.'), wrap);
|
|
6268
|
+
void fetch('/api/notices', { cache: 'no-store' }).then((response) => (response.ok ? response.json() : null)).then((answer) => { if (answer) { box.checked = answer.enabled !== false; box.disabled = false; } }).catch(() => null);
|
|
6269
|
+
box.addEventListener('change', async () => {
|
|
6270
|
+
box.disabled = true;
|
|
6271
|
+
const answer = await fetch('/api/notices/settings', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ enabled: box.checked }) }).then((response) => (response.ok ? response.json() : null)).catch(() => null);
|
|
6272
|
+
if (!answer) box.checked = !box.checked;
|
|
6273
|
+
box.disabled = false;
|
|
6274
|
+
askNoticesAgain();
|
|
6275
|
+
});
|
|
5870
6276
|
}
|
|
5871
6277
|
function fillRelease(host) {
|
|
5872
6278
|
const info = versionSeen;
|
|
@@ -5889,6 +6295,7 @@ function fillRelease(host) {
|
|
|
5889
6295
|
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);
|
|
5890
6296
|
row.querySelector('.sx-words')?.append(el('code', 'sm-install-id', info.copyId));
|
|
5891
6297
|
}
|
|
6298
|
+
noticesRow(block);
|
|
5892
6299
|
drawDonate(host);
|
|
5893
6300
|
if (info?.available) {
|
|
5894
6301
|
const notes = el('a', 'sx-btn', t('What it brings'));
|
|
@@ -5957,7 +6364,7 @@ async function updateHome(info, key, said) {
|
|
|
5957
6364
|
}
|
|
5958
6365
|
drop(t('Home did not come back on its own. Start MADRE again from your terminal.'));
|
|
5959
6366
|
}
|
|
5960
|
-
const SET_FILL = { look: fillLook, bar: fillBar, agents: fillAgents, bishop: fillBishop, local: fillLocal, projects: fillProjects, release: fillRelease };
|
|
6367
|
+
const SET_FILL = { look: fillLook, bar: fillBar, agents: fillAgents, bishop: fillBishop, memory: (host) => void fillMemory(host), local: fillLocal, projects: fillProjects, release: fillRelease };
|
|
5961
6368
|
|
|
5962
6369
|
let settingsSheet = null;
|
|
5963
6370
|
function openSettings(section = null) {
|
|
@@ -6012,6 +6419,10 @@ function openSettings(section = null) {
|
|
|
6012
6419
|
if (status.warn) node.append(el('p', 'settings-warn', status.warn));
|
|
6013
6420
|
const quick = setQuick(id);
|
|
6014
6421
|
if (quick) node.append(quick);
|
|
6422
|
+
// An agent's tile goes straight to that agent, not to the list.
|
|
6423
|
+
for (const tile of quick?.querySelectorAll('.settings-quick-tile.agent') ?? []) {
|
|
6424
|
+
tile.addEventListener('click', (event) => { event.stopPropagation(); openCategory('agents', tile.dataset.agent); });
|
|
6425
|
+
}
|
|
6015
6426
|
// The manual is a page of its own, not a panel.
|
|
6016
6427
|
const go = () => (id === 'manual' ? openManual() : openCategory(id));
|
|
6017
6428
|
node.addEventListener('click', go);
|
|
@@ -6077,6 +6488,7 @@ function openSettings(section = null) {
|
|
|
6077
6488
|
scroll.append(detail(state.open));
|
|
6078
6489
|
sheet.append(scroll);
|
|
6079
6490
|
if (full) { body.replaceChildren(sheet); return; }
|
|
6491
|
+
gripHomeSettings(sheet);
|
|
6080
6492
|
const scrim = el('div', 'settings-scrim');
|
|
6081
6493
|
scrim.addEventListener('click', () => closeCategory());
|
|
6082
6494
|
body.replaceChildren(board(), scrim, sheet);
|
|
@@ -6575,3 +6987,8 @@ setInterval(() => { if (!document.hidden) void loadReminders(); }, 60 * 1000);
|
|
|
6575
6987
|
// Asking for a star or a review (review-ask.js), when Home is quiet: nothing waking or closing,
|
|
6576
6988
|
// the bar not being arranged.
|
|
6577
6989
|
startReviewAsk({ busy: () => busy.size > 0 || pins.editing || Boolean(pins.drag) || Boolean(pins.dropping) });
|
|
6990
|
+
// The author's notices (Q-11): every one for this copy, above the board, until «Got it».
|
|
6991
|
+
const noticesHost = el('div', 'sm-notices');
|
|
6992
|
+
noticesHost.hidden = true;
|
|
6993
|
+
document.querySelector('.sm-hero')?.append(noticesHost);
|
|
6994
|
+
const askNoticesAgain = mountNotices(noticesHost);
|