@jossuealcala/madre 1.1.2 → 1.1.4

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.
Files changed (166) hide show
  1. package/CHANGELOG.en.md +40 -1
  2. package/CHANGELOG.md +40 -1
  3. package/README.en.md +3 -3
  4. package/README.md +3 -3
  5. package/SECURITY.md +11 -6
  6. package/TRADEMARKS.md +6 -2
  7. package/bin/madre.mjs +76 -11
  8. package/docs/REFERENCE.md +16 -10
  9. package/docs/SDK.md +36 -9
  10. package/docs/en/REFERENCE.md +12 -8
  11. package/docs/en/SDK.md +34 -8
  12. package/docs/en/training/README.md +1 -1
  13. package/docs/sdk/connector-module.mjs +1 -1
  14. package/docs/sdk/hello-module.mjs +39 -4
  15. package/docs/training/README.md +1 -1
  16. package/docs/training/train.sh +3 -0
  17. package/habilidades/explicamelo-facil/HABILIDAD.md +19 -0
  18. package/habilidades/hojas-de-calculo/HABILIDAD.md +18 -0
  19. package/habilidades/mensajes-a-clientes/HABILIDAD.md +19 -0
  20. package/habilidades/publicaciones-para-redes/HABILIDAD.md +19 -0
  21. package/habilidades/resumen-y-pendientes/HABILIDAD.md +18 -0
  22. package/habilidades/tu-pagina-paso-a-paso/HABILIDAD.md +19 -0
  23. package/package.json +7 -4
  24. package/public/activity.js +66 -22
  25. package/public/app.js +4947 -894
  26. package/public/assets/brand/OFL-SpaceGrotesk.txt +93 -0
  27. package/public/assets/brand/SpaceGrotesk-latin-ext.woff2 +0 -0
  28. package/public/assets/brand/SpaceGrotesk-latin.woff2 +0 -0
  29. package/public/assets/brand/madre-app-180.png +0 -0
  30. package/public/assets/brand/madre-app-192.png +0 -0
  31. package/public/assets/brand/madre-app-512.png +0 -0
  32. package/public/assets/brand/madre-app.svg +1 -1
  33. package/public/assets/brand/madre-favicon.svg +1 -1
  34. package/public/attribution.js +29 -19
  35. package/public/auto-open.js +102 -0
  36. package/public/brands.js +36 -19
  37. package/public/changes.js +63 -0
  38. package/public/en.js +1085 -102
  39. package/public/es.js +2940 -1656
  40. package/public/i18n.js +11 -0
  41. package/public/index.html +31 -27
  42. package/public/loader.js +322 -117
  43. package/public/macroverso.js +57 -355
  44. package/public/manual-content.js +69 -9
  45. package/public/manual.js +21 -6
  46. package/public/market-view.js +298 -84
  47. package/public/market.js +25 -2
  48. package/public/mcp-catalog.js +7 -2
  49. package/public/missions.js +169 -0
  50. package/public/news-scenes.js +292 -0
  51. package/public/nostromo-engine.js +935 -654
  52. package/public/notices.js +78 -0
  53. package/public/notifications.js +119 -0
  54. package/public/power.js +1 -1
  55. package/public/provider-marks.js +170 -0
  56. package/public/provider-pick.js +147 -0
  57. package/public/resay.js +4 -0
  58. package/public/review-ask.js +16 -13
  59. package/public/routing.js +29 -3
  60. package/public/salas-mac.css +467 -47
  61. package/public/salas-mac.html +8 -5
  62. package/public/salas-mac.js +805 -109
  63. package/public/salas.css +2 -2
  64. package/public/salas.html +2 -2
  65. package/public/salas.js +1 -1
  66. package/public/starters.js +128 -0
  67. package/public/styles.css +3036 -340
  68. package/public/subscription.js +303 -0
  69. package/public/terms-field.js +170 -0
  70. package/public/terms.js +117 -19
  71. package/public/tips.js +158 -0
  72. package/public/tour-chapters.js +88 -88
  73. package/public/tour.js +364 -46
  74. package/public/troubleshooting.js +313 -27
  75. package/public/welcome-scene.js +446 -0
  76. package/public/welcome.js +827 -282
  77. package/src/adapters/claude.mjs +2 -1
  78. package/src/adapters/codex.mjs +2 -1
  79. package/src/adapters/cursor.mjs +9 -6
  80. package/src/adapters/gemini-rest.mjs +236 -0
  81. package/src/adapters/gemini.mjs +13 -7
  82. package/src/adapters/grok.mjs +290 -0
  83. package/src/adapters/madre.mjs +71 -23
  84. package/src/adapters/opencode.mjs +15 -2
  85. package/src/adapters/process.mjs +14 -3
  86. package/src/adapters/steps.mjs +176 -0
  87. package/src/app-invite.mjs +90 -0
  88. package/src/auth-probe.mjs +32 -0
  89. package/src/billing-key.mjs +8 -0
  90. package/src/billing.mjs +317 -0
  91. package/src/bridge/policy.mjs +1 -1
  92. package/src/capabilities.mjs +46 -10
  93. package/src/chats.mjs +44 -2
  94. package/src/checkpoint.mjs +119 -1
  95. package/src/codex-route.mjs +113 -0
  96. package/src/commands.mjs +5 -2
  97. package/src/credentials.mjs +46 -8
  98. package/src/dataset.mjs +18 -7
  99. package/src/directives.mjs +1 -0
  100. package/src/event-store.mjs +25 -2
  101. package/src/extensions.mjs +5 -1
  102. package/src/ficha.mjs +158 -0
  103. package/src/files.mjs +36 -2
  104. package/src/image-studio.mjs +13 -3
  105. package/src/install-metrics.mjs +9 -3
  106. package/src/lease.mjs +6 -1
  107. package/src/looks.mjs +4 -1
  108. package/src/market-check.mjs +1 -1
  109. package/src/market-remote.mjs +135 -1
  110. package/src/mcp/image-server.mjs +59 -90
  111. package/src/mcp/memory-server.mjs +10 -0
  112. package/src/memory-tools.mjs +3 -0
  113. package/src/memory.mjs +29 -4
  114. package/src/models.mjs +21 -3
  115. package/src/modules/ahp.mjs +10 -4
  116. package/src/modules/bishop-exam.mjs +41 -12
  117. package/src/modules/bishop.mjs +2 -2
  118. package/src/modules/choices.mjs +12 -10
  119. package/src/modules/fetch-alone.mjs +7 -0
  120. package/src/modules/github.mjs +6 -2
  121. package/src/modules/helpers.mjs +23 -5
  122. package/src/modules/image-providers.mjs +281 -0
  123. package/src/modules/image-studio.mjs +106 -39
  124. package/src/modules/index.mjs +61 -12
  125. package/src/modules/intents-observe.mjs +3 -1
  126. package/src/modules/isolated.mjs +160 -0
  127. package/src/modules/ollama.mjs +35 -6
  128. package/src/modules/playwright.mjs +78 -20
  129. package/src/modules/reminders.mjs +42 -2
  130. package/src/modules/ripley.mjs +2 -1
  131. package/src/modules/run-alone.mjs +122 -0
  132. package/src/modules/runs.mjs +11 -8
  133. package/src/modules/sdk.mjs +10 -3
  134. package/src/notices-key.mjs +8 -0
  135. package/src/notices.mjs +185 -0
  136. package/src/ollama.mjs +57 -15
  137. package/src/opencode-health.mjs +1 -1
  138. package/src/outbound.mjs +124 -13
  139. package/src/quota-sources.mjs +148 -3
  140. package/src/review-ask.mjs +55 -31
  141. package/src/room/archivist.mjs +30 -5
  142. package/src/room/busy.mjs +16 -0
  143. package/src/room/changes.mjs +79 -0
  144. package/src/room/control.mjs +36 -6
  145. package/src/room/economy.mjs +1 -1
  146. package/src/room/guard.mjs +39 -2
  147. package/src/room/prompt.mjs +49 -6
  148. package/src/room/vectors.mjs +7 -1
  149. package/src/room.mjs +181 -49
  150. package/src/router.mjs +1 -1
  151. package/src/runs.mjs +39 -0
  152. package/src/runtime-detection.mjs +46 -6
  153. package/src/salas.mjs +181 -18
  154. package/src/server.mjs +1101 -118
  155. package/src/service.mjs +116 -0
  156. package/src/setup-trouble.mjs +20 -1
  157. package/src/setup.mjs +1 -1
  158. package/src/skill-check.mjs +269 -0
  159. package/src/skills-import.mjs +128 -0
  160. package/src/skills.mjs +502 -0
  161. package/src/terms.mjs +23 -5
  162. package/src/tour.mjs +31 -5
  163. package/src/updates.mjs +47 -4
  164. package/src/web-preview.mjs +181 -0
  165. package/src/whats-new.mjs +121 -1
  166. package/src/rumbo.mjs +0 -337
@@ -15,9 +15,10 @@
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, includedSkills, yourSkills, inMarket, isBought, loadMarket, marketEntry, marketExtras, marketFeatured, marketShelves, marketSkills, moduleFace, remoteEntry, skillHere } from './market.js';
19
19
  import { marketArt, marketGallery } from './market-art.js';
20
- import { trazo } from './icons.js';
20
+ import { ICONS, trazo, trazoDrawing } from './icons.js';
21
+ import { markMission } from './missions.js';
21
22
 
22
23
  const el = (tag, className = null, text = null) => {
23
24
  const node = document.createElement(tag);
@@ -47,6 +48,17 @@ const GLYPH = {
47
48
  next: trazo('next'),
48
49
  search: trazo('search'),
49
50
  };
51
+ // Back, the way Settings goes back (2026-11-13, the author: «the Market's back key, more coherent with
52
+ // the rest»): the same round key with its chevron, and where it goes in its name.
53
+ const backKey = (where, onClick) => {
54
+ const key = button('settings-back mk-back', null, onClick);
55
+ key.title = where;
56
+ key.setAttribute('aria-label', where);
57
+ const mark = el('span', 'settings-back-icon chev-icon');
58
+ mark.innerHTML = trazo('chevron'); // trusted: our own SVG string
59
+ key.append(mark);
60
+ return key;
61
+ };
50
62
  const glyph = (node, name) => { node.insertAdjacentHTML('afterbegin', GLYPH[name]); return node; }; // trusted: our own SVG strings
51
63
 
52
64
  // A module from the catalog says its name and what it does in the room's language (market.js).
@@ -58,6 +70,9 @@ const lineOf = (item) => (moduleFace(item).line ? t(moduleFace(item).line) : t(i
58
70
  const makerOf = (item) => remoteEntry(item.id)?.author?.name ?? item.credit ?? null;
59
71
  const communityTag = () => el('span', 'mk-community', t('Community'));
60
72
  const priceOf = (item) => (marketEntry(item.id).price ? `$${marketEntry(item.id).price}` : t('Free'));
73
+ // Beside a key only a price is said (2026-11-11, the author: «less like the App Store»): free is the
74
+ // rule, so a free one says nothing under its key.
75
+ const paidOf = (item) => (marketEntry(item.id).price ? priceOf(item) : '');
61
76
  const shelfOf = (item) => marketShelves().find((shelf) => shelf.id === marketEntry(item.id).shelf) ?? null;
62
77
  // What its key does: a switch MADRE flips, a folder it writes into, or Local AI's own settings. A
63
78
  // module from the catalog this computer does not have yet is a switch too: it is got first.
@@ -99,7 +114,7 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
99
114
  if (home) {
100
115
  const seg = el('div', 'mk-tabs');
101
116
  seg.setAttribute('role', 'tablist');
102
- for (const [id, label] of [['shop', t('Market')], ['mine', t('Modules')]]) {
117
+ for (const [id, label] of [['shop', t('Market')], ['skills', t('Skills')], ['mine', t('Modules')]]) {
103
118
  const key = button('mk-tab', label, () => go({ tab: id }));
104
119
  key.setAttribute('role', 'tab');
105
120
  tabs[id] = key;
@@ -109,7 +124,16 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
109
124
  } else {
110
125
  const here = el('span', 'mk-here');
111
126
  here.append(el('b', null, t('Market')), el('span', null, t('for {project}', { project: project?.name ?? t('this project') })));
112
- middle.append(here);
127
+ // A skill is not a module and does not share a shelf with one (H-8): its own tab, here too.
128
+ const seg = el('div', 'mk-tabs');
129
+ seg.setAttribute('role', 'tablist');
130
+ for (const [id, label] of [['shop', t('Modules')], ['skills', t('Skills')]]) {
131
+ const key = button('mk-tab', label, () => go({ tab: id }));
132
+ key.setAttribute('role', 'tab');
133
+ tabs[id] = key;
134
+ seg.append(key);
135
+ }
136
+ middle.append(here, seg);
113
137
  }
114
138
  // The same search as every other one in MADRE (styles.css, .settings-search).
115
139
  const search = glyph(el('label', 'settings-search mk-search'), 'search');
@@ -150,7 +174,7 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
150
174
  // A module from the catalog is got first — its signed file, checked, for every project — and
151
175
  // then turned on wherever the person said.
152
176
  // 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 runs with the person's permissions. Nothing is installed
177
+ // one thing every module is — code that needs the person's review. Nothing is installed
154
178
  // until the person says so, and then it is that same file (its sha256).
155
179
  let reviewing = null;
156
180
  const reviewLines = (declares) => {
@@ -174,7 +198,7 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
174
198
  head.append(appIcon(item, 44), el('h2', null, t('Before installing {name}', { name: nameOf(item) })));
175
199
  const list = el('ul', 'mk-review-list');
176
200
  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 inside MADRE with your permissions. MADRE checks its signature and what it declares, not everything its code does: install only what you trust.'));
201
+ 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
202
  const keys = el('div', 'mk-review-keys');
179
203
  const done = (yes) => { reviewing = null; sheet.remove(); resolve(yes); };
180
204
  const no = button('mk-get big quiet', t('Not now'), () => done(false));
@@ -225,9 +249,12 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
225
249
  // drops into place with the tick on it. Turning one off is only a moment.
226
250
  const TICK = trazo('check');
227
251
  const still = () => typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;
252
+ // A chip keeps its words through it: it only fills, then lights (2026-11-11).
253
+ const isChip = (key) => key.classList.contains('mk-chip');
228
254
  const startGetting = (key) => {
229
255
  key.classList.add('getting');
230
256
  key.dataset.from = String(Date.now());
257
+ if (isChip(key)) return;
231
258
  key.dataset.was = key.textContent;
232
259
  key.textContent = t('Getting it…');
233
260
  };
@@ -237,6 +264,7 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
237
264
  const shown = Date.now() - Number(key.dataset.from || 0);
238
265
  if (!still() && shown < 700) await new Promise((resolve) => setTimeout(resolve, 700 - shown));
239
266
  key.classList.remove('getting');
267
+ if (isChip(key)) { key.classList.add('on'); key.setAttribute('aria-pressed', 'true'); await new Promise((resolve) => setTimeout(resolve, still() ? 150 : 450)); return; }
240
268
  key.classList.add('got');
241
269
  key.innerHTML = TICK; // trusted: our own SVG string
242
270
  key.append(el('span', null, t('Done')));
@@ -252,7 +280,7 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
252
280
  const stopGetting = (key) => {
253
281
  if (!key.classList.contains('getting')) return;
254
282
  key.classList.remove('getting');
255
- key.textContent = key.dataset.was ?? key.textContent;
283
+ if (!isChip(key)) key.textContent = key.dataset.was ?? key.textContent;
256
284
  };
257
285
  const turnHere = async (given, on, line, key) => {
258
286
  key.disabled = true;
@@ -262,7 +290,7 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
262
290
  said(line, on && item.id === 'playwright' ? t('Getting the test browser ready: MADRE downloads what it is missing. It can take a few minutes.') : t('One moment…'));
263
291
  const answer = await post(`/api/extensions/${encodeURIComponent(item.id)}/install`, { confirm: true });
264
292
  if (!answer.ok) { key.disabled = false; stopGetting(key); said(line, answer.body.error ?? t('{name} could not be turned on or off.', { name: nameOf(item) }), 'bad'); return; }
265
- if (on) await landed(key);
293
+ if (on) { void markMission('market', { quiet: true }); await landed(key); }
266
294
  notice(on ? t('{name} is on in this project.', { name: nameOf(item) }) : t('{name} is off in this project.', { name: nameOf(item) }));
267
295
  await refresh();
268
296
  };
@@ -275,7 +303,7 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
275
303
  said(line, turningOn && item.id === 'playwright' ? t('Getting the test browser ready: MADRE downloads what it is missing. It can take a few minutes.') : t('One moment…'));
276
304
  const answer = await post(`/api/extensions/${encodeURIComponent(item.id)}/scope`, { ...change, confirm: true });
277
305
  if (!answer.ok) { key.disabled = false; stopGetting(key); said(line, answer.body.error ?? t('{name} could not be turned on or off.', { name: nameOf(item) }), 'bad'); return false; }
278
- if (turningOn) await landed(key);
306
+ if (turningOn) { void markMission('market', { quiet: true }); await landed(key); }
279
307
  await refresh();
280
308
  return true;
281
309
  };
@@ -287,15 +315,16 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
287
315
  if (kind === 'local') return button('mk-get', t('Open'), () => { close(); host.localAi?.(); });
288
316
  if (!onPage) {
289
317
  // On a shelf the key is short: what is on says so and opens its page; what is off gets it.
290
- if (on) return button('mk-get on', kind === 'install' ? t('Installed') : t('Turned on'), () => go({ tab: 'shop', focus: item.id }));
318
+ // One word for getting anything, «Install», and one for having it (2026-11-11, the author).
319
+ if (on) return button('mk-get on', t('Installed'), () => go({ tab: 'shop', focus: item.id }));
291
320
  // A paid module not bought yet is bought on its page, where it says what it costs and how.
292
321
  if (unpaid(item)) return button('mk-get', t('Buy'), () => go({ tab: 'shop', focus: item.id }));
293
322
  if (!home && kind === 'switch') {
294
- const key = button('mk-get', t('Get'), async (event) => { event.stopPropagation(); const line = el('span'); await turnHere(item, true, line, key); if (line.dataset.tone === 'bad') { notice(line.textContent); key.disabled = false; } });
323
+ const key = button('mk-get', t('Install'), async (event) => { event.stopPropagation(); const line = el('span'); await turnHere(item, true, line, key); if (line.dataset.tone === 'bad') { notice(line.textContent); key.disabled = false; } });
295
324
  return key;
296
325
  }
297
326
  if (!home && kind === 'install') return button('mk-get', t('Install'), () => { close(); host.installHere?.(item); });
298
- return button('mk-get', kind === 'install' ? t('Install') : t('Get'), () => go({ tab: 'shop', focus: item.id, choose: true }));
327
+ return button('mk-get', t('Install'), () => go({ tab: 'shop', focus: item.id, choose: true }));
299
328
  }
300
329
  return null;
301
330
  };
@@ -309,69 +338,78 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
309
338
  words.append(title, el('span', null, lineOf(item)));
310
339
  open.append(appIcon(item, 58), words);
311
340
  const side = el('span', 'mk-row-side');
312
- side.append(getKey(item), el('small', null, isOn(item) ? '' : priceOf(item)));
341
+ side.append(getKey(item), el('small', null, isOn(item) ? '' : paidOf(item)));
313
342
  line.append(open, side);
314
343
  return line;
315
344
  };
316
345
 
317
- // THE CAROUSEL: the featured modules, each on its own colors with its picture.
318
- const carousel = () => {
319
- const featured = marketFeatured(items);
320
- if (!featured.length) return null;
346
+ // THE CAROUSEL: the featured modules, each on its own colors with its picture. The rail that moves
347
+ // them is shared with the skills' banners (2026-11-11): one slide as wide as the page, never the
348
+ // next one peeking at the edge.
349
+ const rail = (slides, label) => {
321
350
  const box = el('section', 'mk-carousel');
322
351
  box.setAttribute('aria-roledescription', t('carousel'));
323
- box.setAttribute('aria-label', t('Featured'));
352
+ box.setAttribute('aria-label', label);
324
353
  const track = el('div', 'mk-track');
325
354
  const dots = el('div', 'mk-dots');
326
355
  let index = 0;
327
- featured.forEach((item, at) => {
328
- const slide = hueOf(el('article', 'mk-slide'), item);
356
+ slides.forEach((slide, at) => {
329
357
  slide.setAttribute('aria-roledescription', t('slide'));
330
- slide.setAttribute('aria-label', t('{n} of {total}', { n: at + 1, total: featured.length }));
331
- const words = el('div', 'mk-slide-words');
332
- const get = el('div', 'mk-slide-get');
333
- const who = el('span', 'mk-slide-who');
334
- who.append(el('b', null, nameOf(item)), el('span', null, isOn(item) ? reach(item) : priceOf(item)));
335
- get.append(appIcon(item, 48), who, button('mk-get light', isOn(item) ? t('See it') : unpaid(item) ? t('Buy') : kindOf(item) === 'install' ? t('Install') : kindOf(item) === 'local' ? t('Open') : t('Get'), (event) => { event.stopPropagation(); go({ tab: 'shop', focus: item.id, choose: !isOn(item) }); }));
336
- words.append(el('small', null, t('Featured')), el('h2', null, nameOf(item)), el('p', null, t(marketEntry(item.id).pitch ?? lineOf(item))), get);
337
- const art = el('div', 'mk-slide-art');
338
- art.innerHTML = marketArt(item); // trusted: our own drawings (market-art.js)
339
- slide.append(words, art);
340
- slide.addEventListener('click', () => go({ tab: 'shop', focus: item.id }));
358
+ slide.setAttribute('aria-label', t('{n} of {total}', { n: at + 1, total: slides.length }));
341
359
  track.append(slide);
342
360
  const dot = button('mk-dot', null, () => show(at));
343
- dot.setAttribute('aria-label', t('{n} of {total}', { n: at + 1, total: featured.length }));
361
+ dot.setAttribute('aria-label', t('{n} of {total}', { n: at + 1, total: slides.length }));
344
362
  dots.append(dot);
345
363
  });
346
- // A slide is as wide as the track, or — in the flat store — a little narrower, with the next one
347
- // peeking at the edge: either way each one starts where it starts, not at a multiple of the width.
348
364
  const startOf = (at) => (track.children[at]?.offsetLeft ?? 0) - (track.children[0]?.offsetLeft ?? 0);
349
365
  const show = (at, smooth = true) => {
350
- index = (at + featured.length) % featured.length;
366
+ index = (at + slides.length) % slides.length;
351
367
  track.scrollTo({ left: startOf(index), behavior: smooth && !reducedMotion() ? 'smooth' : 'auto' });
352
368
  mark();
353
369
  };
354
370
  const mark = () => { [...dots.children].forEach((dot, at) => dot.setAttribute('aria-current', String(at === index))); };
355
371
  track.addEventListener('scroll', () => {
356
372
  let at = 0;
357
- featured.forEach((_, one) => { if (Math.abs(startOf(one) - track.scrollLeft) < Math.abs(startOf(at) - track.scrollLeft)) at = one; });
373
+ slides.forEach((_, one) => { if (Math.abs(startOf(one) - track.scrollLeft) < Math.abs(startOf(at) - track.scrollLeft)) at = one; });
358
374
  if (at !== index) { index = at; mark(); }
359
375
  }, { passive: true });
360
376
  // A window sized narrower or wider keeps the card it showed in place, never half of two.
361
377
  if (typeof ResizeObserver === 'function') new ResizeObserver(() => { if (track.isConnected) track.scrollTo({ left: startOf(index), behavior: 'auto' }); }).observe(track);
362
- const prev = glyph(button('mk-arrow prev', null, () => show(index - 1)), 'back');
363
- const next = glyph(button('mk-arrow next', null, () => show(index + 1)), 'next');
364
- prev.setAttribute('aria-label', t('Previous'));
365
- next.setAttribute('aria-label', t('Next'));
366
- box.append(track, prev, next, dots);
378
+ box.append(track);
379
+ if (slides.length > 1) {
380
+ const prev = glyph(button('mk-arrow prev', null, () => show(index - 1)), 'back');
381
+ const next = glyph(button('mk-arrow next', null, () => show(index + 1)), 'next');
382
+ prev.setAttribute('aria-label', t('Previous'));
383
+ next.setAttribute('aria-label', t('Next'));
384
+ box.append(prev, next, dots);
385
+ }
367
386
  mark();
368
387
  // It moves on by itself, unless the person is reading it or asked for stillness.
369
388
  let resting = false;
370
389
  for (const [type, value] of [['pointerenter', true], ['pointerleave', false], ['focusin', true], ['focusout', false]]) box.addEventListener(type, () => { resting = value; });
371
390
  clearInterval(timer);
372
- if (!reducedMotion() && featured.length > 1) timer = setInterval(() => { if (!resting && !document.hidden && box.isConnected) show(index + 1); }, 6500);
391
+ if (!reducedMotion() && slides.length > 1) timer = setInterval(() => { if (!resting && !document.hidden && box.isConnected) show(index + 1); }, 6500);
373
392
  return box;
374
393
  };
394
+ const carousel = () => {
395
+ const featured = marketFeatured(items);
396
+ if (!featured.length) return null;
397
+ const slides = featured.map((item) => {
398
+ const slide = hueOf(el('article', 'mk-slide'), item);
399
+ const words = el('div', 'mk-slide-words');
400
+ const get = el('div', 'mk-slide-get');
401
+ const who = el('span', 'mk-slide-who');
402
+ who.append(el('b', null, nameOf(item)), el('span', null, isOn(item) ? reach(item) : paidOf(item) || lineOf(item)));
403
+ get.append(appIcon(item, 48), who, button('mk-get light', isOn(item) ? t('See it') : unpaid(item) ? t('Buy') : kindOf(item) === 'local' ? t('Open') : t('Install'), (event) => { event.stopPropagation(); go({ tab: 'shop', focus: item.id, choose: !isOn(item) }); }));
404
+ words.append(el('small', null, t('Featured')), el('h2', null, nameOf(item)), el('p', null, t(marketEntry(item.id).pitch ?? lineOf(item))), get);
405
+ const art = el('div', 'mk-slide-art');
406
+ art.innerHTML = marketArt(item); // trusted: our own drawings (market-art.js)
407
+ slide.append(words, art);
408
+ slide.addEventListener('click', () => go({ tab: 'shop', focus: item.id }));
409
+ return slide;
410
+ });
411
+ return rail(slides, t('Featured'));
412
+ };
375
413
 
376
414
  const shop = () => {
377
415
  const words = input.value.trim().toLocaleLowerCase(language());
@@ -386,9 +424,10 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
386
424
  return page;
387
425
  }
388
426
  const head = el('section', 'mk-head');
427
+ // What the Market is, in a person's words (2026-11-10, the author: «better copy of what it is»).
389
428
  head.append(el('h1', null, t('Market')), el('p', null, home
390
- ? t('Modules add what MADRE does: more for your agents, less for the terminal. From Home you choose: every project, or only one.')
391
- : t('Modules add what MADRE does: more for your agents, less for the terminal. What you get here is for this project.')));
429
+ ? t('Tools that give your AIs new things to do: see your page, check your payments, remind you of what is pending. One button turns each on, with no terminal; you choose for every project or only one.')
430
+ : t('Tools that give your AIs new things to do: see your page, check your payments, remind you of what is pending. One button turns each on, with no terminal; what you get here is for this project.')));
392
431
  page.append(head);
393
432
  const featured = carousel();
394
433
  if (featured) page.append(featured);
@@ -410,7 +449,7 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
410
449
  // does and what it touches.
411
450
  const detail = (item, { choose = false } = {}) => {
412
451
  const page = el('div', 'mk-page mk-product');
413
- page.append(glyph(button('mk-back', t('Market'), () => go({ tab: 'shop' })), 'back'));
452
+ page.append(backKey(t('Back to the Market'), () => go({ tab: 'shop' })));
414
453
  const top = el('section', 'mk-product-top');
415
454
  const words = el('div', 'mk-product-words');
416
455
  words.append(el('h1', null, nameOf(item)), el('p', null, lineOf(item)));
@@ -566,45 +605,36 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
566
605
  }
567
606
  const mine = scopeOf(item) ?? { all: on, on: [], everywhere: false, rooms: {} };
568
607
  const everywhere = mine.everywhere || (mine.all && !ids.length);
569
- if (everywhere) {
570
- const off = button('mk-get big quiet', t('Turn off in every project'), () => turnScope(item, { all: false }, line, off));
571
- keys.append(off);
572
- } else {
573
- // Where it goes, asked as a question with its two answers side by side (2026-10-20): every
574
- // project — the ones added later too — or one, chosen by its name. Three keys in a row with
575
- // no question («for all», «or only in», «only in this one», «project by project») read as one
576
- // choice said three ways.
577
- const where = el('div', 'mk-where');
578
- where.append(el('b', 'mk-where-title', t('Where do you want it?')));
579
- const options = el('div', 'mk-where-options');
580
- const everyBox = el('div', 'mk-where-option');
581
- const all = button('mk-get big', t('In all my projects'), async () => { if (await turnScope(item, { all: true }, line, all)) notice(t('{name} is on in all your projects.', { name: nameOf(item) })); });
582
- everyBox.append(all, el('small', null, t('Also in the ones you add later.')));
583
- options.append(everyBox);
584
- const left = ids.filter((id) => !mine.on.includes(id));
585
- if (left.length) {
586
- const oneBox = el('div', 'mk-where-option');
587
- const pick = el('div', 'mk-only');
588
- const select = projectPicker(left);
589
- const key = button('mk-get big quiet', t('Only in one'), async () => { const name = projectName(select.value); if (await turnScope(item, { rooms: { [select.value]: true } }, line, key)) notice(t('{name} is on in {project}.', { name: nameOf(item), project: name })); });
590
- pick.append(key, select);
591
- oneBox.append(pick, el('small', null, t('Choose which one. The others stay as they are.')));
592
- options.append(oneBox);
593
- }
594
- where.append(options);
595
- if (ids.length > 1) where.append(button('mk-link', t('Or decide project by project'), () => go({ tab: 'mine', focus: item.id })));
596
- keys.append(where);
597
- if (choose) requestAnimationFrame(() => all.focus());
598
- return;
608
+ // Where it is on, said once and changed in the same place (2026-11-10, the author: «confusing»):
609
+ // a chip for all your projects and one for each, lit where it is on; a press turns it on or off
610
+ // there. The same chips as in Modules.
611
+ const where = el('div', 'mk-where');
612
+ where.append(el('b', 'mk-where-title', everywhere || mine.on.length ? t('It is on in') : t('Turn it on in')));
613
+ const chips = el('div', 'mk-chips mk-where-chips');
614
+ const allChip = button(`mk-chip all${everywhere ? ' on' : ''}`, t('All my projects'), async () => {
615
+ if (await turnScope(item, { all: !everywhere }, line, allChip) && !everywhere) notice(t('{name} is on in all your projects.', { name: nameOf(item) }));
616
+ });
617
+ allChip.setAttribute('aria-pressed', String(everywhere));
618
+ chips.append(allChip);
619
+ for (const id of ids) {
620
+ const here = everywhere || mine.on.includes(id);
621
+ const chip = button(`mk-chip${here ? ' on' : ''}`, projectName(id), async () => {
622
+ if (await turnScope(item, { rooms: { [id]: !here } }, line, chip) && !here) notice(t('{name} is on in {project}.', { name: nameOf(item), project: projectName(id) }));
623
+ });
624
+ chip.setAttribute('aria-pressed', String(here));
625
+ chip.title = here ? t('On in {project}. Press to turn it off there.', { project: projectName(id) }) : t('Off in {project}. Press to turn it on there.', { project: projectName(id) });
626
+ chips.append(chip);
599
627
  }
600
- if (ids.length) keys.append(button('mk-link', t('Choose project by project'), () => go({ tab: 'mine', focus: item.id })));
628
+ where.append(chips, el('small', 'mk-where-note', t('«All my projects» includes the ones you add later.')));
629
+ keys.append(where);
630
+ if (choose) requestAnimationFrame(() => allChip.focus());
601
631
  };
602
632
 
603
633
  // MODULES, in Home: what is on and where, a switch for every project and one for each.
604
634
  const mine = (focusId = null) => {
605
635
  const page = el('div', 'mk-page mk-mine');
606
636
  const head = el('section', 'mk-head');
607
- head.append(el('h1', null, t('Modules')), el('p', null, t('What you have on or installed, and in which projects. A change here reaches each project with its next message.')));
637
+ head.append(el('h1', null, t('Modules')), el('p', null, t('What you have on, and in which projects. A change here reaches each project with its next message.')));
608
638
  page.append(head);
609
639
  // Local AI and the connectors are MADRE's own, set in Settings (2026-10-28), as a project's
610
640
  // Modules leaves them out (app.js, IN_SETTINGS): not a module to turn on here.
@@ -638,7 +668,8 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
638
668
  box.id = `mk-card-${item.id}`;
639
669
  const head = el('header', 'mk-card-head');
640
670
  const words = el('div', 'mk-card-words');
641
- words.append(el('b', null, nameOf(item)), el('span', null, reach(item)));
671
+ // What it does, in a person's words (2026-11-10): where it is on, the chips below say.
672
+ words.append(el('b', null, nameOf(item)), el('span', null, lineOf(item)));
642
673
  const open = button('mk-card-open', null, () => go({ tab: 'shop', focus: item.id }));
643
674
  open.append(appIcon(item, 44), words);
644
675
  head.append(open);
@@ -652,8 +683,16 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
652
683
  // key and the project read as two keys of different sizes, one under the other.
653
684
  const foot = el('div', 'mk-card-foot');
654
685
  const chips = el('div', 'mk-chips');
655
- for (const id of scopeOf(item)?.on ?? []) chips.append(el('span', 'mk-chip on', projectName(id)));
656
- foot.append(chips, button('mk-get', t('Install in another'), () => go({ tab: 'shop', focus: item.id })));
686
+ // Every project: lit where it is installed; one without it is a chip that leads to installing it
687
+ // there (it installs from that project, where MADRE shows the commands first).
688
+ const placed = scopeOf(item)?.on ?? [];
689
+ for (const project of scope.projects) {
690
+ if (placed.includes(project.id)) { chips.append(el('span', 'mk-chip on', project.name)); continue; }
691
+ const chip = button('mk-chip', project.name, async () => { chip.disabled = true; await host.openProject?.(project.id, item); chip.disabled = false; });
692
+ chip.title = t('Not in {project}. Press to install it there.', { project: project.name });
693
+ chips.append(chip);
694
+ }
695
+ foot.append(chips);
657
696
  box.append(foot);
658
697
  } else {
659
698
  const mineScope = scopeOf(item) ?? { all: false, on: [], everywhere: false };
@@ -678,20 +717,195 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
678
717
  return box;
679
718
  };
680
719
 
720
+ // ---- SKILLS (H-8). Their own tab, because a skill is not a module: it adds no button and no
721
+ // page, it tells whichever agent answers how the person works. So no tiles — a row with its
722
+ // sentence, and a page with the whole text before anything is kept; since 2026-11-11 the shelf opens
723
+ // with banners, as the Market does.
724
+ //
725
+ // Getting one is two steps, as a module's is: MADRE fetches every file and checks it against the
726
+ // signature, shows what it says and what it carries, and only then — on the very seal that was
727
+ // read — keeps it. Nothing of it runs: a program it carries could only ever run inside #4.
728
+ // The shelf of skills (2026-11-10, the author): a search, then what you already keep, what comes
729
+ // with MADRE, and what the community made; two columns, each skill with its drawing.
730
+ const SKILL_ICON_GUESS = [[/client|correo|mensaje|whatsapp|mail/i, 'chat'], [/red|post|instagram|social/i, 'image'], [/hoja|excel|tabla|sheet|cálculo/i, 'bars'], [/página|web|sitio|page|site/i, 'globe'], [/resum|pendiente|summar|todo/i, 'list'], [/explic|aprend|learn|explain/i, 'help'], [/cotiza|precio|quote|price/i, 'note'], [/código|code|program/i, 'code']];
731
+ const skillIcon = (skill) => (ICONS[skill.icon] ? skill.icon : null) ?? SKILL_ICON_GUESS.find(([test]) => test.test(`${skill.id} ${skill.name}`))?.[1] ?? 'spark';
732
+ const skillRow = (skill, { tag = null, key = null } = {}) => {
733
+ const row = el('article', 'mk-skill-row');
734
+ const mark = el('span', 'mk-skill-icon');
735
+ mark.setAttribute('aria-hidden', 'true');
736
+ mark.innerHTML = trazo(skillIcon(skill)); // trusted: our own SVG strings
737
+ const words = el('div', 'mk-skill-words');
738
+ const top = el('div', 'mk-skill-top');
739
+ top.append(el('b', null, skill.name));
740
+ if (tag) top.append(tag);
741
+ words.append(top, el('p', 'mk-skill-line', skill.line || skill.summary || ''));
742
+ row.append(mark, words);
743
+ if (key) row.append(key);
744
+ return row;
745
+ };
746
+ const skillShelf = (title, about, rows) => {
747
+ const shelf = el('section', 'mk-skill-shelf');
748
+ shelf.append(el('h3', 'mk-skill-shelf-title', title));
749
+ if (about) shelf.append(el('p', 'mk-skill-shelf-about', about));
750
+ const list = el('div', 'mk-skill-list');
751
+ list.append(...rows);
752
+ shelf.append(list);
753
+ return shelf;
754
+ };
755
+ // THE SKILLS' BANNERS (2026-11-11, the author: «banners in Skills too»): the community's first —
756
+ // to say out loud that people share them — then the ones MADRE comes with. Each on a colour of its
757
+ // own, with a picture made from its drawing: a conversation where the skill comes in.
758
+ const SKILL_HUES = [['#f9a8d4', '#be185d'], ['#6ee7b7', '#047857'], ['#93c5fd', '#1d4ed8'], ['#fcd34d', '#b45309'], ['#c4b5fd', '#6d28d9'], ['#fca5a5', '#b91c1c'], ['#67e8f9', '#0e7490']];
759
+ const skillArt = (skill, [a, b]) => {
760
+ const icon = trazoDrawing(skillIcon(skill));
761
+ const line = (x, y, w, o = 0.5, c = '#94a3b8') => `<rect x="${x}" y="${y}" width="${w}" height="8" rx="4" fill="${c}" fill-opacity="${o}"/>`;
762
+ return `<svg viewBox="0 0 560 400" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
763
+ <defs><filter id="sk-${skill.id}" x="-20%" y="-20%" width="140%" height="150%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="#000" flood-opacity=".18"/></filter></defs>
764
+ <g filter="url(#sk-${skill.id})">
765
+ <rect x="250" y="58" width="240" height="56" rx="18" fill="${b}"/>${line(272, 78, 150, 0.9, '#ffffff')}${line(272, 94, 96, 0.6, '#ffffff')}
766
+ <rect x="70" y="138" width="380" height="196" rx="20" fill="#ffffff"/>
767
+ <rect x="92" y="160" width="150" height="30" rx="15" fill="${a}" fill-opacity=".35"/>
768
+ <g transform="translate(101 166) scale(.9)" color="${b}">${icon}</g>
769
+ ${line(128, 171, 96, 0.9, b)}
770
+ ${line(92, 210, 320)}${line(92, 230, 290)}${line(92, 250, 304)}${line(92, 270, 210)}
771
+ <rect x="92" y="294" width="120" height="22" rx="11" fill="${b}" fill-opacity=".9"/>${line(110, 301, 84, 0.95, '#ffffff')}
772
+ </g>
773
+ <g transform="translate(392 230)"><rect width="104" height="104" rx="28" fill="${b}"/><g transform="translate(22 22) scale(3)" color="#ffffff">${icon}</g></g>
774
+ </svg>`;
775
+ };
776
+ const skillBanners = (included, community) => {
777
+ const featured = [...community, ...included].slice(0, 6);
778
+ if (!featured.length) return null;
779
+ const slides = featured.map((skill, at) => {
780
+ const hue = skill.hue ?? SKILL_HUES[at % SKILL_HUES.length];
781
+ const slide = el('article', 'mk-slide mk-skill-slide');
782
+ slide.style.setProperty('--mk-a', hue[0]);
783
+ slide.style.setProperty('--mk-b', hue[1]);
784
+ const words = el('div', 'mk-slide-words');
785
+ const get = el('div', 'mk-slide-get');
786
+ const mark = el('span', 'mk-skill-icon big');
787
+ mark.setAttribute('aria-hidden', 'true');
788
+ mark.innerHTML = trazo(skillIcon(skill)); // trusted: our own SVG strings
789
+ const who = el('span', 'mk-slide-who');
790
+ const by = skill.community ? (skill.author?.name ? t('by {name}', { name: skill.author.name }) : t('Made by the community')) : t('Comes with MADRE');
791
+ who.append(el('b', null, skill.name), el('span', null, by));
792
+ const have = skill.community ? skillHere(skill.id) : true;
793
+ const key = button('mk-get light', have ? t('See it') : t('Install'), (event) => { event.stopPropagation(); go({ tab: 'skills', focus: skill.community ? skill.id : null }); });
794
+ get.append(mark, who, key);
795
+ words.append(el('small', null, skill.community ? t('From the community') : t('Comes with MADRE')), el('h2', null, skill.name), el('p', null, skill.line || skill.summary || ''), get);
796
+ const art = el('div', 'mk-slide-art');
797
+ art.innerHTML = skillArt(skill, hue); // trusted: our own drawing
798
+ slide.append(words, art);
799
+ if (skill.community) slide.addEventListener('click', () => go({ tab: 'skills', focus: skill.id }));
800
+ return slide;
801
+ });
802
+ return rail(slides, t('Featured skills'));
803
+ };
804
+ const skillsPage = (focus) => {
805
+ const page = el('div', 'mk-page mk-skills');
806
+ const all = marketSkills();
807
+ const one = focus ? all.find((skill) => skill.id === focus) : null;
808
+ if (one) return skillPage(one);
809
+ // The same head as the Market's and Modules' (2026-11-10): one title size, one line under it.
810
+ const head = el('section', 'mk-head');
811
+ head.append(el('h1', null, t('Skills')), el('p', null, t('How you like things done, told to your AIs: write a message to a customer, explain something simply, tidy a sheet. One skill works the same for Codex, Claude, Gemini, OpenCode, Cursor and Grok.')));
812
+ // Bringing over the ones your agents already keep was only at the foot of Modules, where nobody
813
+ // looked for it (2026-11-08): the shelf of skills offers it too, where a project can take it.
814
+ if (host.importSkills) head.append(button('mk-get mk-skill-import', t('Bring over what you already have'), () => host.importSkills()));
815
+ page.append(head);
816
+ const words = input.value.trim().toLocaleLowerCase(language());
817
+ const fits = (skill) => !words || `${skill.name} ${skill.line ?? ''} ${skill.summary ?? ''}`.toLocaleLowerCase(language()).includes(words);
818
+ const mine = yourSkills().filter(fits);
819
+ const included = includedSkills().filter(fits);
820
+ const shared = all.filter((skill) => !mine.some((have) => have.id === skill.id)).filter(fits);
821
+ const community = shared.filter((skill) => skill.community);
822
+ const market = shared.filter((skill) => !skill.community);
823
+ if (!words) { const banners = skillBanners(includedSkills(), all.filter((skill) => skill.community)); if (banners) page.append(banners); }
824
+ const marketRow = (skill) => skillRow(skill, {
825
+ tag: skill.community && skill.author?.name ? el('span', 'mk-skill-by', t('by {name}', { name: skill.author.name })) : skill.version ? el('span', 'mk-skill-tag', skill.version) : null,
826
+ key: skillHere(skill.id) ? button('mk-get on', t('Yours'), () => go({ tab: 'skills', focus: skill.id })) : button('mk-get', t('Install'), () => go({ tab: 'skills', focus: skill.id })),
827
+ });
828
+ if (mine.length) page.append(skillShelf(t('Your skills'), t('The ones you already keep: your own, brought over from your agents, or got here. You switch them in MODULES → Skills.'), mine.map((skill) => skillRow(skill, { tag: el('span', 'mk-skill-tag', skill.origin === 'project' ? t('this project') : t('Yours')) }))));
829
+ if (included.length) page.append(skillShelf(t('They come with MADRE'), t('Already on: each one comes in by itself when what you ask fits it.'), included.map((skill) => skillRow(skill, { tag: el('span', 'mk-skill-tag', t('Included')) }))));
830
+ if (market.length) page.append(skillShelf(t('In the Market'), null, market.map(marketRow)));
831
+ page.append(skillShelf(t('Made by the community'), t('Skills other people wrote and the author of MADRE reviewed. Read what each one tells your agents before you keep it.'), community.length ? community.map(marketRow) : [el('p', 'mk-empty', words ? t('No skill matches «{query}».', { query: input.value.trim() }) : t('None yet. You can write your own: type /habilidad in the conversation, and send it from MODULES → Skills.'))]));
832
+ return page;
833
+ };
834
+
835
+ // One skill's page: what it tells the agents, whole, before it is kept. Read it and you have read
836
+ // the review — which is the one thing a module's page can never offer.
837
+ const skillPage = (skill) => {
838
+ const page = el('div', 'mk-page mk-skill-page');
839
+ page.append(backKey(t('Back to Skills'), () => go({ tab: 'skills' })));
840
+ const head = el('header', 'mk-skill-head');
841
+ head.append(el('h2', null, skill.name));
842
+ const meta = el('div', 'mk-skill-meta');
843
+ 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));
844
+ if (skill.community) meta.append(communityTag());
845
+ head.append(el('p', 'mk-skill-line', skill.summary || skill.line), meta);
846
+ page.append(head);
847
+ const have = skillHere(skill.id);
848
+ 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 })));
849
+ if (!fits(madre, skill.minMadre)) {
850
+ page.append(el('p', 'mk-skill-warn', t('It needs MADRE {version} or newer.', { version: skill.minMadre })));
851
+ return page;
852
+ }
853
+ const body = el('div', 'mk-skill-read');
854
+ const said = el('p', 'mk-skill-said');
855
+ const keep = button('mk-get', have ? t('Install again') : t('Install'), null);
856
+ keep.hidden = true;
857
+ const read = button('mk-get', t('Read what it tells my agents'), async () => {
858
+ read.disabled = true;
859
+ said.textContent = t('Reading it…');
860
+ const { ok, body: payload } = await post('/api/market/skills/install', { id: skill.id, review: true });
861
+ read.disabled = false;
862
+ if (!ok) { said.textContent = payload.error ?? t('It could not be read.'); return; }
863
+ said.textContent = '';
864
+ read.hidden = true;
865
+ body.replaceChildren();
866
+ if (payload.declares?.when) body.append(el('p', 'mk-skill-when', `${t('It comes in when:')} ${payload.declares.when}`));
867
+ body.append(el('pre', 'mk-skill-body', payload.body));
868
+ const carries = (payload.declares?.references ?? []).filter((path) => !/^(HABILIDAD|SKILL)\.md$/.test(path));
869
+ if (carries.length) body.append(el('p', 'mk-skill-files', t('It carries: {list}', { list: carries.join(', ') })));
870
+ if (payload.declares?.scripts?.length) {
871
+ 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.')}`));
872
+ }
873
+ keep.hidden = false;
874
+ keep.onclick = async () => {
875
+ keep.disabled = true;
876
+ said.textContent = t('Keeping it…');
877
+ const done = await post('/api/market/skills/install', { id: skill.id, accept: payload.seal });
878
+ keep.disabled = false;
879
+ if (!done.ok) { said.textContent = done.body.error ?? t('It could not be kept.'); return; }
880
+ said.textContent = '';
881
+ notice(t('{name} is yours now. It comes in when it fits; change that in MODULES.', { name: skill.name }));
882
+ // One of the first steps (missions.js): something got from the Market.
883
+ void markMission('market', { quiet: true });
884
+ host.changed?.();
885
+ await refresh();
886
+ go({ tab: 'skills', focus: skill.id });
887
+ };
888
+ });
889
+ page.append(read, body, keep, said);
890
+ return page;
891
+ };
892
+
681
893
  // WHERE IT IS: a view, the address that reopens it, and the page scrolled to the top.
682
894
  const render = () => {
683
895
  if (!current) return;
684
896
  for (const [id, key] of Object.entries(tabs)) key.setAttribute('aria-selected', String(id === view.tab));
685
897
  search.hidden = view.tab === 'mine' || Boolean(view.focus);
898
+ input.placeholder = view.tab === 'skills' ? t('Search a skill, or what it does') : t('Search a module, or what it does');
899
+ input.setAttribute('aria-label', input.placeholder);
686
900
  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();
901
+ const page = view.tab === 'skills' ? skillsPage(view.focus) : view.tab === 'mine' ? mine(view.focus) : item ? detail(item, { choose: view.choose }) : shop();
688
902
  main.replaceChildren(page);
689
903
  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';
904
+ const hash = view.tab === 'skills' ? (view.focus ? `#habilidades=${encodeURIComponent(view.focus)}` : '#habilidades') : view.tab === 'mine' ? '#modulos' : item ? `#mercado=${encodeURIComponent(item.id)}` : '#mercado';
691
905
  try { history.replaceState(history.state, '', `${location.pathname}${location.search}${hash}`); } catch { /* the address stays as it was */ }
692
906
  };
693
907
  const go = ({ tab: nextTab = view.tab, focus: nextFocus = null, choose = false } = {}) => {
694
- view = { tab: home ? nextTab : 'shop', focus: nextFocus, choose };
908
+ view = { tab: home || nextTab === 'skills' ? nextTab : 'shop', focus: nextFocus, choose };
695
909
  main.scrollTop = 0;
696
910
  render();
697
911
  };
@@ -706,7 +920,7 @@ export function openMarket({ where = 'home', tab = 'shop', focus = null, project
706
920
  setTimeout(() => root.remove(), reducedMotion() ? 0 : 220);
707
921
  before?.focus?.();
708
922
  };
709
- input.addEventListener('input', () => { if (!view.focus && view.tab === 'shop') { const at = input.selectionStart; render(); input.focus(); input.setSelectionRange(at, at); } });
923
+ input.addEventListener('input', () => { if (!view.focus && (view.tab === 'shop' || view.tab === 'skills')) { const at = input.selectionStart; render(); input.focus(); input.setSelectionRange(at, at); } });
710
924
  root.addEventListener('keydown', (event) => {
711
925
  if (event.key !== 'Escape') return;
712
926
  event.stopPropagation();