@jossuealcala/madre 1.1.1 → 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 +42 -1
- package/CHANGELOG.md +42 -1
- package/README.en.md +4 -4
- package/README.md +4 -4
- package/SECURITY.md +11 -6
- package/bin/madre.mjs +74 -11
- package/docs/REFERENCE.md +15 -8
- package/docs/SDK.md +8 -8
- package/docs/en/REFERENCE.md +12 -7
- 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 +990 -173
- package/public/attribution.js +9 -0
- package/public/brands.js +27 -13
- package/public/en.js +2 -3
- package/public/es.js +968 -258
- package/public/index.html +3 -0
- package/public/macroverso.js +24 -5
- package/public/manual-content.js +38 -8
- package/public/market-view.js +116 -9
- package/public/market.js +28 -2
- 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 +294 -22
- package/public/salas-mac.html +3 -0
- package/public/salas-mac.js +760 -38
- 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 +523 -254
- 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 +21 -8
- package/src/embeddings.mjs +2 -2
- package/src/event-store.mjs +10 -2
- package/src/ficha.mjs +142 -0
- package/src/file-ops.mjs +9 -3
- package/src/files.mjs +36 -2
- package/src/github.mjs +5 -3
- package/src/lease.mjs +5 -0
- package/src/market-check.mjs +1 -1
- package/src/market-remote.mjs +170 -3
- package/src/mcp/image-server.mjs +1 -1
- package/src/mcp/memory-server.mjs +22 -3
- package/src/mcp/proxy.mjs +31 -8
- package/src/memory-tools.mjs +12 -2
- package/src/memory.mjs +44 -3
- 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/check-alone.mjs +25 -0
- 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 +88 -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/mother.mjs +6 -1
- package/src/notices-key.mjs +8 -0
- package/src/notices.mjs +185 -0
- package/src/ollama.mjs +57 -15
- package/src/outbound.mjs +56 -11
- package/src/room/archivist.mjs +36 -5
- package/src/room/busy.mjs +16 -0
- package/src/room/context.mjs +6 -3
- package/src/room/control.mjs +36 -6
- package/src/room/copilot.mjs +22 -28
- 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 +98 -32
- package/src/router.mjs +1 -1
- package/src/runs.mjs +39 -0
- package/src/runtime-detection.mjs +46 -6
- package/src/salas.mjs +253 -15
- package/src/server.mjs +686 -87
- 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 +15 -4
- package/src/whats-new.mjs +71 -0
package/public/index.html
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
<meta charset="utf-8">
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
|
7
7
|
<title>MADRE</title>
|
|
8
|
+
<!-- The ficha (src/ficha.mjs): a 401 that asks for it means this tab's was replaced (MADRE started
|
|
9
|
+
again and opened a new one); the page reloads into the page that says where to open MADRE. -->
|
|
10
|
+
<script>(function () { var ask = window.fetch; window.fetch = function () { return ask.apply(this, arguments).then(function (answer) { if (answer.status === 401 && answer.headers.get('x-madre-ficha') === 'needed') location.reload(); return answer; }); }; })();</script>
|
|
8
11
|
<link rel="icon" type="image/svg+xml" href="/assets/brand/madre-favicon.svg">
|
|
9
12
|
<link rel="stylesheet" href="/styles.css">
|
|
10
13
|
<!-- MADRE's ground over the page from the first frame until the page is ready (2026-10-30, loader.js
|
package/public/macroverso.js
CHANGED
|
@@ -544,6 +544,7 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
544
544
|
paintLegend(on);
|
|
545
545
|
layer.querySelector('.neural-invite')?.remove();
|
|
546
546
|
const now = performance.now() / 1000;
|
|
547
|
+
if (core.sprite) core.dirty = true;
|
|
547
548
|
for (const one of universes) {
|
|
548
549
|
if (!one.sprite?.scene) continue;
|
|
549
550
|
if (one.room.open && !reducedMotion()) one.sprite.engine.setNeural(on, now);
|
|
@@ -566,6 +567,15 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
566
567
|
function layout(all) {
|
|
567
568
|
// BISHOP's own room is the centre, not a universe on an orbit.
|
|
568
569
|
core.room = bishop ? all.find((room) => room.id === bishop.id) ?? null : null;
|
|
570
|
+
// The Coordinator's own memories round its body (2026-11-07), read and painted as a universe's are:
|
|
571
|
+
// its room is a project like the others. Read again only when what it holds has changed.
|
|
572
|
+
if (core.room) {
|
|
573
|
+
const face = `${core.room.open ? 1 : 0}:${JSON.stringify(core.room.glance?.census ?? null)}`;
|
|
574
|
+
if (core.face !== face || core.dpr !== view.dpr) { core.dirty = true; if (core.face !== face) { core.data = null; core.full = null; core.loading = null; } }
|
|
575
|
+
core.face = face;
|
|
576
|
+
core.dpr = view.dpr;
|
|
577
|
+
core.reach = reachOf(core.room);
|
|
578
|
+
}
|
|
569
579
|
const list = bishop ? all.filter((room) => room.id !== bishop.id) : all;
|
|
570
580
|
const kept = new Map(universes.map((one) => [one.room.id, one]));
|
|
571
581
|
const open = list.filter((room) => room.open);
|
|
@@ -634,7 +644,7 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
634
644
|
.then((response) => (response.ok ? response.json() : null))
|
|
635
645
|
.catch(() => null)
|
|
636
646
|
.then((answer) => {
|
|
637
|
-
const now = universes.find((item) => item.room.id === one.room.id);
|
|
647
|
+
const now = one.centre ? (core.room?.id === one.room.id ? core : null) : universes.find((item) => item.room.id === one.room.id);
|
|
638
648
|
if (!now || now.face !== one.face) return null;
|
|
639
649
|
now[key] = answer ?? { unreachable: true };
|
|
640
650
|
if (now.loading) delete now.loading[key];
|
|
@@ -642,7 +652,7 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
642
652
|
// A saturated machine can miss one read while the room is still alive. Do not keep
|
|
643
653
|
// that transient failure as the universe's permanent texture.
|
|
644
654
|
if (now[key].unreachable || now[key].outdated) setTimeout(() => {
|
|
645
|
-
const current = universes.find((item) => item.room.id === one.room.id);
|
|
655
|
+
const current = one.centre ? (core.room?.id === one.room.id ? core : null) : universes.find((item) => item.room.id === one.room.id);
|
|
646
656
|
if (!current || current.face !== one.face || (!current[key]?.unreachable && !current[key]?.outdated)) return;
|
|
647
657
|
current[key] = null;
|
|
648
658
|
if (full) { if (focus === current && !live) enterLive(current); }
|
|
@@ -656,7 +666,7 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
656
666
|
|
|
657
667
|
// One universe is painted a frame, the chosen one first, so a Mac with many rooms never stalls.
|
|
658
668
|
function paintNext() {
|
|
659
|
-
const next = [focus, ...universes].find((one) => one && one.dirty);
|
|
669
|
+
const next = [focus, core.room ? core : null, ...universes].find((one) => one && one.dirty);
|
|
660
670
|
if (!next) return false;
|
|
661
671
|
if (!next.data) { if (!next.loading?.data) void load(next); return false; }
|
|
662
672
|
next.sprite = paintUniverse(next, view.dpr, next.shown ?? null, neural);
|
|
@@ -671,11 +681,11 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
671
681
|
magmaMap(12);
|
|
672
682
|
if (texturesReady()) {
|
|
673
683
|
textures.ready = true;
|
|
674
|
-
for (const one of universes) if (one.sprite && !one.sprite.ready) one.dirty = true;
|
|
684
|
+
for (const one of [core, ...universes]) if (one.sprite && !one.sprite.ready) one.dirty = true;
|
|
675
685
|
}
|
|
676
686
|
}
|
|
677
687
|
paintNext();
|
|
678
|
-
return !textures.ready || universes.some((one) => one.dirty && (one.data || one.loading?.data));
|
|
688
|
+
return !textures.ready || [core.room ? core : null, ...universes].some((one) => one && one.dirty && (one.data || one.loading?.data));
|
|
679
689
|
}
|
|
680
690
|
|
|
681
691
|
// Where a universe is now: on its orbit round the Mac, the far side smaller and fainter.
|
|
@@ -978,6 +988,15 @@ export function openMacroverso({ host, rooms, here, enlaces = [], accent = '#9bf
|
|
|
978
988
|
const p = { x: centre.x, y: centre.y + float * Math.max(0.6, camera.zoom) };
|
|
979
989
|
const r = 30 * clamp(camera.zoom, 0.75, 1.8);
|
|
980
990
|
core.screen = { x: p.x, y: p.y, r: r * (neural ? 1.8 : 1.3) };
|
|
991
|
+
// Its memories first, round where its body floats: the same sprite a project's universe wears.
|
|
992
|
+
if (core.sprite && core.reach) {
|
|
993
|
+
// Wide enough that its memories sit round its body and are not hidden under it.
|
|
994
|
+
const side = Math.max(core.reach * 2 * camera.zoom, r * 12);
|
|
995
|
+
core.shown = side;
|
|
996
|
+
ctx.globalAlpha = awake ? 1 : 0.6;
|
|
997
|
+
ctx.drawImage(core.sprite.canvas, p.x - side / 2, p.y - side / 2, side, side);
|
|
998
|
+
ctx.globalAlpha = 1;
|
|
999
|
+
}
|
|
981
1000
|
// Neural mode: the centre of the brain, its bulb, in the Coordinator's violet; no eye, no gas.
|
|
982
1001
|
if (neural) {
|
|
983
1002
|
const ignite = neuralSince === null ? 1 : clamp((clock - neuralSince) / NEURAL_IGNITION, 0, 1);
|
package/public/manual-content.js
CHANGED
|
@@ -80,7 +80,7 @@ export const MANUAL = {
|
|
|
80
80
|
steps: [
|
|
81
81
|
'Descarga `MADRE-Instalador.exe` en madre.run/windows. Pesa poco: lo demás lo descarga mientras instala.',
|
|
82
82
|
'Ábrelo con doble clic. La primera vez Windows muestra «Windows protegió tu PC». Sale porque el instalador todavía no tiene firma digital, no porque haya algo malo en él: pulsa «Más información» y luego «Ejecutar de todas formas». Estamos tramitando el certificado de firma para que este aviso desaparezca.',
|
|
83
|
-
'Pulsa «Instalar». Si WSL estaba apagado, Windows te pide permiso una vez y quizá reiniciar:
|
|
83
|
+
'Pulsa «Instalar». Si WSL estaba apagado, Windows te pide permiso una vez y quizá reiniciar: al volver, abre «MADRE» en tu escritorio y termina de instalarse.',
|
|
84
84
|
'Al terminar, abre «MADRE» desde el menú Inicio o el escritorio. Se abre en tu navegador de Windows, sin ventanas de terminal.',
|
|
85
85
|
],
|
|
86
86
|
tip: 'Sin sorpresas: el instalador no pide contraseñas y fuera de encender WSL no cambia nada de Windows; su código está a la vista en GitHub (carpeta installer/windows). Para quitarlo: Configuración › Aplicaciones › MADRE › Desinstalar; te pregunta antes de borrar el Linux de MADRE. ¿Prefieres la terminal? En Ubuntu (WSL2): `curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -`, `sudo apt install -y nodejs zstd` y `npx @jossuealcala/madre`.',
|
|
@@ -111,7 +111,7 @@ export const MANUAL = {
|
|
|
111
111
|
icon: 'check',
|
|
112
112
|
shot: 'welcome',
|
|
113
113
|
title: 'La bienvenida',
|
|
114
|
-
lead: 'La primera vez, MADRE te recibe con siete pasos: tu computadora, tus agentes, la IA en tu computadora
|
|
114
|
+
lead: 'La primera vez, MADRE te recibe con siete pasos: tu computadora, tus agentes, tu primer proyecto, la IA en tu computadora y la memoria. Todo con botones, sin terminal. Si no tienes un proyecto a la mano, te crea uno de prueba, y al final te lleva a escribir tu primer mensaje.',
|
|
115
115
|
tryIt: 'Si ya la cerraste, ábrela otra vez: en Inicio, Ajustes › Proyectos › «Ver la bienvenida otra vez».',
|
|
116
116
|
steps: [
|
|
117
117
|
'A la izquierda están los siete pasos. Puedes ir a cualquiera; los que terminas quedan con una palomita.',
|
|
@@ -211,15 +211,15 @@ export const MANUAL = {
|
|
|
211
211
|
'Elige por cuánto tiempo: de 30 minutos a 24 horas.',
|
|
212
212
|
'Enciéndelo y escribe la tarea. Te pide confirmar una sola vez.',
|
|
213
213
|
],
|
|
214
|
-
expert: 'Con Copiloto el agente edita y corre lo
|
|
214
|
+
expert: 'Con Copiloto el agente edita y corre solo lo que lee; tus pruebas y compilaciones esperan tu clic. Nunca borra ni publica. Se apaga solo al acabarse el tiempo, o con «Detener todo».',
|
|
215
215
|
},
|
|
216
216
|
{
|
|
217
217
|
id: 'en-marcha',
|
|
218
218
|
part: 'work',
|
|
219
219
|
icon: 'running',
|
|
220
220
|
title: 'Lo que está pasando',
|
|
221
|
-
lead: '
|
|
222
|
-
tryIt: 'Pídele algo largo a un agente y abre
|
|
221
|
+
lead: 'Plan actual te muestra todo lo que MADRE está haciendo en tus proyectos abiertos, sin abrir una terminal, y te deja detenerlo.',
|
|
222
|
+
tryIt: 'Pídele algo largo a un agente y abre Plan actual mientras trabaja.',
|
|
223
223
|
steps: [
|
|
224
224
|
'Busca en la barra de arriba la línea de pulso. Su número dice cuántas cosas corren, y la línea late mientras algo trabaja.',
|
|
225
225
|
'Púlsala. En «Ahora» ves cada agente respondiendo, sus planes, los servidores y lo que se instala. Abajo están lo que terminó hace poco y los recordatorios que vienen.',
|
|
@@ -287,6 +287,21 @@ export const MANUAL = {
|
|
|
287
287
|
],
|
|
288
288
|
expert: 'Lo que obtienes en el Mercado de un proyecto es para ese proyecto. Los módulos de la comunidad dicen quién los hizo y su licencia; MADRE revisa su firma antes de instalarlos.',
|
|
289
289
|
},
|
|
290
|
+
{
|
|
291
|
+
id: 'habilidades',
|
|
292
|
+
part: 'more',
|
|
293
|
+
icon: 'market',
|
|
294
|
+
title: 'Habilidades: cómo trabajas tú',
|
|
295
|
+
lead: 'Una habilidad le dice a tus agentes cómo trabajas: tu plantilla de cotización, el orden de tus informes, qué preguntar antes de dar un precio. La escribes una vez y la siguen los seis — Codex, Claude, Gemini, OpenCode, Cursor y Grok — porque es MADRE la que les habla.',
|
|
296
|
+
tryIt: 'Escribe en la conversación: /habilidad cuando te pida una cotización, usa mi plantilla y pon el IVA aparte. El agente la escribe, tú la lees y la guardas.',
|
|
297
|
+
steps: [
|
|
298
|
+
'Escribe /habilidad y lo que quieres que hagan, en tus palabras. Hace falta el modo #2.',
|
|
299
|
+
'El agente la escribe y MADRE te la ofrece en la conversación. Pulsa «Léela» antes de guardarla: es una página, se lee en un minuto.',
|
|
300
|
+
'En Módulos → Habilidades eliges cuándo entra: cuando venga al caso, siempre encendida o apagada.',
|
|
301
|
+
'Si ya tienes habilidades de Claude o de Codex, pulsa «Trae las que ya tienes» y elige cuáles.',
|
|
302
|
+
],
|
|
303
|
+
expert: 'Una habilidad no da permiso: no sube el modo del turno ni ensancha lo que un agente puede tocar. Si lleva programas, solo un agente puede correrlos y solo en #4; MADRE nunca corre uno. En la conversación ves una píldora con por qué entró. Y puedes mandarla al Mercado para que la use cualquiera: el autor de MADRE la lee y la firma.',
|
|
304
|
+
},
|
|
290
305
|
{
|
|
291
306
|
id: 'continuidad',
|
|
292
307
|
part: 'more',
|
|
@@ -519,7 +534,7 @@ export const MANUAL = {
|
|
|
519
534
|
steps: [
|
|
520
535
|
'Download `MADRE-Instalador.exe` from madre.run/en/windows. It is small: the rest downloads while it installs.',
|
|
521
536
|
'Open it with a double click. The first time, Windows shows «Windows protected your PC». It appears because the installer does not have a digital signature yet, not because anything is wrong with it: press «More info» and then «Run anyway». We are getting the signing certificate so this notice goes away.',
|
|
522
|
-
'Press «Install». If WSL was off, Windows asks for permission once and maybe a restart:
|
|
537
|
+
'Press «Install». If WSL was off, Windows asks for permission once and maybe a restart: when you are back, open «MADRE» on your desktop and the install finishes.',
|
|
523
538
|
'When it finishes, open «MADRE» from the Start menu or the desktop. It opens in your Windows browser, with no terminal windows.',
|
|
524
539
|
],
|
|
525
540
|
tip: 'No surprises: the installer asks for no passwords and, besides turning WSL on, changes nothing in Windows; its code is in the open on GitHub (folder installer/windows). To remove it: Settings › Apps › MADRE › Uninstall; it asks before deleting MADRE\'s Linux. Prefer the terminal? In Ubuntu (WSL2): `curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -`, `sudo apt install -y nodejs zstd` and `npx @jossuealcala/madre`.',
|
|
@@ -550,7 +565,7 @@ export const MANUAL = {
|
|
|
550
565
|
icon: 'check',
|
|
551
566
|
shot: 'welcome',
|
|
552
567
|
title: 'The welcome',
|
|
553
|
-
lead: 'The first time, MADRE greets you with seven steps: your computer, your agents, AI on your computer
|
|
568
|
+
lead: 'The first time, MADRE greets you with seven steps: your computer, your agents, your first project, AI on your computer and the memory. All with buttons, no terminal. If you have no project at hand, it makes one to try, and at the end it takes you to write your first message.',
|
|
554
569
|
tryIt: 'If you closed it, open it again: in Home, Settings › Projects › «See the welcome again».',
|
|
555
570
|
steps: [
|
|
556
571
|
'The seven steps are on the left. You can go to any of them; the ones you finish get a tick.',
|
|
@@ -650,7 +665,7 @@ export const MANUAL = {
|
|
|
650
665
|
'Choose for how long: from 30 minutes to 24 hours.',
|
|
651
666
|
'Turn it on and write the task. It asks you to confirm only once.',
|
|
652
667
|
],
|
|
653
|
-
expert: 'With Copilot the agent edits and runs what
|
|
668
|
+
expert: 'With Copilot the agent edits and runs on its own only what reads; your tests and builds wait for your click. It never deletes or publishes. It turns itself off when the time is up, or with «Stop all».',
|
|
654
669
|
},
|
|
655
670
|
{
|
|
656
671
|
id: 'en-marcha',
|
|
@@ -726,6 +741,21 @@ export const MANUAL = {
|
|
|
726
741
|
],
|
|
727
742
|
expert: 'What you get in a project\'s Market is for that project. Community modules say who made them and their license; MADRE checks their signature before installing them.',
|
|
728
743
|
},
|
|
744
|
+
{
|
|
745
|
+
id: 'habilidades',
|
|
746
|
+
part: 'more',
|
|
747
|
+
icon: 'market',
|
|
748
|
+
title: 'Skills: the way you work',
|
|
749
|
+
lead: 'A skill tells your agents how you work: your quote template, the order of your reports, what to ask before giving a price. You write it once and all six follow it — Codex, Claude, Gemini, OpenCode, Cursor and Grok — because MADRE is the one that talks to them.',
|
|
750
|
+
tryIt: 'Type in the conversation: /habilidad when I ask for a quote, use my template and put the tax apart. The agent writes it, you read it and keep it.',
|
|
751
|
+
steps: [
|
|
752
|
+
'Type /habilidad and what you want them to do, in your own words. It needs mode #2.',
|
|
753
|
+
'The agent writes it and MADRE offers it in the conversation. Press «Read it» before keeping it: it is one page, a minute to read.',
|
|
754
|
+
'In Modules → Skills you choose when it comes in: when it fits, always on, or off.',
|
|
755
|
+
'If you already have skills from Claude or Codex, press «Bring over what you already have» and pick.',
|
|
756
|
+
],
|
|
757
|
+
expert: 'A skill gives no permission: it does not raise the mode of the turn and does not widen what an agent may touch. If it carries programs, only an agent can run them and only in #4; MADRE never runs one. The conversation shows a pill saying why it came in. And you can send it to the Market for anyone to use: the author of MADRE reads it and signs it.',
|
|
758
|
+
},
|
|
729
759
|
{
|
|
730
760
|
id: 'continuidad',
|
|
731
761
|
part: 'more',
|
package/public/market-view.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// `openProject(projectId, item)` (Home), `toast(text)` and `changed()`.
|
|
16
16
|
|
|
17
17
|
import { t, language } from './i18n.js';
|
|
18
|
-
import { appIcon, communityOf, forSale, inMarket, isBought, loadMarket, marketEntry, marketExtras, marketFeatured, marketShelves, moduleFace, remoteEntry } from './market.js';
|
|
18
|
+
import { appIcon, communityOf, forSale, inMarket, isBought, loadMarket, marketEntry, marketExtras, marketFeatured, marketShelves, marketSkills, moduleFace, remoteEntry, skillHere } from './market.js';
|
|
19
19
|
import { marketArt, marketGallery } from './market-art.js';
|
|
20
20
|
import { trazo } from './icons.js';
|
|
21
21
|
|
|
@@ -99,7 +99,7 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
|
|
|
99
99
|
if (home) {
|
|
100
100
|
const seg = el('div', 'mk-tabs');
|
|
101
101
|
seg.setAttribute('role', 'tablist');
|
|
102
|
-
for (const [id, label] of [['shop', t('Market')], ['mine', t('Modules')]]) {
|
|
102
|
+
for (const [id, label] of [['shop', t('Market')], ['skills', t('Skills')], ['mine', t('Modules')]]) {
|
|
103
103
|
const key = button('mk-tab', label, () => go({ tab: id }));
|
|
104
104
|
key.setAttribute('role', 'tab');
|
|
105
105
|
tabs[id] = key;
|
|
@@ -109,7 +109,16 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
|
|
|
109
109
|
} else {
|
|
110
110
|
const here = el('span', 'mk-here');
|
|
111
111
|
here.append(el('b', null, t('Market')), el('span', null, t('for {project}', { project: project?.name ?? t('this project') })));
|
|
112
|
-
|
|
112
|
+
// A skill is not a module and does not share a shelf with one (H-8): its own tab, here too.
|
|
113
|
+
const seg = el('div', 'mk-tabs');
|
|
114
|
+
seg.setAttribute('role', 'tablist');
|
|
115
|
+
for (const [id, label] of [['shop', t('Modules')], ['skills', t('Skills')]]) {
|
|
116
|
+
const key = button('mk-tab', label, () => go({ tab: id }));
|
|
117
|
+
key.setAttribute('role', 'tab');
|
|
118
|
+
tabs[id] = key;
|
|
119
|
+
seg.append(key);
|
|
120
|
+
}
|
|
121
|
+
middle.append(here, seg);
|
|
113
122
|
}
|
|
114
123
|
// The same search as every other one in MADRE (styles.css, .settings-search).
|
|
115
124
|
const search = glyph(el('label', 'settings-search mk-search'), 'search');
|
|
@@ -150,7 +159,7 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
|
|
|
150
159
|
// A module from the catalog is got first — its signed file, checked, for every project — and
|
|
151
160
|
// then turned on wherever the person said.
|
|
152
161
|
// BEFORE IT IS INSTALLED (2026-10-25): what the module declares, read from its signed file, and the
|
|
153
|
-
// one thing every module is — code that
|
|
162
|
+
// one thing every module is — code that needs the person's review. Nothing is installed
|
|
154
163
|
// until the person says so, and then it is that same file (its sha256).
|
|
155
164
|
let reviewing = null;
|
|
156
165
|
const reviewLines = (declares) => {
|
|
@@ -174,7 +183,7 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
|
|
|
174
183
|
head.append(appIcon(item, 44), el('h2', null, t('Before installing {name}', { name: nameOf(item) })));
|
|
175
184
|
const list = el('ul', 'mk-review-list');
|
|
176
185
|
for (const line of reviewLines(review.declares)) list.append(el('li', null, line));
|
|
177
|
-
const warn = el('p', 'mk-review-warn', t('A module runs
|
|
186
|
+
const warn = el('p', 'mk-review-warn', t('A module runs in a separate process with limited permissions. MADRE checks its signature and declarations; Node cannot guarantee containment of malicious code. Review the file and its network destinations before installing it.'));
|
|
178
187
|
const keys = el('div', 'mk-review-keys');
|
|
179
188
|
const done = (yes) => { reviewing = null; sheet.remove(); resolve(yes); };
|
|
180
189
|
const no = button('mk-get big quiet', t('Not now'), () => done(false));
|
|
@@ -678,20 +687,118 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
|
|
|
678
687
|
return box;
|
|
679
688
|
};
|
|
680
689
|
|
|
690
|
+
// ---- SKILLS (H-8). Their own tab, because a skill is not a module: it adds no button and no
|
|
691
|
+
// page, it tells whichever agent answers how the person works. So no tiles and no carousel — a
|
|
692
|
+
// row with its sentence, and a page with the whole text before anything is kept.
|
|
693
|
+
//
|
|
694
|
+
// Getting one is two steps, as a module's is: MADRE fetches every file and checks it against the
|
|
695
|
+
// signature, shows what it says and what it carries, and only then — on the very seal that was
|
|
696
|
+
// read — keeps it. Nothing of it runs: a program it carries could only ever run inside #4.
|
|
697
|
+
const skillsPage = (focus) => {
|
|
698
|
+
const page = el('div', 'mk-page mk-skills');
|
|
699
|
+
const all = marketSkills();
|
|
700
|
+
const one = focus ? all.find((skill) => skill.id === focus) : null;
|
|
701
|
+
if (one) return skillPage(one);
|
|
702
|
+
const head = el('header', 'mk-shelf-head');
|
|
703
|
+
head.append(el('h2', null, t('Skills')), el('p', null, t('Ways of working, handed to whichever agent answers. The same one works for Codex, Claude, Gemini, OpenCode, Cursor and Grok, because MADRE is the one that writes the briefing.')));
|
|
704
|
+
// Bringing over the ones your agents already keep was only at the foot of Modules, where nobody
|
|
705
|
+
// looked for it (2026-11-08): the shelf of skills offers it too, where a project can take it.
|
|
706
|
+
if (host.importSkills) head.append(button('mk-get mk-skill-import', t('Bring over what you already have'), () => host.importSkills()));
|
|
707
|
+
page.append(head);
|
|
708
|
+
if (!all.length) {
|
|
709
|
+
page.append(el('p', 'mk-empty', t('None in the Market yet. You can write your own: type /habilidad in the conversation.')));
|
|
710
|
+
return page;
|
|
711
|
+
}
|
|
712
|
+
const list = el('div', 'mk-skill-list');
|
|
713
|
+
for (const skill of all) {
|
|
714
|
+
const row = el('article', 'mk-skill-row');
|
|
715
|
+
const words = el('div', 'mk-skill-words');
|
|
716
|
+
const top = el('div', 'mk-skill-top');
|
|
717
|
+
top.append(el('b', null, skill.name));
|
|
718
|
+
if (skill.community && skill.author?.name) top.append(communityTag(), el('span', 'mk-skill-by', t('by {name}', { name: skill.author.name })));
|
|
719
|
+
if (skill.version) top.append(el('span', 'mk-skill-tag', skill.version));
|
|
720
|
+
words.append(top, el('p', 'mk-skill-line', skill.line || skill.summary));
|
|
721
|
+
const have = skillHere(skill.id);
|
|
722
|
+
const key = have
|
|
723
|
+
? button('mk-get on', t('Yours'), () => go({ tab: 'skills', focus: skill.id }))
|
|
724
|
+
: button('mk-get', t('Read it'), () => go({ tab: 'skills', focus: skill.id }));
|
|
725
|
+
row.append(words, key);
|
|
726
|
+
list.append(row);
|
|
727
|
+
}
|
|
728
|
+
page.append(list);
|
|
729
|
+
return page;
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
// One skill's page: what it tells the agents, whole, before it is kept. Read it and you have read
|
|
733
|
+
// the review — which is the one thing a module's page can never offer.
|
|
734
|
+
const skillPage = (skill) => {
|
|
735
|
+
const page = el('div', 'mk-page mk-skill-page');
|
|
736
|
+
page.append(glyph(button('mk-back', t('Skills'), () => go({ tab: 'skills' })), 'back'));
|
|
737
|
+
const head = el('header', 'mk-skill-head');
|
|
738
|
+
head.append(el('h2', null, skill.name));
|
|
739
|
+
const meta = el('div', 'mk-skill-meta');
|
|
740
|
+
for (const word of [skill.version, skill.author?.name ? t('by {name}', { name: skill.author.name }) : null, skill.spdx, skill.credit ? t('Idea by {name}', { name: skill.credit }) : null].filter(Boolean)) meta.append(el('span', null, word));
|
|
741
|
+
if (skill.community) meta.append(communityTag());
|
|
742
|
+
head.append(el('p', 'mk-skill-line', skill.summary || skill.line), meta);
|
|
743
|
+
page.append(head);
|
|
744
|
+
const have = skillHere(skill.id);
|
|
745
|
+
if (have) page.append(el('p', 'mk-skill-have', t('You have it, version {version}. It comes in when it fits; you decide that in MODULES → Skills.', { version: have.version })));
|
|
746
|
+
if (!fits(madre, skill.minMadre)) {
|
|
747
|
+
page.append(el('p', 'mk-skill-warn', t('It needs MADRE {version} or newer.', { version: skill.minMadre })));
|
|
748
|
+
return page;
|
|
749
|
+
}
|
|
750
|
+
const body = el('div', 'mk-skill-read');
|
|
751
|
+
const said = el('p', 'mk-skill-said');
|
|
752
|
+
const keep = button('mk-get', have ? t('Get it again') : t('Keep it'), null);
|
|
753
|
+
keep.hidden = true;
|
|
754
|
+
const read = button('mk-get', t('Read what it tells my agents'), async () => {
|
|
755
|
+
read.disabled = true;
|
|
756
|
+
said.textContent = t('Reading it…');
|
|
757
|
+
const { ok, body: payload } = await post('/api/market/skills/install', { id: skill.id, review: true });
|
|
758
|
+
read.disabled = false;
|
|
759
|
+
if (!ok) { said.textContent = payload.error ?? t('It could not be read.'); return; }
|
|
760
|
+
said.textContent = '';
|
|
761
|
+
read.hidden = true;
|
|
762
|
+
body.replaceChildren();
|
|
763
|
+
if (payload.declares?.when) body.append(el('p', 'mk-skill-when', `${t('It comes in when:')} ${payload.declares.when}`));
|
|
764
|
+
body.append(el('pre', 'mk-skill-body', payload.body));
|
|
765
|
+
const carries = (payload.declares?.references ?? []).filter((path) => !/^(HABILIDAD|SKILL)\.md$/.test(path));
|
|
766
|
+
if (carries.length) body.append(el('p', 'mk-skill-files', t('It carries: {list}', { list: carries.join(', ') })));
|
|
767
|
+
if (payload.declares?.scripts?.length) {
|
|
768
|
+
body.append(el('p', 'mk-skill-warn', `${t('It carries programs: {list}', { list: payload.declares.scripts.join(', ') })} ${t('MADRE never runs one. Only an agent can, and only in #4 AIRLOCK: in every other mode they do nothing. Read one before you open that mode.')}`));
|
|
769
|
+
}
|
|
770
|
+
keep.hidden = false;
|
|
771
|
+
keep.onclick = async () => {
|
|
772
|
+
keep.disabled = true;
|
|
773
|
+
said.textContent = t('Keeping it…');
|
|
774
|
+
const done = await post('/api/market/skills/install', { id: skill.id, accept: payload.seal });
|
|
775
|
+
keep.disabled = false;
|
|
776
|
+
if (!done.ok) { said.textContent = done.body.error ?? t('It could not be kept.'); return; }
|
|
777
|
+
said.textContent = '';
|
|
778
|
+
notice(t('{name} is yours now. It comes in when it fits; change that in MODULES.', { name: skill.name }));
|
|
779
|
+
host.changed?.();
|
|
780
|
+
await refresh();
|
|
781
|
+
go({ tab: 'skills', focus: skill.id });
|
|
782
|
+
};
|
|
783
|
+
});
|
|
784
|
+
page.append(read, body, keep, said);
|
|
785
|
+
return page;
|
|
786
|
+
};
|
|
787
|
+
|
|
681
788
|
// WHERE IT IS: a view, the address that reopens it, and the page scrolled to the top.
|
|
682
789
|
const render = () => {
|
|
683
790
|
if (!current) return;
|
|
684
791
|
for (const [id, key] of Object.entries(tabs)) key.setAttribute('aria-selected', String(id === view.tab));
|
|
685
|
-
search.hidden = view.tab === 'mine' || Boolean(view.focus);
|
|
792
|
+
search.hidden = view.tab === 'mine' || view.tab === 'skills' || Boolean(view.focus);
|
|
686
793
|
const item = view.focus ? items.find((one) => one.id === view.focus) : null;
|
|
687
|
-
const page = view.tab === 'mine' ? mine(view.focus) : item ? detail(item, { choose: view.choose }) : shop();
|
|
794
|
+
const page = view.tab === 'skills' ? skillsPage(view.focus) : view.tab === 'mine' ? mine(view.focus) : item ? detail(item, { choose: view.choose }) : shop();
|
|
688
795
|
main.replaceChildren(page);
|
|
689
796
|
if (view.tab === 'mine' && view.focus) requestAnimationFrame(() => document.getElementById(`mk-card-${view.focus}`)?.scrollIntoView({ block: 'center' }));
|
|
690
|
-
const hash = view.tab === 'mine' ? '#modulos' : item ? `#mercado=${encodeURIComponent(item.id)}` : '#mercado';
|
|
797
|
+
const hash = view.tab === 'skills' ? (view.focus ? `#habilidades=${encodeURIComponent(view.focus)}` : '#habilidades') : view.tab === 'mine' ? '#modulos' : item ? `#mercado=${encodeURIComponent(item.id)}` : '#mercado';
|
|
691
798
|
try { history.replaceState(history.state, '', `${location.pathname}${location.search}${hash}`); } catch { /* the address stays as it was */ }
|
|
692
799
|
};
|
|
693
800
|
const go = ({ tab: nextTab = view.tab, focus: nextFocus = null, choose = false } = {}) => {
|
|
694
|
-
view = { tab: home ? nextTab : 'shop', focus: nextFocus, choose };
|
|
801
|
+
view = { tab: home || nextTab === 'skills' ? nextTab : 'shop', focus: nextFocus, choose };
|
|
695
802
|
main.scrollTop = 0;
|
|
696
803
|
render();
|
|
697
804
|
};
|
package/public/market.js
CHANGED
|
@@ -224,6 +224,20 @@ export function setMarketCatalog(catalog) {
|
|
|
224
224
|
remote = catalog && Array.isArray(catalog.modules) ? { ...catalog, byId: new Map(catalog.modules.map((entry) => [entry.id, entry])) } : null;
|
|
225
225
|
}
|
|
226
226
|
export const remoteEntry = (id) => remote?.byId.get(id) ?? null;
|
|
227
|
+
// THE SKILLS of the catalog (2026-11-08, H-8): a list of its own, never mixed with the modules —
|
|
228
|
+
// a module adds buttons and pages, a skill tells the agents how the person works. Their words come
|
|
229
|
+
// in both languages like everything else here.
|
|
230
|
+
export const marketSkills = () => (Array.isArray(remote?.skills) ? remote.skills : []).map((entry) => ({
|
|
231
|
+
...entry,
|
|
232
|
+
name: pick(entry.name) ?? entry.id,
|
|
233
|
+
line: pick(entry.line) ?? '',
|
|
234
|
+
summary: pick(entry.summary) ?? '',
|
|
235
|
+
changes: pick(entry.changes),
|
|
236
|
+
}));
|
|
237
|
+
// Which of them this computer got, as /api/market says: version and when.
|
|
238
|
+
let skillsHere = {};
|
|
239
|
+
export const setMarketSkills = (installed) => { skillsHere = installed && typeof installed === 'object' ? installed : {}; };
|
|
240
|
+
export const skillHere = (id) => skillsHere[id] ?? null;
|
|
227
241
|
// THE PAID MODULES (src/market-license.mjs): which ones this computer bought, as /api/market says
|
|
228
242
|
// (never the keys), and whether one still has to be bought before it can be got.
|
|
229
243
|
let bought = {};
|
|
@@ -270,15 +284,27 @@ export async function loadMarket({ toast = null, open = null } = {}) {
|
|
|
270
284
|
if (!answer) return null;
|
|
271
285
|
setMarketCatalog(answer.catalog);
|
|
272
286
|
setMarketLicensed(answer.licensed);
|
|
287
|
+
setMarketSkills(answer.skills);
|
|
273
288
|
if (!toast) return answer;
|
|
274
289
|
const updated = answer.news ?? [];
|
|
275
290
|
if (updated.length) {
|
|
276
|
-
//
|
|
277
|
-
// one MADRE came with; a module taken out of the Market and of this computer
|
|
291
|
+
// Four kinds, each in its words (2026-10-25): updated itself; one of MADRE's own sent back to the
|
|
292
|
+
// one MADRE came with; a module taken out of the Market and of this computer; and (2026-11-01) a
|
|
293
|
+
// newer version held because it asks for more. The why is the author's.
|
|
278
294
|
const line = (one) => {
|
|
279
295
|
const name = one.name && typeof one.name === 'object' ? pick(one.name) : t(one.name ?? one.id);
|
|
280
296
|
if (one.kind === 'returned') return [t('{name} went back to the version that comes with MADRE.', { name }), pick(one.why)];
|
|
281
297
|
if (one.kind === 'removed') return [t('{name} was taken out of the Market and removed from this computer.', { name }), pick(one.why)];
|
|
298
|
+
// A newer version that declares more than the person accepted waits for them (external review #10).
|
|
299
|
+
if (one.kind === 'held') {
|
|
300
|
+
const asked = (more) => (more.what === 'reaches' ? t('it connects to {host}', { host: more.host })
|
|
301
|
+
: more.what === 'secret' ? t('it asks for {name}', { name: more.name })
|
|
302
|
+
: more.what === 'tools' ? t('it gives tools to your agents')
|
|
303
|
+
: more.what === 'reads' ? t('it reads your chats')
|
|
304
|
+
: more.what === 'writes' ? t('it writes in your project')
|
|
305
|
+
: t('it adds {command}', { command: more.name }));
|
|
306
|
+
return [t('{name} {version} asks for more than you accepted, so it did not update on its own: {more}.', { name, version: one.to, more: (one.more ?? []).map(asked).join('; ') }), t('To accept it, remove it in Modules and install it again from the Market, where you read what it does.')];
|
|
307
|
+
}
|
|
282
308
|
return [t('{name} updated itself to version {version}.', { name, version: one.to }), pick(one.changes)];
|
|
283
309
|
};
|
|
284
310
|
toast(updated.map((one) => line(one).filter(Boolean).join(' ')).join(' '));
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
// MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
|
|
3
|
+
// The moving pictures of «what's new» (1.1.3).
|
|
4
|
+
//
|
|
5
|
+
// Each card shows the thing itself, small: MADRE's own pieces (a card, a dock of agents, a window
|
|
6
|
+
// with its hint) acted out in a few beats, the way a phone shows you a new feature. Not a
|
|
7
|
+
// screenshot, which ages with every change of the interface, and not abstract points, which said
|
|
8
|
+
// nothing to the author (2026-11-08). The agents wear their official marks, untouched (brands.js).
|
|
9
|
+
//
|
|
10
|
+
// A scene is a run of beats: each adds a class to the stage (`b1`, `b2`…) and CSS moves what that
|
|
11
|
+
// beat moves (styles.css, `.ns`). At the end the stage fades, the beats are taken back and it
|
|
12
|
+
// starts again. With reduced motion it shows the last beat and stays still.
|
|
13
|
+
//
|
|
14
|
+
// The few words a scene says are data in both languages, chosen with pick() like the notes are.
|
|
15
|
+
|
|
16
|
+
import { brandOf } from './brands.js';
|
|
17
|
+
import { trazo } from './icons.js';
|
|
18
|
+
import { pick } from './i18n.js';
|
|
19
|
+
|
|
20
|
+
const WORDS = {
|
|
21
|
+
skill: { es: 'Así cotizo', en: 'How I quote' },
|
|
22
|
+
skillTag: { es: 'Habilidad', en: 'Skill' },
|
|
23
|
+
joined: { es: 'Conectado con tu cuenta', en: 'Connected with your account' },
|
|
24
|
+
can: [
|
|
25
|
+
{ es: 'Lee y escribe', en: 'Reads and writes' },
|
|
26
|
+
{ es: 'Busca en internet', en: 'Searches the web' },
|
|
27
|
+
{ es: 'Hace imágenes', en: 'Makes images' },
|
|
28
|
+
],
|
|
29
|
+
hintTitle: { es: 'Plan actual', en: 'Running now' },
|
|
30
|
+
hintLine: { es: 'Lo que hace cada IA, en vivo.', en: 'What each AI is doing, live.' },
|
|
31
|
+
hours: { es: '5 h', en: '5 h' },
|
|
32
|
+
week: { es: '7 días', en: '7 days' },
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const node = (tag, cls, text) => {
|
|
36
|
+
const n = document.createElement(tag);
|
|
37
|
+
if (cls) n.className = cls;
|
|
38
|
+
if (text != null) n.textContent = text;
|
|
39
|
+
return n;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// An agent in its own colours with its official mark (brands.js), as the room draws it.
|
|
43
|
+
function face(id, cls = 'ns-face') {
|
|
44
|
+
const brand = brandOf(id);
|
|
45
|
+
const n = node('span', cls);
|
|
46
|
+
n.style.setProperty('--ns-brand', brand.gradient ?? brand.color);
|
|
47
|
+
n.style.setProperty('--ns-ink', brand.ink ?? '#111');
|
|
48
|
+
n.innerHTML = brand.mark(); // trusted: our own SVG strings from brands.js
|
|
49
|
+
return n;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const icon = (name, cls) => {
|
|
53
|
+
const n = node('span', cls);
|
|
54
|
+
n.innerHTML = trazo(name); // trusted: our own SVG strings from icons.js
|
|
55
|
+
return n;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const SCENES = {
|
|
59
|
+
// «Teach it once how you work»: a skill is written, then each AI picks it up.
|
|
60
|
+
skills(stage) {
|
|
61
|
+
const doc = node('div', 'ns-doc');
|
|
62
|
+
const head = node('div', 'ns-doc-head');
|
|
63
|
+
head.append(icon('book', 'ns-doc-icon'), node('b', null, pick(WORDS.skill)));
|
|
64
|
+
doc.append(head);
|
|
65
|
+
for (let i = 0; i < 3; i += 1) {
|
|
66
|
+
const line = node('i', 'ns-line');
|
|
67
|
+
line.style.setProperty('--i', i);
|
|
68
|
+
doc.append(line);
|
|
69
|
+
}
|
|
70
|
+
doc.append(node('span', 'ns-tag', pick(WORDS.skillTag)));
|
|
71
|
+
const agents = node('div', 'ns-agents');
|
|
72
|
+
['claude', 'codex', 'grok'].forEach((id, i) => {
|
|
73
|
+
const row = node('div', 'ns-row');
|
|
74
|
+
row.style.setProperty('--i', i);
|
|
75
|
+
const pill = node('span', 'ns-pill');
|
|
76
|
+
pill.append(node('span', null, pick(WORDS.skill)), icon('check', 'ns-check'));
|
|
77
|
+
row.append(face(id), pill);
|
|
78
|
+
agents.append(row);
|
|
79
|
+
});
|
|
80
|
+
stage.append(doc, agents);
|
|
81
|
+
return [400, 1500, 2700, 3700];
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
// «Grok, now among your AIs»: it joins the dock, bounces once and says what it can do.
|
|
85
|
+
newagent(stage) {
|
|
86
|
+
const dock = node('div', 'ns-dock');
|
|
87
|
+
for (const id of ['codex', 'claude', 'gemini', 'opencode']) dock.append(face(id, 'ns-app'));
|
|
88
|
+
dock.append(face('grok', 'ns-app ns-new'));
|
|
89
|
+
const status = node('div', 'ns-status');
|
|
90
|
+
status.append(node('i', 'ns-dot'), node('span', null, pick(WORDS.joined)));
|
|
91
|
+
const can = node('div', 'ns-can');
|
|
92
|
+
WORDS.can.forEach((word, i) => {
|
|
93
|
+
const chip = node('span', 'ns-chip', pick(word));
|
|
94
|
+
chip.style.setProperty('--i', i);
|
|
95
|
+
can.append(chip);
|
|
96
|
+
});
|
|
97
|
+
stage.append(dock, status, can);
|
|
98
|
+
return [700, 1500, 2300, 2900];
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
// «MADRE explains each thing»: a first click opens its note, and the AI shows its plan in bars.
|
|
102
|
+
tips(stage) {
|
|
103
|
+
const win = node('div', 'ns-win');
|
|
104
|
+
const bar = node('div', 'ns-bar');
|
|
105
|
+
const brand = icon('mother', 'ns-brand');
|
|
106
|
+
const keys = node('div', 'ns-keys');
|
|
107
|
+
const target = icon('running', 'ns-key ns-target');
|
|
108
|
+
keys.append(icon('attach', 'ns-key'), target, icon('agents', 'ns-key'));
|
|
109
|
+
bar.append(brand, keys);
|
|
110
|
+
const body = node('div', 'ns-body');
|
|
111
|
+
const plan = node('div', 'ns-plan');
|
|
112
|
+
const meters = node('div', 'ns-meters');
|
|
113
|
+
[[WORDS.hours, 0.42], [WORDS.week, 0.18]].forEach(([label, share], i) => {
|
|
114
|
+
const meter = node('div', 'ns-meter');
|
|
115
|
+
meter.style.setProperty('--share', share);
|
|
116
|
+
meter.style.setProperty('--i', i);
|
|
117
|
+
meter.append(node('span', null, pick(label)), node('i'));
|
|
118
|
+
meters.append(meter);
|
|
119
|
+
});
|
|
120
|
+
plan.append(face('claude'), meters);
|
|
121
|
+
body.append(plan);
|
|
122
|
+
const hint = node('div', 'ns-hint');
|
|
123
|
+
hint.append(node('b', null, pick(WORDS.hintTitle)), node('span', null, pick(WORDS.hintLine)));
|
|
124
|
+
// The arrow is drawn by CSS (styles.css, .ns-pointer::before): icons come from icons.js only.
|
|
125
|
+
const pointer = node('span', 'ns-pointer');
|
|
126
|
+
win.append(bar, body, hint);
|
|
127
|
+
stage.append(win, pointer);
|
|
128
|
+
return [500, 1500, 1800, 3700];
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export const NEWS_SCENES = Object.keys(SCENES);
|
|
133
|
+
|
|
134
|
+
// One stage. `stop()` clears its timers when the sheet closes.
|
|
135
|
+
export function createNewsScene(id) {
|
|
136
|
+
const stage = node('div', `ns ns-${id}`);
|
|
137
|
+
stage.setAttribute('aria-hidden', 'true');
|
|
138
|
+
const beats = SCENES[id]?.(stage) ?? [];
|
|
139
|
+
const timers = new Set();
|
|
140
|
+
const later = (ms, fn) => { const timer = setTimeout(() => { timers.delete(timer); fn(); }, ms); timers.add(timer); };
|
|
141
|
+
const still = globalThis.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches;
|
|
142
|
+
const HOLD = 3200;
|
|
143
|
+
// Measured, because the frame's size decides where things are: where the skill card starts, where
|
|
144
|
+
// the pointer goes and where the note's arrow points.
|
|
145
|
+
const aim = () => {
|
|
146
|
+
// The skill card starts in the middle of the frame: as far right as half of what comes beside it.
|
|
147
|
+
const agents = stage.querySelector('.ns-agents');
|
|
148
|
+
if (agents?.offsetWidth) stage.style.setProperty('--ns-doc-shift', `${(agents.offsetWidth + parseFloat(getComputedStyle(stage).columnGap || 0)) / 2}px`);
|
|
149
|
+
const pointer = stage.querySelector('.ns-pointer');
|
|
150
|
+
const target = stage.querySelector('.ns-target');
|
|
151
|
+
const hint = stage.querySelector('.ns-hint');
|
|
152
|
+
if (!pointer || !target) return;
|
|
153
|
+
const from = pointer.getBoundingClientRect();
|
|
154
|
+
const to = target.getBoundingClientRect();
|
|
155
|
+
if (!to.width) return;
|
|
156
|
+
stage.style.setProperty('--ns-to-x', `${to.left + to.width * 0.55 - from.left}px`);
|
|
157
|
+
stage.style.setProperty('--ns-to-y', `${to.top + to.height * 0.55 - from.top}px`);
|
|
158
|
+
if (hint) {
|
|
159
|
+
const box = hint.getBoundingClientRect();
|
|
160
|
+
const em = parseFloat(getComputedStyle(hint).fontSize) || 10;
|
|
161
|
+
stage.style.setProperty('--ns-arrow', `${box.right - (to.left + to.width / 2) - 0.35 * em}px`);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
// Measured just before the first beat, not at creation: the stage is put on the page after it is
|
|
165
|
+
// made, and while nothing shows yet a change of place is not seen.
|
|
166
|
+
const run = () => {
|
|
167
|
+
later(Math.max(0, (beats[0] ?? 0) - 200), aim);
|
|
168
|
+
beats.forEach((ms, i) => later(ms, () => stage.classList.add(`b${i + 1}`)));
|
|
169
|
+
const end = (beats.at(-1) ?? 0) + HOLD;
|
|
170
|
+
later(end, () => stage.classList.add('out'));
|
|
171
|
+
later(end + 420, () => {
|
|
172
|
+
stage.classList.add('reset');
|
|
173
|
+
beats.forEach((_, i) => stage.classList.remove(`b${i + 1}`));
|
|
174
|
+
void stage.offsetWidth; // the reset lands before the stage comes back
|
|
175
|
+
stage.classList.remove('reset', 'out');
|
|
176
|
+
run();
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
if (still) beats.forEach((_, i) => stage.classList.add(`b${i + 1}`));
|
|
180
|
+
else run();
|
|
181
|
+
return {
|
|
182
|
+
node: stage,
|
|
183
|
+
stop() { for (const timer of timers) clearTimeout(timer); timers.clear(); },
|
|
184
|
+
};
|
|
185
|
+
}
|