@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.
- package/CHANGELOG.en.md +40 -1
- package/CHANGELOG.md +40 -1
- package/README.en.md +3 -3
- package/README.md +3 -3
- package/SECURITY.md +11 -6
- package/TRADEMARKS.md +6 -2
- package/bin/madre.mjs +76 -11
- package/docs/REFERENCE.md +16 -10
- package/docs/SDK.md +36 -9
- package/docs/en/REFERENCE.md +12 -8
- package/docs/en/SDK.md +34 -8
- package/docs/en/training/README.md +1 -1
- package/docs/sdk/connector-module.mjs +1 -1
- package/docs/sdk/hello-module.mjs +39 -4
- package/docs/training/README.md +1 -1
- package/docs/training/train.sh +3 -0
- package/habilidades/explicamelo-facil/HABILIDAD.md +19 -0
- package/habilidades/hojas-de-calculo/HABILIDAD.md +18 -0
- package/habilidades/mensajes-a-clientes/HABILIDAD.md +19 -0
- package/habilidades/publicaciones-para-redes/HABILIDAD.md +19 -0
- package/habilidades/resumen-y-pendientes/HABILIDAD.md +18 -0
- package/habilidades/tu-pagina-paso-a-paso/HABILIDAD.md +19 -0
- package/package.json +7 -4
- package/public/activity.js +66 -22
- package/public/app.js +4947 -894
- package/public/assets/brand/OFL-SpaceGrotesk.txt +93 -0
- package/public/assets/brand/SpaceGrotesk-latin-ext.woff2 +0 -0
- package/public/assets/brand/SpaceGrotesk-latin.woff2 +0 -0
- package/public/assets/brand/madre-app-180.png +0 -0
- package/public/assets/brand/madre-app-192.png +0 -0
- package/public/assets/brand/madre-app-512.png +0 -0
- package/public/assets/brand/madre-app.svg +1 -1
- package/public/assets/brand/madre-favicon.svg +1 -1
- package/public/attribution.js +29 -19
- package/public/auto-open.js +102 -0
- package/public/brands.js +36 -19
- package/public/changes.js +63 -0
- package/public/en.js +1085 -102
- package/public/es.js +2940 -1656
- package/public/i18n.js +11 -0
- package/public/index.html +31 -27
- package/public/loader.js +322 -117
- package/public/macroverso.js +57 -355
- package/public/manual-content.js +69 -9
- package/public/manual.js +21 -6
- package/public/market-view.js +298 -84
- package/public/market.js +25 -2
- package/public/mcp-catalog.js +7 -2
- package/public/missions.js +169 -0
- package/public/news-scenes.js +292 -0
- package/public/nostromo-engine.js +935 -654
- package/public/notices.js +78 -0
- package/public/notifications.js +119 -0
- package/public/power.js +1 -1
- package/public/provider-marks.js +170 -0
- package/public/provider-pick.js +147 -0
- package/public/resay.js +4 -0
- package/public/review-ask.js +16 -13
- package/public/routing.js +29 -3
- package/public/salas-mac.css +467 -47
- package/public/salas-mac.html +8 -5
- package/public/salas-mac.js +805 -109
- package/public/salas.css +2 -2
- package/public/salas.html +2 -2
- package/public/salas.js +1 -1
- package/public/starters.js +128 -0
- package/public/styles.css +3036 -340
- package/public/subscription.js +303 -0
- package/public/terms-field.js +170 -0
- package/public/terms.js +117 -19
- package/public/tips.js +158 -0
- package/public/tour-chapters.js +88 -88
- package/public/tour.js +364 -46
- package/public/troubleshooting.js +313 -27
- package/public/welcome-scene.js +446 -0
- package/public/welcome.js +827 -282
- package/src/adapters/claude.mjs +2 -1
- package/src/adapters/codex.mjs +2 -1
- package/src/adapters/cursor.mjs +9 -6
- package/src/adapters/gemini-rest.mjs +236 -0
- package/src/adapters/gemini.mjs +13 -7
- package/src/adapters/grok.mjs +290 -0
- package/src/adapters/madre.mjs +71 -23
- package/src/adapters/opencode.mjs +15 -2
- package/src/adapters/process.mjs +14 -3
- package/src/adapters/steps.mjs +176 -0
- package/src/app-invite.mjs +90 -0
- package/src/auth-probe.mjs +32 -0
- package/src/billing-key.mjs +8 -0
- package/src/billing.mjs +317 -0
- package/src/bridge/policy.mjs +1 -1
- package/src/capabilities.mjs +46 -10
- package/src/chats.mjs +44 -2
- package/src/checkpoint.mjs +119 -1
- package/src/codex-route.mjs +113 -0
- package/src/commands.mjs +5 -2
- package/src/credentials.mjs +46 -8
- package/src/dataset.mjs +18 -7
- package/src/directives.mjs +1 -0
- package/src/event-store.mjs +25 -2
- package/src/extensions.mjs +5 -1
- package/src/ficha.mjs +158 -0
- package/src/files.mjs +36 -2
- package/src/image-studio.mjs +13 -3
- package/src/install-metrics.mjs +9 -3
- package/src/lease.mjs +6 -1
- package/src/looks.mjs +4 -1
- package/src/market-check.mjs +1 -1
- package/src/market-remote.mjs +135 -1
- package/src/mcp/image-server.mjs +59 -90
- package/src/mcp/memory-server.mjs +10 -0
- package/src/memory-tools.mjs +3 -0
- package/src/memory.mjs +29 -4
- package/src/models.mjs +21 -3
- package/src/modules/ahp.mjs +10 -4
- package/src/modules/bishop-exam.mjs +41 -12
- package/src/modules/bishop.mjs +2 -2
- package/src/modules/choices.mjs +12 -10
- package/src/modules/fetch-alone.mjs +7 -0
- package/src/modules/github.mjs +6 -2
- package/src/modules/helpers.mjs +23 -5
- package/src/modules/image-providers.mjs +281 -0
- package/src/modules/image-studio.mjs +106 -39
- package/src/modules/index.mjs +61 -12
- package/src/modules/intents-observe.mjs +3 -1
- package/src/modules/isolated.mjs +160 -0
- package/src/modules/ollama.mjs +35 -6
- package/src/modules/playwright.mjs +78 -20
- package/src/modules/reminders.mjs +42 -2
- package/src/modules/ripley.mjs +2 -1
- package/src/modules/run-alone.mjs +122 -0
- package/src/modules/runs.mjs +11 -8
- package/src/modules/sdk.mjs +10 -3
- package/src/notices-key.mjs +8 -0
- package/src/notices.mjs +185 -0
- package/src/ollama.mjs +57 -15
- package/src/opencode-health.mjs +1 -1
- package/src/outbound.mjs +124 -13
- package/src/quota-sources.mjs +148 -3
- package/src/review-ask.mjs +55 -31
- package/src/room/archivist.mjs +30 -5
- package/src/room/busy.mjs +16 -0
- package/src/room/changes.mjs +79 -0
- package/src/room/control.mjs +36 -6
- package/src/room/economy.mjs +1 -1
- package/src/room/guard.mjs +39 -2
- package/src/room/prompt.mjs +49 -6
- package/src/room/vectors.mjs +7 -1
- package/src/room.mjs +181 -49
- package/src/router.mjs +1 -1
- package/src/runs.mjs +39 -0
- package/src/runtime-detection.mjs +46 -6
- package/src/salas.mjs +181 -18
- package/src/server.mjs +1101 -118
- package/src/service.mjs +116 -0
- package/src/setup-trouble.mjs +20 -1
- package/src/setup.mjs +1 -1
- package/src/skill-check.mjs +269 -0
- package/src/skills-import.mjs +128 -0
- package/src/skills.mjs +502 -0
- package/src/terms.mjs +23 -5
- package/src/tour.mjs +31 -5
- package/src/updates.mjs +47 -4
- package/src/web-preview.mjs +181 -0
- package/src/whats-new.mjs +121 -1
- package/src/rumbo.mjs +0 -337
package/public/welcome.js
CHANGED
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
// SPDX-License-Identifier: BUSL-1.1
|
|
2
2
|
// MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
|
|
3
3
|
// THE WELCOME of 1.0.6 (2026-10-28, docs/private/BIENVENIDA-1.0.6.md): after `npx madre`, the
|
|
4
|
-
// person never needs the terminal again.
|
|
4
|
+
// person never needs the terminal again. Its steps leave MADRE ready — the agents, an AI on the
|
|
5
5
|
// computer when it can carry one, the memory's search and the first project — each adapted to where
|
|
6
6
|
// MADRE runs (src/environment.mjs: macOS, Linux, WSL, a virtual machine, SSH) and to what the
|
|
7
7
|
// computer can do (src/modules/local-models.mjs). Every step can be left for later and says what is
|
|
8
8
|
// lost; a failure is said in the same step, in plain words, with the way out.
|
|
9
9
|
//
|
|
10
|
+
// 1.1 (2026-11-08, docs/private/BIENVENIDA-1.1.md): set up like a new phone. Six steps, each with
|
|
11
|
+
// one question in everyday words and a picture of what it is doing (welcome-scene.js, the brand's
|
|
12
|
+
// pulse). What can be done alone is done alone: the computer is read during the greeting, the AIs
|
|
13
|
+
// already signed in on it come connected, the folders the person already opened with other tools
|
|
14
|
+
// come marked, and the local AI, its memory and the first word with it download while the person
|
|
15
|
+
// goes on. It ends inside a project with a first message written, chosen for what MADRE is for to
|
|
16
|
+
// this person (`profile`), not for a programmer.
|
|
17
|
+
//
|
|
10
18
|
// Where the person is lives in ~/.pulse/tour.json (src/tour.mjs, `welcome`), not in the browser:
|
|
11
19
|
// closing the page halfway brings them back to the same step, from any project or port.
|
|
12
20
|
//
|
|
13
21
|
// The host page hands in what only it can do: `agentsPanel(options)` and `projectPicker(options)`
|
|
14
|
-
// (Home's own), `mark(id, size)`, `
|
|
15
|
-
// `setLanguage(code)`, `agentState(agent, answer)`, `
|
|
16
|
-
//
|
|
22
|
+
// (Home's own), `mark(id, size)`, `projects()`, `openProject(room, { draft })`,
|
|
23
|
+
// `setLanguage(code)`, `agentState(agent, answer)`, `saved(welcome)`, `refresh()` (Home's projects
|
|
24
|
+
// read again) and `closed()`.
|
|
17
25
|
|
|
18
26
|
import { t, language } from './i18n.js';
|
|
19
27
|
import { platformOf, remedyKey } from './remedy.js';
|
|
20
|
-
import { MADRE_LOGO as BRAND_LOGO, playOpening } from './loader.js';
|
|
28
|
+
import { MADRE_LOGO as BRAND_LOGO, openingPlayed, playOpening } from './loader.js';
|
|
21
29
|
import { trazo } from './icons.js';
|
|
30
|
+
import { createScene } from './welcome-scene.js';
|
|
31
|
+
import { startersFor } from './starters.js';
|
|
22
32
|
|
|
23
33
|
const el = (tag, className = null, text = null) => {
|
|
24
34
|
const node = document.createElement(tag);
|
|
@@ -45,11 +55,115 @@ const number = (value) => new Intl.NumberFormat(language(), { maximumFractionDig
|
|
|
45
55
|
|
|
46
56
|
// The project comes right after the agents (2026-11-01): 90 of 147 copies never opened one, and
|
|
47
57
|
// the AI on the computer and the memory, heavy and optional, stood in front of it.
|
|
48
|
-
export const WELCOME_STEPS = ['hello', '
|
|
49
|
-
const stepOf = (id) => WELCOME_STEPS.indexOf(id) + 1;
|
|
58
|
+
export const WELCOME_STEPS = ['hello', 'use', 'agents', 'project', 'ai', 'ready'];
|
|
50
59
|
const STEP_NAMES = {
|
|
51
|
-
hello: () => t('Hello'),
|
|
52
|
-
|
|
60
|
+
hello: () => t('Hello'), use: () => t('What you want it for'), agents: () => t('Your AIs'), project: () => t('Your projects'),
|
|
61
|
+
ai: () => t('AI on your computer'), ready: () => t('Your first message'),
|
|
62
|
+
};
|
|
63
|
+
// What MADRE is for to this person (src/tour.mjs, WELCOME_PROFILES): the examples follow it. Eight
|
|
64
|
+
// since 2026-11-10 (the author: «more examples, with MADRE's icons»), each with its Trazo drawing.
|
|
65
|
+
const PROFILES = [
|
|
66
|
+
{ id: 'business', icon: 'market', title: () => t('My business'), sub: () => t('What I sell, my customers and how they find me.') },
|
|
67
|
+
{ id: 'social', icon: 'image', title: () => t('Social media and content'), sub: () => t('Posts, captions, ads and product photos.') },
|
|
68
|
+
{ id: 'numbers', icon: 'bars', title: () => t('Accounts and invoices'), sub: () => t('Expenses, invoices and what the accountant asks for.') },
|
|
69
|
+
{ id: 'office', icon: 'inbox', title: () => t('My office work'), sub: () => t('Emails, reports, presentations and meetings.') },
|
|
70
|
+
{ id: 'study', icon: 'book', title: () => t('Studying and learning'), sub: () => t('Notes, homework and topics I want to understand.') },
|
|
71
|
+
{ id: 'notes', icon: 'note', title: () => t('Writing and getting organised'), sub: () => t('Loose ideas, to-dos and long texts.') },
|
|
72
|
+
{ id: 'code', icon: 'code', title: () => t('Programming'), sub: () => t('Websites, apps and the repository I always use.') },
|
|
73
|
+
{ id: 'curious', icon: 'spark', title: () => t('I just want to see what it does'), sub: () => t('Show me first, then I decide.') },
|
|
74
|
+
];
|
|
75
|
+
// A first message for each, written as a person would ask it, and what to say first to @madre.
|
|
76
|
+
const IDEAS = {
|
|
77
|
+
business: () => [t('Write the description of my 5 best-selling products'), t('Make me a simple page with my opening hours and my WhatsApp'), t('Answer the questions my customers always ask me')],
|
|
78
|
+
social: () => [t('Write five posts for this week about what I sell'), t('Give me ideas for a short video that shows my product'), t('Write the description of my Instagram profile')],
|
|
79
|
+
numbers: () => [t('Sort these invoices by month in a table'), t('Check this sheet and tell me what does not add up'), t('Make the expense summary I send to my accountant')],
|
|
80
|
+
office: () => [t('Turn these notes into a clear report'), t('Write a polite email asking for more time'), t('Make me the outline of a ten-minute presentation')],
|
|
81
|
+
study: () => [t('Explain this topic to me as if I were fifteen'), t('Make me ten questions to check that I understood it'), t('Turn this document into study notes')],
|
|
82
|
+
code: () => [t('Explain this project to me as if it were my first day'), t('Find out why it does not start'), t('Propose three small fixes and make them in a separate branch')],
|
|
83
|
+
notes: () => [t('Group my loose notes by topic'), t('Plan my week with what I have pending'), t('Remind me on Friday to check this')],
|
|
84
|
+
curious: () => [t('Change the colours of the page'), t('Add a task to the list'), t('Tell me what is in this folder')],
|
|
85
|
+
none: () => [t('Tell me what is in this folder'), t('Sum up this project for me in five lines'), t('What would you improve first here, and why?')],
|
|
86
|
+
};
|
|
87
|
+
const SUGGESTIONS = {
|
|
88
|
+
business: () => [t('Name an end-of-month promotion'), t('Write to a customer who has not paid, without sounding rude')],
|
|
89
|
+
social: () => [t('Give me three ideas for posts this week'), t('Write a short, friendly caption for a photo of my product')],
|
|
90
|
+
numbers: () => [t('How do I sort my invoices so I never lose one?'), t('Make the list of what I ask my accountant every month')],
|
|
91
|
+
office: () => [t('Help me write a polite email to say no'), t('Give me an outline for a short presentation')],
|
|
92
|
+
study: () => [t('Explain photosynthesis in three lines'), t('Give me a trick to remember what I study')],
|
|
93
|
+
code: () => [t('Explain what a git branch is in two lines'), t('Give me a name for a booking app')],
|
|
94
|
+
notes: () => [t('Make me a list to organise my week'), t('Give me an idea to start a long text')],
|
|
95
|
+
curious: () => [t('What can you do for me?'), t('Tell me something fun in one line')],
|
|
96
|
+
};
|
|
97
|
+
// WHAT CAN I MAKE? (2026-11-11, the author: «give them many ideas of what they can create with MADRE,
|
|
98
|
+
// in clear language»): when the person starts a project from nothing, ideas of what to make, three for
|
|
99
|
+
// each use, theirs first. Picking one names the folder and leaves its first message ready for the last
|
|
100
|
+
// step, so the project is born already knowing what it is for. [icon, what it is, one line, message]
|
|
101
|
+
const CREATE_IDEAS = {
|
|
102
|
+
business: () => [
|
|
103
|
+
['globe', t('A page for my business'), t('Opening hours, where to find you and a WhatsApp button.'), t('Make me a one-page website for my business with my opening hours, where to find me and a WhatsApp button. Ask me first what you need to know.')],
|
|
104
|
+
['market', t('A product catalogue'), t('Names, prices and descriptions in one table.'), t('Make me a product catalogue with name, price and description, in a table I can fill in and print.')],
|
|
105
|
+
['chat', t('Answers for my customers'), t('What they always ask you, ready to copy.'), t('Write the answers to the questions my customers always ask me, short and friendly, ready to paste into WhatsApp.')],
|
|
106
|
+
],
|
|
107
|
+
social: () => [
|
|
108
|
+
['calendar', t('A posting calendar'), t('A month of ideas, with the text for each day.'), t('Make me a posting calendar for this month: one idea a day with its caption and hashtags.')],
|
|
109
|
+
['image', t('Short video scripts'), t('Reels and TikToks of 30 seconds, shot by shot.'), t('Write three scripts for 30-second videos about what I do, shot by shot.')],
|
|
110
|
+
['appearance', t('My brand kit'), t('Your tone, your colours and phrases that sound like you.'), t('Help me write my brand kit: how I speak, my colours and five phrases that sound like me.')],
|
|
111
|
+
],
|
|
112
|
+
numbers: () => [
|
|
113
|
+
['bars', t('An expense tracker'), t('A sheet that adds up by month and category on its own.'), t('Make me an expense sheet that adds up by month and category, and explain how to fill it in.')],
|
|
114
|
+
['inbox', t('My invoices in order'), t('One folder per month and a table so none gets lost.'), t('Help me put my invoices in order: one folder per month and a table with the date, customer, amount and whether it is paid.')],
|
|
115
|
+
['trending', t('My monthly budget'), t('What comes in, what goes out and what is left.'), t('Make me a monthly budget: what comes in, what goes out and what is left, with a simple chart.')],
|
|
116
|
+
],
|
|
117
|
+
office: () => [
|
|
118
|
+
['compose', t('Email templates'), t('The emails you write most, ready to use.'), t('Write templates for the emails I send most: following up, a reminder, saying no politely and saying thank you.')],
|
|
119
|
+
['note', t('A weekly report'), t('A format you fill in in five minutes.'), t('Make me a weekly report I can fill in in five minutes: what got done, what is pending and what I need.')],
|
|
120
|
+
['card', t('A presentation'), t('Clear slides out of your ideas.'), t('Help me make a presentation: ask me the topic and who it is for, and propose ten slides.')],
|
|
121
|
+
],
|
|
122
|
+
study: () => [
|
|
123
|
+
['book', t('Notes for a subject'), t('Summaries and outlines, topic by topic.'), t('Help me make study notes for a subject: ask me which one and put it in order topic by topic.')],
|
|
124
|
+
['checkbox', t('A practice exam'), t('Questions to see whether you understood it.'), t('Make me a practice exam of fifteen questions, with the answers at the end, about a topic I will tell you.')],
|
|
125
|
+
['calendar', t('A study plan'), t('What to review each day until the exam.'), t('Make me a study plan up to the day of my exam: what to review each day and for how long.')],
|
|
126
|
+
],
|
|
127
|
+
notes: () => [
|
|
128
|
+
['note', t('A home for my ideas'), t('What occurs to you, sorted by topic.'), t('Set up a place for my ideas: one file per topic and an index that says what is in each one.')],
|
|
129
|
+
['list', t('My week, planned'), t('Your to-dos spread over the days.'), t('Help me plan my week: ask me what I have pending and spread it over the days.')],
|
|
130
|
+
['pencil', t('A long text'), t('A story, an essay or a book, chapter by chapter.'), t('I want to write a long text. Ask me what it is about and propose an outline by chapters.')],
|
|
131
|
+
],
|
|
132
|
+
code: () => [
|
|
133
|
+
['code', t('A web app'), t('From scratch, with a plan in steps before any code.'), t('I want to build a web app. Ask me what it should do and propose a plan in steps before writing code.')],
|
|
134
|
+
['globe', t('A personal page'), t('Your portfolio on a single page.'), t('Make me a one-page portfolio with who I am, what I do and how to contact me.')],
|
|
135
|
+
['running', t('A script that saves me time'), t('Something that does a repetitive task for you.'), t('Help me write a small script that does a repetitive task for me. Ask me first which one.')],
|
|
136
|
+
],
|
|
137
|
+
curious: () => [
|
|
138
|
+
['spark', t('A simple game'), t('A game in the browser, to watch the AIs work.'), t('Make me a simple game that runs in the browser, like guessing a number, and tell me how to open it.')],
|
|
139
|
+
['checkbox', t('A shopping list'), t('A page for the supermarket that remembers itself.'), t('Make me a shopping list page where I can add and tick off things, and that remembers them.')],
|
|
140
|
+
['book', t('A recipe book'), t('Your favourite recipes, with ingredients and steps.'), t('Make me a recipe book page: I will tell you my favourite recipes and you put them in order with ingredients and steps.')],
|
|
141
|
+
],
|
|
142
|
+
};
|
|
143
|
+
// The order the uses are offered in when the person marked none.
|
|
144
|
+
const CREATE_ORDER = ['business', 'social', 'office', 'numbers', 'study', 'notes', 'curious', 'code'];
|
|
145
|
+
// Ideas shown at first: two rows of three; the rest behind «More ideas».
|
|
146
|
+
const CREATE_SHOWN = 6;
|
|
147
|
+
// The folder's name from what the idea makes, in the person's language, without its article: «Una
|
|
148
|
+
// página para mi negocio» → «pagina-para-mi-negocio».
|
|
149
|
+
const slugOf = (words) => String(words).normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').replace(/^(?:una?|el|la|los|las|an?|the)-/, '').slice(0, 48);
|
|
150
|
+
// The practice project (src/salas.mjs, createSampleProject) is a page with a to-do list: the messages
|
|
151
|
+
// for it say what each one will do, so the person knows what to look at. [icon, message, what happens]
|
|
152
|
+
const PRACTICE_MESSAGES = () => [
|
|
153
|
+
['appearance', t('Change the colours of my task list to green and white'), t('You will see the page change. If you do not like it, Undo puts it back.')],
|
|
154
|
+
['add', t('Add a button that clears the finished tasks'), t('An AI edits the page and tells you what it changed.')],
|
|
155
|
+
['database', t('Make the tasks stay when I close the page'), t('Close it and open it again to check that it remembers them.')],
|
|
156
|
+
['help', t('Explain this project to me in simple words'), t('A first look, without changing anything.')],
|
|
157
|
+
];
|
|
158
|
+
|
|
159
|
+
// «Do you already pay for an AI?»: each agent by the plan people know it by.
|
|
160
|
+
const PLANS = {
|
|
161
|
+
codex: () => t('You pay for ChatGPT Plus or Pro: here it is called Codex, ChatGPT working in your files.'),
|
|
162
|
+
claude: () => t('You pay for Claude Pro or Max: you sign in with the same account as on its website.'),
|
|
163
|
+
grok: () => t('You pay for SuperGrok: you sign in with your grok.com account.'),
|
|
164
|
+
cursor: () => t('You pay for Cursor: you sign in with your Cursor account.'),
|
|
165
|
+
gemini: () => t('With your company\'s Google account, or a free key from Google AI Studio.'),
|
|
166
|
+
opencode: () => t('You do not pay for any? OpenCode comes with free models, with a daily limit.'),
|
|
53
167
|
};
|
|
54
168
|
// Ollama's own installer for Linux, shown to copy where it asks for the administrator's password: MADRE
|
|
55
169
|
// never asks for a password nor keeps one (src/modules/ollama.mjs, NEEDS_PASSWORD).
|
|
@@ -66,16 +180,24 @@ const TROUBLE = {
|
|
|
66
180
|
network: () => t('It could not download: there is no internet connection, or something on this network blocked it. Check your connection and try again.'),
|
|
67
181
|
disk: () => t('There is not enough free space on this computer. Free up some space or choose a smaller model.'),
|
|
68
182
|
permission: () => t('This computer did not let MADRE install it. Copy the line below into a terminal, once.'),
|
|
183
|
+
dns: () => t('This computer could not find the address it downloads from (DNS). In WSL, close it from Windows and open it again; with a VPN on, try without it.'),
|
|
184
|
+
'ollama-closed': () => t('Ollama closed the connection while downloading the model. Check that Ollama is still running and try again; what already arrived stays.'),
|
|
185
|
+
registry: () => t('Ollama\'s model server did not answer (an error on its side). It is not your connection: try again in a few minutes; what already arrived stays.'),
|
|
69
186
|
timeout: () => t('It took too long and was stopped. Try again.'),
|
|
70
187
|
};
|
|
71
188
|
|
|
72
189
|
// The card of Diagnostics that explains each of those, with its steps for this system (remedy.js).
|
|
73
|
-
const TROUBLE_CARD = { network: 'install-offline', disk: 'disk-full', permission: 'install-needs-admin', timeout: 'install-offline', 'npm-missing': 'node-missing' };
|
|
190
|
+
const TROUBLE_CARD = { network: 'install-offline', dns: 'name-lookup', disk: 'disk-full', permission: 'install-needs-admin', timeout: 'install-offline', 'npm-missing': 'node-missing', 'ollama-closed': 'model-download', registry: 'model-download' };
|
|
74
191
|
|
|
75
192
|
// Ollama prints each piece it downloads as «pulling <digest> · 45%» (src/ollama.mjs, pullModel). The
|
|
76
193
|
// first piece is the model itself, by far the heaviest: its share is the download's.
|
|
77
194
|
const PULL_LINE = /^pulling ([0-9a-f]{6,})\b.*?(\d{1,3})%\s*$/;
|
|
78
195
|
|
|
196
|
+
// The tools other than MADRE a folder may come from (src/salas.mjs, TOOL_NAMES): their own names.
|
|
197
|
+
const TOOL_NAMES = { claude: 'Claude Code', codex: 'Codex', gemini: 'Gemini', cursor: 'Cursor', vscode: 'VS Code' };
|
|
198
|
+
// How many of the folders other tools know come marked: the newest, the ones the person works in.
|
|
199
|
+
const MARKED = 5;
|
|
200
|
+
|
|
79
201
|
// THE OPENING plays before the first step (loader.js, shared with the projects).
|
|
80
202
|
|
|
81
203
|
let current = null;
|
|
@@ -91,29 +213,41 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
91
213
|
const main = el('section', 'wl-main');
|
|
92
214
|
const content = el('div', 'wl-content');
|
|
93
215
|
const actions = el('div', 'wl-actions');
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
main.append(
|
|
216
|
+
// No close key (1.1): the welcome is left through its own keys, «Skip for now» on a step or «Go to
|
|
217
|
+
// Home» at the end, so nobody leaves it halfway by a corner without knowing what was left undone.
|
|
218
|
+
main.append(content, actions);
|
|
219
|
+
dialog.addEventListener('cancel', (event) => event.preventDefault());
|
|
97
220
|
shell.append(rail, main);
|
|
98
221
|
dialog.append(shell);
|
|
99
222
|
document.body.append(dialog);
|
|
223
|
+
// One picture for the whole welcome, kept across the steps: it changes shape, it is never rebuilt.
|
|
224
|
+
const scene = createScene();
|
|
100
225
|
|
|
101
226
|
// Everything the steps decide on, read once when it opens and again when it changes.
|
|
102
227
|
const s = {
|
|
103
228
|
step: 0,
|
|
104
|
-
progress: { at: null, done: [], skipped: [], finished: null },
|
|
229
|
+
progress: { at: null, done: [], skipped: [], finished: null, profile: [] },
|
|
105
230
|
env: null, hardware: null, geminiKey: false, memory: null,
|
|
106
231
|
ollama: null, recommended: null,
|
|
107
|
-
|
|
232
|
+
scanned: false, // the greeting has read the computer
|
|
233
|
+
profile: new Set(), // what MADRE is for to this person
|
|
234
|
+
choice: null, // the AI step: here · other · windows · remote · skip
|
|
108
235
|
model: null, // the model chosen for this computer (a rung of the Qwen2.5 ladder)
|
|
109
236
|
pulls: new Map(), // model → { pct, first, phase, error, trouble, running }
|
|
237
|
+
queue: [], // what downloads after the one running: Ollama takes one at a time
|
|
110
238
|
install: null, // Ollama's own install, while it runs: { lines, error, trouble, running }
|
|
111
|
-
tried: null, // «try it»: { said, answer, error, busy }
|
|
112
239
|
address: null, // the AI of another computer: { host, busy, error, ok }
|
|
113
|
-
|
|
240
|
+
talk: null, // the talk with @madre
|
|
114
241
|
agents: null, // /api/settings, as the agents panel last read it
|
|
115
242
|
ready: 0, // agents connected
|
|
243
|
+
found: null, // the folders that look like projects, and the ones other tools know
|
|
244
|
+
picked: null, // the ones marked to bring
|
|
245
|
+
way: null, // the other way in open: «new» · «browse»
|
|
246
|
+
allFound: false, // every found folder shown, not only the first rows
|
|
116
247
|
added: [], // the projects added while the welcome was open
|
|
248
|
+
idea: null, // what the new project will make: { name, message }, from «What can I make?»
|
|
249
|
+
allIdeas: false, // every idea shown, not only the first rows
|
|
250
|
+
intents: new Map(), // a project made here → the first message its idea left ready
|
|
117
251
|
};
|
|
118
252
|
let leave = null; // what the step on screen stops when another one comes
|
|
119
253
|
let pollTimer = 0;
|
|
@@ -154,17 +288,22 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
154
288
|
if (!best) return 'no';
|
|
155
289
|
return fit().accelerated ? 'yes' : 'slow';
|
|
156
290
|
};
|
|
157
|
-
// The model offered first: the one MADRE recommends here, or the one the person
|
|
291
|
+
// The model offered first: the one MADRE recommends here, or the one the person chose instead.
|
|
158
292
|
const offered = () => s.model ?? fit()?.recommended?.run ?? null;
|
|
293
|
+
const fitting = () => (fit()?.models ?? []).filter((model) => model.run !== 'no');
|
|
159
294
|
const smaller = () => {
|
|
160
|
-
const rungs = (
|
|
295
|
+
const rungs = fitting();
|
|
161
296
|
const now = offered();
|
|
162
297
|
const at = rungs.findIndex((model) => model.id === now?.id);
|
|
163
298
|
return at > 0 ? rungs[at - 1] : null;
|
|
164
299
|
};
|
|
165
300
|
const roomFor = (gb) => (s.env?.disk?.freeGb == null ? true : s.env.disk.freeGb >= gb + 2);
|
|
301
|
+
const aiReady = () => Boolean(s.ollama?.running && chatModels().length > 0);
|
|
302
|
+
const pulling = () => [...s.pulls.entries()].find(([, pull]) => pull.running) ?? null;
|
|
303
|
+
const profileOf = () => [...s.profile][0] ?? null;
|
|
304
|
+
const who = () => (s.env?.os === 'macos' ? t('Your Mac') : t('Your computer'));
|
|
166
305
|
|
|
167
|
-
// ---- The rail: the
|
|
306
|
+
// ---- The rail: the steps, where the person is, what is done and what was left for later.
|
|
168
307
|
// The logo draws itself in once, when the welcome opens, and stays in the rail from then on: the
|
|
169
308
|
// steps are repainted under it, never the logo, or its drawing started over with every step.
|
|
170
309
|
const brand = el('div', 'wl-brand');
|
|
@@ -188,12 +327,16 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
188
327
|
item.append(key);
|
|
189
328
|
list.append(item);
|
|
190
329
|
});
|
|
191
|
-
railBody.replaceChildren(list, el('p', 'wl-rail-foot', t('
|
|
330
|
+
railBody.replaceChildren(list, el('p', 'wl-rail-foot', t('It takes about three minutes. If something takes a while to download, go on with the steps: it finishes on its own.')));
|
|
192
331
|
}
|
|
193
332
|
|
|
194
333
|
// ---- The parts every step is made of.
|
|
195
|
-
|
|
196
|
-
|
|
334
|
+
// The picture first, then the question and what it means. `caption` says what is happening now.
|
|
335
|
+
const head = (title, lead, picture = null, caption = null) => {
|
|
336
|
+
const nodes = [];
|
|
337
|
+
if (picture) { scene.show(picture.id, picture.data); nodes.push(scene.node); }
|
|
338
|
+
if (caption !== null) scene.say(caption);
|
|
339
|
+
nodes.push(el('h2', 'wl-title', title));
|
|
197
340
|
if (lead) nodes.push(el('p', 'wl-lead', lead));
|
|
198
341
|
return nodes;
|
|
199
342
|
};
|
|
@@ -202,6 +345,22 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
202
345
|
box.append(...children.filter(Boolean).map((child) => (typeof child === 'string' ? el('p', null, child) : child)));
|
|
203
346
|
return box;
|
|
204
347
|
};
|
|
348
|
+
// What just unfolded is brought into sight with a gentle scroll (2026-11-10, the author: «guide
|
|
349
|
+
// them down as more shows»): only as far as its end, and never past its top.
|
|
350
|
+
const reveal = (node) => requestAnimationFrame(() => {
|
|
351
|
+
if (!node?.isConnected || !content.contains(node)) return;
|
|
352
|
+
const box = content.getBoundingClientRect();
|
|
353
|
+
const own = node.getBoundingClientRect();
|
|
354
|
+
const by = Math.min(own.bottom - box.bottom + 18, own.top - box.top - 12);
|
|
355
|
+
if (by > 4) content.scrollBy({ top: by, behavior: matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth' });
|
|
356
|
+
});
|
|
357
|
+
// A word MADRE uses, explained where it first appears, folded: «what is this?».
|
|
358
|
+
const what = (question, answer) => {
|
|
359
|
+
const box = el('details', 'wl-what');
|
|
360
|
+
box.append(el('summary', null, question), el('p', null, answer));
|
|
361
|
+
box.addEventListener('toggle', () => { if (box.open) reveal(box); });
|
|
362
|
+
return box;
|
|
363
|
+
};
|
|
205
364
|
// «See how to fix it», under what went wrong: the card of Diagnostics for it, for this system.
|
|
206
365
|
const fix = (id) => (id ? remedyKey(id, { platform: platformOf(s.env) }) : null);
|
|
207
366
|
const chip = (tone, words) => { const node = el('span', `wl-chip${tone ? ` ${tone}` : ''}`); node.append(el('i'), el('span', null, words)); return node; };
|
|
@@ -246,46 +405,18 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
246
405
|
actions.replaceChildren(...parts);
|
|
247
406
|
return primary;
|
|
248
407
|
};
|
|
408
|
+
const ago = (iso) => {
|
|
409
|
+
if (!iso) return null;
|
|
410
|
+
const days = Math.round((Date.parse(iso) - Date.now()) / 86400000);
|
|
411
|
+
const say = new Intl.RelativeTimeFormat(language(), { numeric: 'auto' });
|
|
412
|
+
if (days > -1) return say.format(0, 'day');
|
|
413
|
+
if (days > -14) return say.format(days, 'day');
|
|
414
|
+
if (days > -60) return say.format(Math.round(days / 7), 'week');
|
|
415
|
+
return say.format(Math.round(days / 30), 'month');
|
|
416
|
+
};
|
|
417
|
+
const homeWord = (path) => String(path ?? '').replace(/^\/(Users|home)\/[^/]+/, '~');
|
|
249
418
|
|
|
250
|
-
// ---- 1 · HELLO: the language, what
|
|
251
|
-
function hello() {
|
|
252
|
-
const seg = el('div', 'wl-seg');
|
|
253
|
-
seg.setAttribute('role', 'radiogroup');
|
|
254
|
-
seg.setAttribute('aria-label', 'Idioma · Language');
|
|
255
|
-
for (const [code, words] of [['es', 'Español'], ['en', 'English']]) {
|
|
256
|
-
const option = button(null, words, async () => {
|
|
257
|
-
if (code === language()) return;
|
|
258
|
-
await host.setLanguage?.(code);
|
|
259
|
-
dialog.setAttribute('aria-label', t('Welcome to MADRE'));
|
|
260
|
-
paintRail();
|
|
261
|
-
show();
|
|
262
|
-
});
|
|
263
|
-
option.setAttribute('role', 'radio');
|
|
264
|
-
option.setAttribute('aria-checked', String(code === language()));
|
|
265
|
-
seg.append(option);
|
|
266
|
-
}
|
|
267
|
-
const lang = el('div', 'wl-row');
|
|
268
|
-
lang.append(el('span', 'wl-muted', t('Language')), seg);
|
|
269
|
-
const list = el('div', 'wl-card wl-checks');
|
|
270
|
-
for (const [title, sub] of [
|
|
271
|
-
[t('Your agents'), t('The AIs that work in your projects (Claude, Codex, Gemini…). We install and connect them here.')],
|
|
272
|
-
[t('Your first project'), t('A folder you work in. It is ready when we finish.')],
|
|
273
|
-
[t('AI on your computer'), t('If your computer can carry it, a free and private AI that works without internet.')],
|
|
274
|
-
[t('Memory'), t('So MADRE finds what it remembers even when you ask in other words.')],
|
|
275
|
-
]) {
|
|
276
|
-
const row = el('div', 'wl-check');
|
|
277
|
-
const tick = el('span', 'wl-tick');
|
|
278
|
-
tick.innerHTML = TICK; // trusted: our own SVG string
|
|
279
|
-
const words = el('div');
|
|
280
|
-
words.append(el('b', null, title), el('small', null, sub));
|
|
281
|
-
row.append(tick, words);
|
|
282
|
-
list.append(row);
|
|
283
|
-
}
|
|
284
|
-
content.replaceChildren(...head(t('Hi. Let\'s get MADRE ready.'), t('It takes about 10 minutes, plus the download if you choose an AI on your computer. You will not need the terminal.')), lang, list);
|
|
285
|
-
footer({ next: t('Start'), back: false });
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// ---- 2 · YOUR COMPUTER: what MADRE found, in plain words, and what it means for the next steps.
|
|
419
|
+
// ---- 1 · HELLO: the language, what MADRE is, and the computer read while the person reads.
|
|
289
420
|
function placeWords() {
|
|
290
421
|
const env = s.env ?? {};
|
|
291
422
|
if (env.place === 'ssh') return t('You\'re connected from another computer (SSH)');
|
|
@@ -300,22 +431,51 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
300
431
|
if (hw.accelerator === 'nvidia') return `${hw.gpus?.[0]?.name ?? 'NVIDIA'} · ${number(hw.acceleratorGb)} GB`;
|
|
301
432
|
return t('None the AI can use');
|
|
302
433
|
}
|
|
303
|
-
|
|
434
|
+
// What the computer is, folded: the person can look, nothing to decide.
|
|
435
|
+
function machineFacts() {
|
|
304
436
|
const env = s.env ?? {};
|
|
305
437
|
const hw = facts();
|
|
306
438
|
const grid = el('div', 'wl-facts');
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
fact
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
439
|
+
// Each thing found says what it means for the person, not only what it is (2026-11-13: a list of
|
|
440
|
+
// parts read as a technician's report).
|
|
441
|
+
const fact = (label, value, means = null) => {
|
|
442
|
+
if (!value) return;
|
|
443
|
+
const box = el('div', 'wl-fact');
|
|
444
|
+
box.append(el('small', null, label), el('b', null, value));
|
|
445
|
+
if (means) box.append(el('span', null, means));
|
|
446
|
+
grid.append(box);
|
|
447
|
+
};
|
|
448
|
+
fact(t('Where MADRE runs'), placeWords(), t('Your files and your chats stay here.'));
|
|
449
|
+
fact(t('System'), env.name ?? (env.os === 'macos' ? 'macOS' : env.os === 'linux' ? 'Linux' : env.os ?? null), t('So MADRE downloads what matches your computer.'));
|
|
450
|
+
fact(t('Processor'), hw.chip ?? (hw.cores ? t('{n} cores', { n: hw.cores }) : null), t('It does the work of your own AI.'));
|
|
451
|
+
fact(t('Memory'), hw.memoryGb ? `${number(hw.memoryGb)} GB` : null, t('The more memory, the bigger and smarter the AI that fits.'));
|
|
452
|
+
fact(t('Graphics card'), graphicsWords(), hw.accelerator === 'apple' ? null : t('With one, your own AI answers faster.'));
|
|
453
|
+
fact(t('Free space'), env.disk ? t('{n} GB free', { n: number(env.disk.freeGb) }) : null, t('An AI of your own takes between 1 and 20 GB.'));
|
|
454
|
+
// A button that reads as one (2026-11-14, the author: «hacer más clickeable»): the chip, the words
|
|
455
|
+
// and an arrow that turns when it opens, on a soft pill instead of grey small print.
|
|
456
|
+
const checkedSummary = () => {
|
|
457
|
+
const summary = el('summary', 'wl-more-key');
|
|
458
|
+
const chip = el('span', 'wl-more-icon');
|
|
459
|
+
chip.innerHTML = trazo('chip'); // trusted: our own SVG string
|
|
460
|
+
const arrow = el('span', 'wl-more-arrow');
|
|
461
|
+
arrow.innerHTML = trazo('chevron'); // trusted: our own SVG string
|
|
462
|
+
summary.append(chip, el('span', null, t('What MADRE checked on your computer')), arrow);
|
|
463
|
+
return summary;
|
|
464
|
+
};
|
|
465
|
+
const fold = el('details', 'wl-more');
|
|
466
|
+
fold.addEventListener('toggle', () => { if (fold.open) reveal(fold); });
|
|
467
|
+
fold.append(
|
|
468
|
+
checkedSummary(),
|
|
469
|
+
el('p', 'wl-facts-lead', t('MADRE can have an AI of its own that works without internet. To know which one fits your computer, it checked this:')),
|
|
470
|
+
grid,
|
|
471
|
+
el('p', 'wl-tiny', t('None of this leaves your computer.')),
|
|
472
|
+
);
|
|
473
|
+
return fold;
|
|
474
|
+
}
|
|
475
|
+
// What only some places need to know, said in the greeting so nothing surprises later.
|
|
476
|
+
function placeNotes() {
|
|
477
|
+
const env = s.env ?? {};
|
|
314
478
|
const notes = [];
|
|
315
|
-
const carry = canCarry();
|
|
316
|
-
if (carry === 'yes') notes.push(note('ok', t('Your computer can run its own AI. We recommend a model in step {n}.', { n: stepOf('ai') })));
|
|
317
|
-
else if (carry === 'slow') notes.push(note('warn', t('Your computer can run a small AI, but slowly: it has no graphics card the AI can use.')));
|
|
318
|
-
else notes.push(note('warn', t('This computer does not have enough memory for an AI of its own. MADRE works just the same with your agents.')));
|
|
319
479
|
if (env.place === 'wsl') notes.push(note('', t('MADRE runs here on Linux, inside Windows (WSL). Your Windows browser opens it directly.')));
|
|
320
480
|
// On Windows itself (docs/WINDOWS.md, D-001): from 1.1.0 MADRE runs inside WSL2, not on Windows directly.
|
|
321
481
|
if (env.os === 'windows') notes.push(note('warn', t('On Windows, MADRE runs inside WSL2, the Linux that comes with Windows 10 and 11. It does not run on Windows directly.'), fix('windows-use-wsl')));
|
|
@@ -323,20 +483,98 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
323
483
|
if (env.vm && env.vm !== 'macOS') notes.push(note('warn', t('MADRE runs in a virtual machine: an AI here runs slower than on the computer itself. If that computer runs Windows, MADRE works better in WSL.')));
|
|
324
484
|
if (env.place === 'ssh') notes.push(note('', t('You\'re connected from another computer. Some agents connect with a code instead of opening a page; each one says so.'), fix('ssh-tunnel')));
|
|
325
485
|
if (env.place === 'container') notes.push(note('', t('MADRE runs inside a container: what it installs stays in that container.')));
|
|
326
|
-
if (env.disk && env.disk.freeGb < 10) notes.push(note('warn', t('Only {n} GB free.
|
|
327
|
-
|
|
328
|
-
|
|
486
|
+
if (env.disk && env.disk.freeGb < 10) notes.push(note('warn', t('Only {n} GB free. Your AIs fit, but an AI of its own needs more room: free some up before you get to it.', { n: number(env.disk.freeGb) })));
|
|
487
|
+
return notes;
|
|
488
|
+
}
|
|
489
|
+
function helloCaption() {
|
|
490
|
+
if (!s.scanned) return t('Seeing how powerful your computer is…');
|
|
491
|
+
const gb = number(facts().memoryGb ?? 0);
|
|
492
|
+
const carry = canCarry();
|
|
493
|
+
if (carry === 'yes') return t('{who} has {gb} GB of memory: an AI of its own fits without trouble.', { who: who(), gb });
|
|
494
|
+
if (carry === 'slow') return t('{who} has {gb} GB and no graphics card: a small AI fits, though it will answer slowly.', { who: who(), gb });
|
|
495
|
+
return t('{who} has {gb} GB: not enough for an AI of its own. Your AIs do the work just the same.', { who: who(), gb });
|
|
496
|
+
}
|
|
497
|
+
function hello() {
|
|
498
|
+
const seg = el('div', 'wl-seg');
|
|
499
|
+
seg.setAttribute('role', 'radiogroup');
|
|
500
|
+
seg.setAttribute('aria-label', 'Idioma · Language');
|
|
501
|
+
for (const [code, words] of [['es', 'Español'], ['en', 'English']]) {
|
|
502
|
+
const option = button(null, words, async () => {
|
|
503
|
+
if (code === language()) return;
|
|
504
|
+
await host.setLanguage?.(code);
|
|
505
|
+
dialog.setAttribute('aria-label', t('Welcome to MADRE'));
|
|
506
|
+
paintRail();
|
|
507
|
+
show();
|
|
508
|
+
});
|
|
509
|
+
option.setAttribute('role', 'radio');
|
|
510
|
+
option.setAttribute('aria-checked', String(code === language()));
|
|
511
|
+
seg.append(option);
|
|
512
|
+
}
|
|
513
|
+
const picture = { id: 'hello', data: () => ({ scanned: s.scanned }) };
|
|
514
|
+
const greeting = el('div', 'wl-hello');
|
|
515
|
+
greeting.append(...head(t('Hello'), t('MADRE puts AIs to work in your folders. You ask for things the way you would ask someone on your team, and MADRE remembers what gets decided.'), picture, helloCaption()), seg);
|
|
516
|
+
content.replaceChildren(greeting, machineFacts(), ...placeNotes());
|
|
517
|
+
footer({ next: t('Start'), back: false });
|
|
518
|
+
// The computer was read when the welcome opened: the picture takes a moment to say so, as a
|
|
519
|
+
// person would look before answering.
|
|
520
|
+
if (!s.scanned) {
|
|
521
|
+
const timer = setTimeout(() => { s.scanned = true; if (stepId() === 'hello') scene.say(helloCaption()); }, 2400);
|
|
522
|
+
leave = () => clearTimeout(timer);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// ---- 2 · WHAT YOU WANT IT FOR: one or several; the examples from here on follow it.
|
|
527
|
+
function use() {
|
|
528
|
+
const picture = { id: 'use', data: () => ({ items: PROFILES.map((one) => ({ id: one.id, on: s.profile.has(one.id) })) }) };
|
|
529
|
+
const parts = head(t('What would you like MADRE to help you with?'), t('Choose one or more. That way MADRE shows you examples of what you do.'), picture, s.profile.size ? t('Your examples will be about this.') : t('Choose one or more.'));
|
|
530
|
+
const grid = el('div', 'wl-tiles wl-uses');
|
|
531
|
+
for (const one of PROFILES) {
|
|
532
|
+
const tile = button('wl-tile', null, () => {
|
|
533
|
+
if (s.profile.has(one.id)) s.profile.delete(one.id); else s.profile.add(one.id);
|
|
534
|
+
tile.setAttribute('aria-pressed', String(s.profile.has(one.id)));
|
|
535
|
+
scene.say(s.profile.size ? t('Your examples will be about this.') : t('Choose one or more.'));
|
|
536
|
+
paintUseKeys();
|
|
537
|
+
});
|
|
538
|
+
tile.setAttribute('aria-pressed', String(s.profile.has(one.id)));
|
|
539
|
+
const mark = el('span', 'wl-tile-icon');
|
|
540
|
+
mark.setAttribute('aria-hidden', 'true');
|
|
541
|
+
mark.innerHTML = trazo(one.icon); // trusted: our own SVG string
|
|
542
|
+
tile.append(mark, el('b', null, one.title()), el('small', null, one.sub()));
|
|
543
|
+
grid.append(tile);
|
|
544
|
+
}
|
|
545
|
+
parts.push(grid);
|
|
546
|
+
parts.push(what(t('Do I need to know how to program?'), t('No. Websites and apps are made of code, which is written instructions. You say «put a WhatsApp button on my page» and the AI writes the code. Before anything is kept, MADRE shows you what changed.')));
|
|
547
|
+
content.replaceChildren(...parts);
|
|
548
|
+
paintUseKeys();
|
|
549
|
+
}
|
|
550
|
+
function paintUseKeys() {
|
|
551
|
+
footer({
|
|
552
|
+
next: s.profile.size ? t('Continue') : t('Continue without choosing'),
|
|
553
|
+
onNext: async () => {
|
|
554
|
+
await save({ profile: [...s.profile] });
|
|
555
|
+
go(s.step + 1, s.profile.size ? 'done' : 'skip');
|
|
556
|
+
},
|
|
557
|
+
});
|
|
329
558
|
}
|
|
330
559
|
|
|
331
|
-
// ---- 3 · YOUR
|
|
560
|
+
// ---- 3 · YOUR AIs: «do you already pay for one?», in the names people know them by. Home's own
|
|
561
|
+
// panel connects them; the ones already signed in on this computer come connected.
|
|
332
562
|
function explainAgent(agent, state) {
|
|
333
563
|
const env = s.env ?? {};
|
|
334
|
-
|
|
335
|
-
if (
|
|
336
|
-
if (
|
|
337
|
-
if (
|
|
338
|
-
|
|
564
|
+
const lines = [];
|
|
565
|
+
if (!state.ok && PLANS[agent.id]) lines.push(el('p', 'wl-agent-plan', PLANS[agent.id]()));
|
|
566
|
+
if (agent.id === 'gemini' && !state.ok) lines.push(el('p', 'wl-agent-why', t('Sign in with your Google account (Workspace / business) or paste a Gemini API key from Google AI Studio, free or paid (recommended for personal accounts).')));
|
|
567
|
+
else if (agent.id === 'cursor' && !agent.detected) lines.push(el('p', 'wl-agent-why', t('Cursor installs with its own installer. For your safety MADRE does not run installers downloaded from the internet: copy the line below into a terminal (the window where you type commands), once, then press «I did it». Or skip it: it is optional.')));
|
|
568
|
+
else if (env.place === 'ssh' && agent.detected && !state.ok && (agent.login?.methods ?? []).some((method) => method.id === 'device')) lines.push(el('p', 'wl-agent-why', t('You\'re connected from another computer: choose «With a code», and type the code on the page from any device.')));
|
|
569
|
+
else if (env.place === 'ssh' && agent.detected && !state.ok) lines.push(el('p', 'wl-agent-why', t('You\'re connected from another computer: open the page it gives you on your own computer, and paste back here the code it shows.')));
|
|
570
|
+
if (!lines.length) return null;
|
|
571
|
+
if (lines.length === 1) return lines[0];
|
|
572
|
+
const box = el('div', 'wl-agent-notes');
|
|
573
|
+
box.append(...lines);
|
|
574
|
+
return box;
|
|
339
575
|
}
|
|
576
|
+
const agentItems = () => (s.agents?.agents ?? []).filter((agent) => agent.id !== 'madre').map((agent) => ({ id: agent.id, on: Boolean(host.agentState?.(agent, s.agents)?.ok) }));
|
|
577
|
+
const agentsCaption = () => (s.ready ? (s.ready === 1 ? t('One connected. One is enough to start.') : t('{n} connected. Each one works in all your projects.', { n: s.ready })) : t('Each AI you connect joins the centre.'));
|
|
340
578
|
function agents() {
|
|
341
579
|
const panel = host.agentsPanel?.({
|
|
342
580
|
compact: true,
|
|
@@ -344,15 +582,18 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
344
582
|
onPaint: (ready, answer) => {
|
|
345
583
|
s.ready = ready;
|
|
346
584
|
s.agents = answer;
|
|
585
|
+
scene.say(agentsCaption());
|
|
347
586
|
paintAgentKeys();
|
|
348
587
|
},
|
|
349
588
|
});
|
|
350
|
-
|
|
589
|
+
const picture = { id: 'agents', data: () => ({ items: agentItems() }) };
|
|
590
|
+
content.replaceChildren(...head(t('Do you already pay for an AI?'), t('If you already pay for ChatGPT, Claude or Grok, you use it here with the same account. Nothing more to pay.'), picture, agentsCaption()));
|
|
351
591
|
if (panel) {
|
|
352
592
|
content.append(panel.node);
|
|
353
593
|
void panel.paint().then(() => panel.live());
|
|
354
594
|
leave = () => panel.stop();
|
|
355
595
|
}
|
|
596
|
+
content.append(what(t('What does an AI do in here?'), t('The same as in the chat you already know, but with your files at hand: it reads them, sorts them and writes what you ask. It never touches anything without the permission you gave it. If a command has to run, which is a written order for the computer, the AI runs it: you never open the terminal.')));
|
|
356
597
|
footer({ nextOff: !s.ready, skip: { note: t('Without agents, MADRE cannot work for you.') } });
|
|
357
598
|
paintAgentKeys();
|
|
358
599
|
}
|
|
@@ -363,78 +604,395 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
363
604
|
for (const node of actions.querySelectorAll('.wl-skipnote, [data-skip]')) node.hidden = Boolean(s.ready);
|
|
364
605
|
}
|
|
365
606
|
|
|
366
|
-
// ----
|
|
367
|
-
|
|
607
|
+
// ---- 4 · YOUR PROJECTS: what the person already has, brought along like a phone's backup.
|
|
608
|
+
async function loadFound() {
|
|
609
|
+
const answer = await getJson('/api/salas/suggestions');
|
|
610
|
+
s.found = answer?.suggestions ?? [];
|
|
611
|
+
s.finding = false;
|
|
612
|
+
// The newest folders another tool knows come marked; with none, nothing is marked for them.
|
|
613
|
+
if (!s.picked) s.picked = new Set(s.found.filter((one) => one.from?.length).slice(0, MARKED).map((one) => one.path));
|
|
614
|
+
if (stepId() === 'project') project();
|
|
615
|
+
}
|
|
616
|
+
const projectCaption = () => {
|
|
617
|
+
const n = s.picked?.size ?? 0;
|
|
618
|
+
return n ? t('{n} on their way. They stay where they are; MADRE only learns where to find them.', { n }) : t('Mark the folders you want to bring.');
|
|
619
|
+
};
|
|
620
|
+
// Found folders shown at first: three rows of three; the rest behind «See all».
|
|
621
|
+
const FOUND_SHOWN = 9;
|
|
622
|
+
// WHAT IS ALREADY IN HOME, by name (2026-11-11, the author: «it says you already have 2 projects,
|
|
623
|
+
// but not which; someone coming back does not see them»): each one with where it lives, and the ones
|
|
624
|
+
// brought in this welcome marked as new. Shown, never offered again to mark.
|
|
625
|
+
const HOME_SHOWN = 8;
|
|
626
|
+
function homeList(had) {
|
|
627
|
+
const rooms = [...had];
|
|
628
|
+
for (const one of s.added) if (!rooms.some((room) => room.root === one.root || room.name === one.name)) rooms.push(one);
|
|
629
|
+
if (!rooms.length) return null;
|
|
630
|
+
const isNew = (room) => s.added.some((one) => one.root === room.root || one.name === room.name);
|
|
631
|
+
const box = el('div', 'wl-inhome');
|
|
632
|
+
const fresh = rooms.filter(isNew).length;
|
|
633
|
+
const title = rooms.length === 1 ? t('Already in Home: 1 project') : t('Already in Home: {n} projects', { n: rooms.length });
|
|
634
|
+
const words = fresh ? (fresh === 1 ? t('1 of them was added just now.') : t('{n} of them were added just now.', { n: fresh })) : t('Add another one, or continue.');
|
|
635
|
+
const top = el('p', 'wl-inhome-head');
|
|
636
|
+
top.append(el('b', null, title), el('span', null, words));
|
|
637
|
+
const list = el('ul', 'wl-inhome-list');
|
|
638
|
+
for (const room of rooms.slice(0, HOME_SHOWN)) {
|
|
639
|
+
const item = el('li', `wl-inhome-item${isNew(room) ? ' new' : ''}`);
|
|
640
|
+
const mark = el('span', 'wl-inhome-icon');
|
|
641
|
+
mark.setAttribute('aria-hidden', 'true');
|
|
642
|
+
mark.innerHTML = trazo('folder'); // trusted: our own SVG string
|
|
643
|
+
const where = room.root ? homeWord(room.root) : '';
|
|
644
|
+
const text = el('span', 'wl-inhome-words');
|
|
645
|
+
text.append(el('b', null, room.name), el('small', null, where));
|
|
646
|
+
item.append(mark, text);
|
|
647
|
+
if (isNew(room)) item.append(el('span', 'wl-inhome-tag', t('New')));
|
|
648
|
+
item.title = [room.name, where].filter(Boolean).join('\n');
|
|
649
|
+
list.append(item);
|
|
650
|
+
}
|
|
651
|
+
box.append(top, list);
|
|
652
|
+
if (rooms.length > HOME_SHOWN) box.append(el('small', 'wl-inhome-more', t('And {n} more, in Home.', { n: rooms.length - HOME_SHOWN })));
|
|
653
|
+
return box;
|
|
654
|
+
}
|
|
655
|
+
// WHAT CAN I MAKE?, under the new project's name: ideas for the person's uses first, then the rest.
|
|
656
|
+
let paintIdeas = () => {};
|
|
657
|
+
function createIdeas(nameInput) {
|
|
658
|
+
const box = el('div', 'wl-make');
|
|
659
|
+
const order = [...new Set([...s.profile].filter((one) => CREATE_IDEAS[one]).concat(CREATE_ORDER))];
|
|
660
|
+
const all = order.flatMap((use) => CREATE_IDEAS[use]().map(([icon, title, sub, message]) => ({ use, icon, title, sub, message, name: slugOf(title) })));
|
|
661
|
+
paintIdeas = () => {
|
|
662
|
+
const shown = s.allIdeas ? all : all.slice(0, CREATE_SHOWN);
|
|
663
|
+
const grid = el('div', 'wl-make-grid');
|
|
664
|
+
for (const idea of shown) {
|
|
665
|
+
const on = s.idea?.message === idea.message;
|
|
666
|
+
const key = button('wl-make-idea', null, () => {
|
|
667
|
+
s.idea = on ? null : { name: idea.name, message: idea.message, title: idea.title };
|
|
668
|
+
if (nameInput) {
|
|
669
|
+
nameInput.value = s.idea ? s.idea.name : '';
|
|
670
|
+
nameInput.dispatchEvent(new Event('change', { bubbles: true }));
|
|
671
|
+
}
|
|
672
|
+
paintIdeas();
|
|
673
|
+
// On to the name and the key that makes it (2026-11-11, the author: «after picking an idea it
|
|
674
|
+
// no longer takes them down to the name»): brought into sight, never past the idea chosen.
|
|
675
|
+
if (s.idea && nameInput) reveal(nameInput.closest('.sm-new-project') ?? nameInput);
|
|
676
|
+
});
|
|
677
|
+
key.setAttribute('aria-pressed', String(on));
|
|
678
|
+
const mark = el('span', 'wl-make-icon');
|
|
679
|
+
mark.setAttribute('aria-hidden', 'true');
|
|
680
|
+
mark.innerHTML = trazo(idea.icon); // trusted: our own SVG string
|
|
681
|
+
const words = el('span', 'wl-make-words');
|
|
682
|
+
words.append(el('b', null, idea.title), el('small', null, idea.sub));
|
|
683
|
+
key.append(mark, words);
|
|
684
|
+
grid.append(key);
|
|
685
|
+
}
|
|
686
|
+
const head = el('div', 'wl-make-head');
|
|
687
|
+
head.append(el('b', null, t('Not sure what to make? Pick an idea')), el('small', null, t('It names the folder for you, and MADRE opens the project with its first message already written. You can change anything.')));
|
|
688
|
+
const parts = [head, grid];
|
|
689
|
+
if (all.length > CREATE_SHOWN) parts.push(button('wl-btn ghost small wl-make-more', s.allIdeas ? t('Fewer ideas') : t('More ideas ({n})', { n: all.length - CREATE_SHOWN }), () => { s.allIdeas = !s.allIdeas; paintIdeas(); }));
|
|
690
|
+
if (s.idea) {
|
|
691
|
+
const first = el('div', 'wl-make-first');
|
|
692
|
+
first.append(el('small', null, t('Its first message, ready for you to send:')), el('p', null, `«${s.idea.message}»`));
|
|
693
|
+
parts.push(first);
|
|
694
|
+
}
|
|
695
|
+
box.replaceChildren(...parts);
|
|
696
|
+
};
|
|
697
|
+
paintIdeas();
|
|
698
|
+
return box;
|
|
699
|
+
}
|
|
700
|
+
// THE PRACTICE ONE, said before it is made: what it is, what can be asked of it, and one key.
|
|
701
|
+
function practicePanel() {
|
|
702
|
+
const box = el('div', 'wl-practice');
|
|
703
|
+
const head = el('div', 'wl-make-head');
|
|
704
|
+
head.append(el('b', null, t('A to-do list to practise on')), el('small', null, t('MADRE makes a folder with a small page: a list where you write tasks and tick them off. It is there so you can ask your AIs for changes and watch them happen. Nothing of yours is touched, and Undo puts back any change.')));
|
|
705
|
+
const list = el('ul', 'wl-practice-list');
|
|
706
|
+
for (const [icon, message, what] of PRACTICE_MESSAGES()) {
|
|
707
|
+
const item = el('li');
|
|
708
|
+
const mark = el('span', 'wl-make-icon');
|
|
709
|
+
mark.setAttribute('aria-hidden', 'true');
|
|
710
|
+
mark.innerHTML = trazo(icon); // trusted: our own SVG string
|
|
711
|
+
const words = el('span', 'wl-make-words');
|
|
712
|
+
words.append(el('b', null, `«${message}»`), el('small', null, what));
|
|
713
|
+
item.append(mark, words);
|
|
714
|
+
list.append(item);
|
|
715
|
+
}
|
|
716
|
+
const said = el('p', 'wl-tiny', '');
|
|
717
|
+
const make = button('wl-btn primary', t('Create the practice project'), async () => {
|
|
718
|
+
make.disabled = true;
|
|
719
|
+
make.textContent = t('Creating…');
|
|
720
|
+
const answer = await post('/api/salas/new', { sample: true, language: language() });
|
|
721
|
+
if (!answer.ok) { said.textContent = answer.body?.error ?? t('The project to try MADRE could not be made.'); make.disabled = false; make.textContent = t('Create the practice project'); return; }
|
|
722
|
+
s.added = [...s.added, ...(answer.body.added ?? [])];
|
|
723
|
+
s.way = null;
|
|
724
|
+
await host.refresh?.();
|
|
725
|
+
if (stepId() === 'project') go(s.step + 1, 'done');
|
|
726
|
+
});
|
|
727
|
+
box.append(head, el('p', 'wl-section', t('Things you will be able to ask it')), list, make, said);
|
|
728
|
+
return box;
|
|
729
|
+
}
|
|
730
|
+
function project() {
|
|
731
|
+
const had = host.projects?.() ?? [];
|
|
732
|
+
if (!s.found && !s.finding) { s.finding = true; void loadFound(); }
|
|
733
|
+
const found = s.found ?? [];
|
|
734
|
+
const looking = !s.found;
|
|
735
|
+
const known = found.some((one) => one.from?.length);
|
|
736
|
+
const picture = { id: 'project', data: () => ({ count: s.picked?.size ?? 0 }) };
|
|
737
|
+
const lead = looking ? t('Looking for your folders…') : !found.length ? t('Make a new project, or choose a folder you already work in.')
|
|
738
|
+
: known ? t('These are folders you already opened with other tools; the newest come marked. They stay where they are: MADRE only learns where to find them.')
|
|
739
|
+
: t('These folders look like projects. Mark the ones you want to bring.');
|
|
740
|
+
const parts = head(t('Bring what you already have'), lead, picture, projectCaption());
|
|
741
|
+
const inHome = homeList(had);
|
|
742
|
+
if (inHome) parts.push(inHome);
|
|
743
|
+
if (s.env?.place === 'wsl') parts.push(note('warn', t('Keep your projects inside Linux (your folder in /home). A Windows folder (/mnt/c/…) makes MADRE slower and protects your files less.'), fix('wsl-windows-folder')));
|
|
744
|
+
if (found.length) {
|
|
745
|
+
// Three columns of small cards (2026-11-10, the author: «less scrolling»): the name, where it
|
|
746
|
+
// is and when, and the tools it was opened with, each on one line.
|
|
747
|
+
const list = el('div', 'wl-found');
|
|
748
|
+
const shown = s.allFound ? found : found.slice(0, FOUND_SHOWN);
|
|
749
|
+
for (const one of shown) {
|
|
750
|
+
const on = s.picked?.has(one.path);
|
|
751
|
+
const row = button('wl-found-row', null, () => {
|
|
752
|
+
if (s.picked.has(one.path)) s.picked.delete(one.path); else s.picked.add(one.path);
|
|
753
|
+
row.setAttribute('aria-checked', String(s.picked.has(one.path)));
|
|
754
|
+
scene.say(projectCaption());
|
|
755
|
+
paintProjectKeys();
|
|
756
|
+
});
|
|
757
|
+
row.setAttribute('role', 'checkbox');
|
|
758
|
+
row.setAttribute('aria-checked', String(Boolean(on)));
|
|
759
|
+
const box = el('span', 'wl-box');
|
|
760
|
+
box.innerHTML = TICK; // trusted: our own SVG string
|
|
761
|
+
const words = el('span', 'wl-found-words');
|
|
762
|
+
const where = [homeWord(one.path), ago(one.when)].filter(Boolean).join(' · ');
|
|
763
|
+
const tools = one.from?.length ? t('Opened with {tools}', { tools: new Intl.ListFormat(language(), { type: 'conjunction' }).format(one.from.map((tool) => TOOL_NAMES[tool] ?? tool)) }) : t('Looks like a project');
|
|
764
|
+
words.append(el('b', null, one.name), el('small', null, where), el('small', 'wl-from', tools));
|
|
765
|
+
row.title = [one.name, where, tools].join('\n');
|
|
766
|
+
row.append(box, words);
|
|
767
|
+
list.append(row);
|
|
768
|
+
}
|
|
769
|
+
parts.push(list);
|
|
770
|
+
if (found.length > FOUND_SHOWN) {
|
|
771
|
+
const more = button('wl-btn ghost small wl-found-more', s.allFound ? t('Show fewer') : t('See all {n}', { n: found.length }), () => { s.allFound = !s.allFound; project(); });
|
|
772
|
+
parts.push(more);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
// Other ways in (2026-11-10, the author: «simple: create or bring a project»): a new one by its
|
|
776
|
+
// name, any other folder, or one made to practise in. The folders found above are not offered
|
|
777
|
+
// again in a tab of their own.
|
|
778
|
+
const others = el('div', 'wl-otherways');
|
|
779
|
+
const way = (id, icon, title, sub, onPick) => {
|
|
780
|
+
const tile = button('wl-tile', null, onPick);
|
|
781
|
+
tile.setAttribute('aria-pressed', String(s.way === id));
|
|
782
|
+
const mark = el('span', 'wl-tile-icon');
|
|
783
|
+
mark.setAttribute('aria-hidden', 'true');
|
|
784
|
+
mark.innerHTML = trazo(icon); // trusted: our own SVG string
|
|
785
|
+
const said = el('small', null, sub);
|
|
786
|
+
tile.append(mark, el('b', null, title), said);
|
|
787
|
+
return { tile, said };
|
|
788
|
+
};
|
|
789
|
+
const pick = (id) => { s.way = s.way === id ? null : id; project(); };
|
|
790
|
+
const fresh = way('new', 'add', t('Create a new one'), t('An empty folder with the name you choose.'), () => pick('new'));
|
|
791
|
+
const browse = way('browse', 'folder', t('Choose another folder'), t('Any folder on your computer.'), () => pick('browse'));
|
|
792
|
+
// No project at hand (2026-11-01): one made to try MADRE, a page with a list of tasks and a README
|
|
793
|
+
// with what to ask. «I do not know what I would do with MADRE» is answered by having something.
|
|
794
|
+
// Since 2026-11-11 it first says what it makes and what can be asked of it, then one key makes it.
|
|
795
|
+
const sample = way('sample', 'spark', t('A practice one'), t('A page with a list of tasks, to ask your AIs for changes without fear of breaking anything.'), () => pick('sample'));
|
|
796
|
+
others.append(fresh.tile, browse.tile, sample.tile);
|
|
797
|
+
parts.push(el('p', 'wl-section', found.length ? t('Or start another way') : t('How do you want to start?')), others);
|
|
798
|
+
let opened = null;
|
|
799
|
+
let focusName = false;
|
|
800
|
+
if (s.way === 'new' || s.way === 'browse') {
|
|
801
|
+
const picker = host.projectPicker?.({
|
|
802
|
+
sources: [s.way],
|
|
803
|
+
// A project made new here does not drop the folders already chosen (QA 1.1.0, NUE-08): they
|
|
804
|
+
// are added too, and the found ones stay marked. The idea picked for it goes with it.
|
|
805
|
+
onAdded: (added) => {
|
|
806
|
+
if (s.way === 'new' && s.idea && added?.[0]?.root) s.intents.set(added[0].root, s.idea.message);
|
|
807
|
+
s.added = [...s.added, ...(added ?? [])];
|
|
808
|
+
s.way = null;
|
|
809
|
+
s.idea = null;
|
|
810
|
+
s.found = null;
|
|
811
|
+
if (stepId() === 'project') project();
|
|
812
|
+
},
|
|
813
|
+
});
|
|
814
|
+
if (picker) {
|
|
815
|
+
opened = picker.node;
|
|
816
|
+
if (s.way === 'new') {
|
|
817
|
+
// The ideas come first and the name under them: picking one writes the name, and the key
|
|
818
|
+
// that makes the project is right below. Both are brought into sight together.
|
|
819
|
+
const name = opened.querySelector('.sm-new-name input');
|
|
820
|
+
if (name && s.idea && !name.value) name.value = s.idea.name;
|
|
821
|
+
// Writing a name of one's own lets go of the idea's: the folder is theirs.
|
|
822
|
+
name?.addEventListener('input', () => { if (s.idea && name.value !== s.idea.name) { s.idea = null; paintIdeas(); } });
|
|
823
|
+
const flow = el('div', 'wl-newflow');
|
|
824
|
+
flow.append(createIdeas(name), opened);
|
|
825
|
+
opened = flow;
|
|
826
|
+
focusName = true;
|
|
827
|
+
}
|
|
828
|
+
parts.push(opened);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
if (s.way === 'sample') parts.push(practicePanel());
|
|
832
|
+
parts.push(what(t('What is a project?'), t('Each folder you bring is a project: your shop, this year\'s invoices, your website. Each one keeps its own conversations and what has been decided, without mixing with the others. Bringing it does not move it or change anything in it.')));
|
|
833
|
+
const top = content.scrollTop;
|
|
834
|
+
content.replaceChildren(...parts);
|
|
835
|
+
content.scrollTop = top;
|
|
836
|
+
paintProjectKeys();
|
|
837
|
+
if (opened) { reveal(opened); if (focusName) opened.querySelector('input[type="text"]')?.focus({ preventScroll: true }); }
|
|
838
|
+
else if (s.way === 'sample') reveal(content.querySelector('.wl-practice'));
|
|
839
|
+
}
|
|
840
|
+
function paintProjectKeys() {
|
|
841
|
+
const n = s.picked?.size ?? 0;
|
|
842
|
+
const had = (host.projects?.() ?? []).length + s.added.length;
|
|
843
|
+
footer({
|
|
844
|
+
next: n ? (n === 1 ? t('Bring 1 project') : t('Bring {n} projects', { n })) : t('Continue'),
|
|
845
|
+
nextOff: !n && !had,
|
|
846
|
+
onNext: async () => {
|
|
847
|
+
if (n) {
|
|
848
|
+
const answer = await post('/api/salas/projects', { roots: [...s.picked] });
|
|
849
|
+
if (!answer.ok) { content.append(note('bad', answer.body?.refused?.[0]?.error ?? answer.body?.error ?? t('They could not be added.'))); return; }
|
|
850
|
+
s.added = [...s.added, ...(answer.body.added ?? [])];
|
|
851
|
+
s.picked.clear();
|
|
852
|
+
s.found = null;
|
|
853
|
+
await host.refresh?.();
|
|
854
|
+
}
|
|
855
|
+
go(s.step + 1, 'done');
|
|
856
|
+
},
|
|
857
|
+
skip: n || had ? null : { note: t('You can add it from Home.') },
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
// ---- 5 · AI ON YOUR COMPUTER: what it is, who uses it (the Coordinator), and one press that
|
|
862
|
+
// brings Ollama, the model and the memory's model, downloading while the person goes on. Or another
|
|
863
|
+
// computer's, or later. Once it is there, a first talk with it.
|
|
864
|
+
function aiPicture() {
|
|
865
|
+
const pull = pulling();
|
|
866
|
+
const model = offered();
|
|
867
|
+
if (aiReady() && !pull) return { state: 'ready', model: s.ollama?.chatModel ?? chatModels()[0]?.name ?? model?.label ?? '', detail: localHost(s.ollama?.host) ? t('No internet') : t('On the other computer') };
|
|
868
|
+
if (pull) return { state: 'downloading', pct: pull[1].pct ?? 0, model: pull[0] === EMBED_MODEL ? t('Its memory') : (model?.label ?? pull[0]), detail: `${Math.round(pull[1].pct ?? 0)} %` };
|
|
869
|
+
return { state: s.choice === 'skip' ? 'skip' : 'idle', model: model?.label ?? '', detail: '' };
|
|
870
|
+
}
|
|
871
|
+
function aiCaption() {
|
|
872
|
+
const pull = pulling();
|
|
873
|
+
if (pull) return pull[0] === EMBED_MODEL ? t('Downloading its memory. You can go on: it does not stop.') : t('Downloading {model}. You can go on: it does not stop.', { model: offered()?.label ?? pull[0] });
|
|
874
|
+
if (aiReady()) return t('It lives here now. Say hello below.');
|
|
875
|
+
if (s.choice === 'skip') return t('You can turn it on whenever you want.');
|
|
876
|
+
return t('Choose, and it downloads while you go on.');
|
|
877
|
+
}
|
|
368
878
|
function aiChoices() {
|
|
369
879
|
const env = s.env ?? {};
|
|
370
880
|
const carry = canCarry();
|
|
371
|
-
const model = offered();
|
|
372
881
|
const pick = (value) => {
|
|
373
882
|
s.choice = value;
|
|
374
883
|
// Back to this computer's Ollama after pointing at another one.
|
|
375
|
-
if (value === 'here' && s.ollama?.host && !localHost(s.ollama.host)) void post('/api/local-ai/host', { host: null }).then(() => readOllama({ probe: true })).then(() => paintAi());
|
|
884
|
+
if ((value === 'here' || value === 'other') && s.ollama?.host && !localHost(s.ollama.host)) void post('/api/local-ai/host', { host: null }).then(() => readOllama({ probe: true })).then(() => paintAi());
|
|
376
885
|
paintAi();
|
|
886
|
+
// What the choice opened, brought into sight.
|
|
887
|
+
reveal(aiBody?.lastElementChild);
|
|
377
888
|
};
|
|
378
889
|
const options = [];
|
|
379
|
-
|
|
890
|
+
const recommended = fit()?.recommended?.run ?? null;
|
|
891
|
+
if (recommended) {
|
|
380
892
|
const sub = carry === 'yes'
|
|
381
|
-
? t('
|
|
382
|
-
: t('The one
|
|
383
|
-
options.push(choice('ai', 'here', s.choice, t('
|
|
893
|
+
? t('Ollama, the program that runs it; the AI ({size} GB) and its memory ({mb} MB). One press, and it keeps downloading while you go on.', { size: number(recommended.sizeGb ?? 0), mb: EMBED_MB })
|
|
894
|
+
: t('The lightest one, {size} GB, with its memory. It will answer slowly: your computer has no graphics card the AI can use.', { size: number(recommended.sizeGb ?? 0) });
|
|
895
|
+
options.push(choice('ai', 'here', s.choice, s.env?.os === 'macos' ? t('The one that fits your Mac · {model}', { model: recommended.label }) : t('The one that fits your computer · {model}', { model: recommended.label }), sub, (value) => { s.model = null; pick(value); }, { badge: carry === 'yes' ? t('We recommend it') : null }));
|
|
384
896
|
}
|
|
897
|
+
if (fitting().length > 1) options.push(choice('ai', 'other', s.choice, t('Choose another one'), t('Only the ones that fit in your {gb} GB without slowing your computer down.', { gb: number(facts().memoryGb ?? 0) }), pick));
|
|
385
898
|
if (env.place === 'wsl') options.push(choice('ai', 'windows', s.choice, t('Use the Ollama on Windows'), t('If Ollama is already installed on Windows, MADRE connects to it.'), pick));
|
|
386
899
|
if (env.vm || env.place === 'wsl' || env.place === 'ssh' || carry !== 'yes') options.push(choice('ai', 'remote', s.choice, t('Use another computer\'s AI'), t('A computer on your network with Ollama and a graphics card.'), pick));
|
|
387
900
|
options.push(choice('ai', 'skip', s.choice, t('Not now'), t('MADRE works just the same with your agents. You can turn it on later in Settings › Local AI.'), pick));
|
|
388
901
|
return choices(t('AI on your computer'), ...options);
|
|
389
902
|
}
|
|
903
|
+
// The other models this computer carries: the same ladder, each with what it weighs.
|
|
904
|
+
function otherModels() {
|
|
905
|
+
const grid = el('div', 'wl-models');
|
|
906
|
+
const best = fit()?.recommended?.run?.id;
|
|
907
|
+
for (const model of fitting()) {
|
|
908
|
+
const key = button('wl-model', null, () => { s.model = model; paintAi(); reveal(aiBody?.lastElementChild); });
|
|
909
|
+
key.setAttribute('aria-pressed', String(offered()?.id === model.id));
|
|
910
|
+
key.append(el('b', null, model.label), el('small', null, t('{size} GB to download', { size: number(model.sizeGb ?? 0) })), el('span', 'wl-model-fit', model.id === best ? t('The one we recommend') : model.run === 'slow' ? t('Fits, answering slowly') : t('Fits without slowing it down')));
|
|
911
|
+
grid.append(key);
|
|
912
|
+
}
|
|
913
|
+
return grid;
|
|
914
|
+
}
|
|
390
915
|
let aiBody = null;
|
|
391
916
|
function ai() {
|
|
392
917
|
const carry = canCarry();
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
|
|
918
|
+
const lead = carry === 'no'
|
|
919
|
+
? t('This computer does not have enough memory for an AI of its own: here it would be too slow. MADRE works just the same with your agents.')
|
|
920
|
+
: carry === 'slow'
|
|
921
|
+
? t('It needs no internet, costs nothing, and what you write to it does not leave here. Your computer can carry a small one; with no graphics card it will answer slowly, so we suggest the lightest.')
|
|
922
|
+
: t('It needs no internet, costs nothing, and what you write to it does not leave here. It is smaller than ChatGPT or Claude, but it is plenty to sum up, sort and remember what you decide.');
|
|
396
923
|
// Chosen before: what is already there says which way this goes.
|
|
397
924
|
if (!s.choice && s.ollama?.running && chatModels().length) s.choice = localHost(s.ollama.host) ? 'here' : (s.env?.place === 'wsl' ? 'windows' : 'remote');
|
|
925
|
+
const coordinator = el('div', 'wl-coordinator');
|
|
926
|
+
const words = el('div');
|
|
927
|
+
words.append(
|
|
928
|
+
el('b', null, t('Your Coordinator works with it')),
|
|
929
|
+
el('p', null, t('In Home you have a Coordinator: the one that sees all your projects together. You ask it «what was left pending this week?» and it goes through all of them before answering.')),
|
|
930
|
+
el('p', null, t('The AI on your computer helps it sum up and search each project\'s memory without sending anything outside your computer: even if you ask in other words, it finds what you decided.')),
|
|
931
|
+
);
|
|
932
|
+
coordinator.append(host.mark?.('bishop', 34) ?? el('span'), words);
|
|
398
933
|
aiBody = el('div', 'wl-ai');
|
|
399
|
-
content.replaceChildren(...head(t('AI on your computer'),
|
|
934
|
+
content.replaceChildren(...head(t('An AI that lives on your computer'), lead, { id: 'ai', data: aiPicture }, aiCaption()), coordinator, aiBody);
|
|
935
|
+
// Already there when the step opens (2026-11-11, the author: «it opens scrolled to the bottom»):
|
|
936
|
+
// the step starts at its top, on the choices; only a talk that arrives later is brought into sight.
|
|
937
|
+
if (aiReady()) s.talkShown = true;
|
|
400
938
|
paintAi();
|
|
939
|
+
content.scrollTop = 0;
|
|
401
940
|
// While Ollama is not there yet, MADRE looks every few seconds: «I did it» is a courtesy.
|
|
402
941
|
clearInterval(pollTimer);
|
|
403
942
|
pollTimer = setInterval(() => {
|
|
404
|
-
if (document.hidden || !['here', '
|
|
405
|
-
if (s.choice !== 'here') return;
|
|
943
|
+
if (document.hidden || !['here', 'other'].includes(s.choice) || s.ollama?.running) return;
|
|
406
944
|
void readOllama({ probe: true }).then(() => { if (stepId() === 'ai') paintAi(); });
|
|
407
945
|
}, 5000);
|
|
408
946
|
leave = () => { clearInterval(pollTimer); pollTimer = 0; };
|
|
409
947
|
}
|
|
410
948
|
function paintAi() {
|
|
411
949
|
if (!aiBody?.isConnected) return;
|
|
950
|
+
scene.say(aiCaption());
|
|
951
|
+
scene.redraw();
|
|
412
952
|
const blocks = [aiChoices()];
|
|
413
|
-
if (s.choice === '
|
|
953
|
+
if (s.choice === 'other') blocks.push(otherModels());
|
|
954
|
+
if (s.choice === 'here' || s.choice === 'other') blocks.push(installFlow());
|
|
414
955
|
if (s.choice === 'windows' || s.choice === 'remote') blocks.push(addressFlow());
|
|
956
|
+
// Once its model is there, a first talk with it, wherever it runs.
|
|
957
|
+
if (s.choice !== 'skip' && aiReady()) blocks.push(talkFlow());
|
|
958
|
+
const top = content.scrollTop;
|
|
415
959
|
aiBody.replaceChildren(...blocks);
|
|
416
|
-
|
|
960
|
+
content.scrollTop = top;
|
|
961
|
+
// The first time the talk with it shows, it is brought into sight.
|
|
962
|
+
const talk = aiBody.querySelector('.wl-talk-card');
|
|
963
|
+
if (talk && !s.talkShown) { s.talkShown = true; reveal(talk); }
|
|
964
|
+
// With the AI there, its memory comes on its own: nothing to press.
|
|
965
|
+
if ((s.choice === 'here' || s.choice === 'other') && aiReady() && !hasModel(EMBED_MODEL) && !s.pulls.has(EMBED_MODEL) && !pulling()) void startPull(EMBED_MODEL);
|
|
966
|
+
const going = Boolean(pulling()) || s.queue.length > 0;
|
|
417
967
|
// «Not now» is one of the choices: no second key to leave it for later.
|
|
418
968
|
footer({
|
|
419
|
-
|
|
969
|
+
next: going ? t('Continue while it downloads') : t('Continue'),
|
|
970
|
+
nextOff: s.choice === null || (s.choice !== 'skip' && !aiReady() && !going),
|
|
420
971
|
onNext: async () => {
|
|
421
972
|
if (s.choice === 'skip') { go(s.step + 1, 'skip'); return; }
|
|
422
|
-
await enableLocal();
|
|
973
|
+
if (s.ollama?.running) await enableLocal();
|
|
423
974
|
go(s.step + 1, 'done');
|
|
424
975
|
},
|
|
425
976
|
});
|
|
426
977
|
}
|
|
427
|
-
// On for every project, and every open project told (Home › Settings › Local AI does the same).
|
|
978
|
+
// On for every project, and every open project told (Home › Settings › Local AI does the same). The
|
|
979
|
+
// memory searches by meaning on this computer as soon as its model is there.
|
|
428
980
|
async function enableLocal() {
|
|
429
981
|
await post('/api/ollama/settings', { enabled: true, embeddings: true });
|
|
430
982
|
await post('/api/salas/local-ai', {});
|
|
983
|
+
if (hasModel(EMBED_MODEL)) await useLocalMemory();
|
|
984
|
+
}
|
|
985
|
+
async function useLocalMemory() {
|
|
986
|
+
if (s.memory?.embedProvider === 'ollama') return;
|
|
987
|
+
const answer = await post('/api/settings', { memory: { embedProvider: 'ollama' } });
|
|
988
|
+
if (answer.ok) s.memory = { ...(s.memory ?? {}), embedProvider: 'ollama' };
|
|
431
989
|
}
|
|
432
990
|
function installFlow() {
|
|
433
991
|
const env = s.env ?? {};
|
|
434
992
|
const box = el('div', 'wl-card wl-flow');
|
|
435
993
|
const info = s.ollama ?? {};
|
|
436
994
|
// 1 · Ollama itself.
|
|
437
|
-
box.append(el('b', 'wl-flow-title', t('1 ·
|
|
995
|
+
box.append(el('b', 'wl-flow-title', t('1 · Ollama, the program that runs it')));
|
|
438
996
|
if (info.running) box.append(chip('ok', info.version ? t('Installed and open · {version}', { version: info.version }) : t('Installed and open')));
|
|
439
997
|
else if (info.binary) {
|
|
440
998
|
box.append(el('p', 'wl-muted', env.os === 'macos' ? t('Ollama is installed but not open. MADRE opens it; if it does not answer, open the Ollama app yourself.') : t('Ollama is installed but not running. MADRE starts it.')));
|
|
@@ -480,7 +1038,7 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
480
1038
|
box.append(row);
|
|
481
1039
|
}
|
|
482
1040
|
if (s.install?.error && !info.running) box.append(note('bad', s.install.trouble && TROUBLE[s.install.trouble] ? TROUBLE[s.install.trouble]() : s.install.error, fix(s.install.card ?? (s.install.trouble === 'permission' ? 'ollama' : TROUBLE_CARD[s.install.trouble]) ?? 'ollama')));
|
|
483
|
-
// 2 · The model
|
|
1041
|
+
// 2 · The model and its memory, once Ollama answers.
|
|
484
1042
|
if (info.running) box.append(...modelFlow());
|
|
485
1043
|
return box;
|
|
486
1044
|
}
|
|
@@ -496,52 +1054,73 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
496
1054
|
});
|
|
497
1055
|
return key;
|
|
498
1056
|
};
|
|
499
|
-
// The model
|
|
1057
|
+
// The model and the memory's model, downloaded one after the other with their real share.
|
|
500
1058
|
function modelFlow() {
|
|
501
1059
|
const parts = [];
|
|
502
1060
|
const have = chatModels();
|
|
503
1061
|
const model = offered();
|
|
504
|
-
const
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
parts.push(
|
|
1062
|
+
const memory = memoryLine();
|
|
1063
|
+
// Another model chosen and not there yet is downloaded; otherwise the one there is used.
|
|
1064
|
+
const wantsOther = s.choice === 'other' && s.model && !hasModel(s.model.ollama);
|
|
1065
|
+
if (have.length && !wantsOther && (!model || !s.pulls.get(model.ollama)?.running)) {
|
|
1066
|
+
parts.push(el('b', 'wl-flow-title', t('2 · The AI and its memory')));
|
|
1067
|
+
parts.push(chip('ok', t('Ready · {model}', { model: s.ollama?.chatModel ?? have[0].name })));
|
|
1068
|
+
if (memory) parts.push(...memory);
|
|
509
1069
|
return parts;
|
|
510
1070
|
}
|
|
511
1071
|
if (!model) {
|
|
512
|
-
parts.push(el('b', 'wl-flow-title', t('2 · The
|
|
1072
|
+
parts.push(el('b', 'wl-flow-title', t('2 · The AI and its memory')), el('p', 'wl-muted', t('This computer cannot carry a model. Use another computer\'s AI, or leave it for later.')));
|
|
513
1073
|
return parts;
|
|
514
1074
|
}
|
|
515
|
-
parts.push(el('b', 'wl-flow-title', t('2 · Download {model}', { model: model.label })));
|
|
1075
|
+
parts.push(el('b', 'wl-flow-title', t('2 · Download {model} and its memory', { model: model.label })));
|
|
516
1076
|
const pull = s.pulls.get(model.ollama);
|
|
517
1077
|
if (pull?.running) {
|
|
518
1078
|
const pct = pull.pct ?? 0;
|
|
519
1079
|
const got = ((model.sizeGb ?? 0) * pct) / 100;
|
|
520
1080
|
const line = el('div', 'wl-row wl-pull-line');
|
|
521
1081
|
line.append(el('small', 'wl-tiny', pull.phase === 'verify' ? t('Checking the download…') : t('{pct} % · {got} of {size} GB', { pct: Math.round(pct), got: number(got), size: number(model.sizeGb ?? 0) })), el('span', 'wl-grow'), cancelKey(model.ollama, pull));
|
|
522
|
-
parts.push(bar(pct), line);
|
|
1082
|
+
parts.push(bar(pct), line, el('small', 'wl-tiny', t('Then its memory, {mb} MB. You can go on to the next step meanwhile.', { mb: EMBED_MB })));
|
|
523
1083
|
return parts;
|
|
524
1084
|
}
|
|
525
1085
|
if (pull?.cancelled) parts.push(note('', t('You cancelled the download. What already arrived stays in Ollama: download it again and it picks up from there.')));
|
|
526
1086
|
if (pull?.error) {
|
|
527
|
-
parts.push(note('bad', pull.trouble && TROUBLE[pull.trouble] ? TROUBLE[pull.trouble]() : t('The download stopped: {error}', { error: pull.error }), fix(pull.trouble === 'disk' ? 'disk-full' : 'model-download')));
|
|
1087
|
+
parts.push(note('bad', pull.trouble && TROUBLE[pull.trouble] ? TROUBLE[pull.trouble]() : t('The download stopped: {error}', { error: pull.error }), fix(pull.trouble === 'disk' ? 'disk-full' : pull.trouble === 'dns' ? 'name-lookup' : pull.trouble === 'network' ? 'install-offline' : 'model-download')));
|
|
528
1088
|
}
|
|
529
1089
|
if (!roomFor(model.sizeGb ?? 0)) parts.push(note('warn', t('There are {free} GB free and this model needs {size} GB plus some room. Free up space or choose a smaller model.', { free: number(s.env.disk.freeGb), size: number(model.sizeGb ?? 0) }), fix('disk-full')));
|
|
530
1090
|
const row = el('div', 'wl-row');
|
|
531
|
-
const get = button('wl-btn primary small', pull?.error ? t('Try again') : pull?.cancelled ? t('Continue the download') : t('Download · {size} GB', { size: number(model.sizeGb ?? 0) }), () => void
|
|
1091
|
+
const get = button('wl-btn primary small', pull?.error ? t('Try again') : pull?.cancelled ? t('Continue the download') : t('Download · {size} GB', { size: number((model.sizeGb ?? 0) + EMBED_MB / 1000) }), () => void getAll(model.ollama));
|
|
532
1092
|
get.disabled = !roomFor(model.sizeGb ?? 0) && !pull?.error;
|
|
533
1093
|
row.append(get);
|
|
534
1094
|
const down = smaller();
|
|
535
|
-
if (down) row.append(button('wl-btn ghost small', t('Choose a smaller one · {model}', { model: down.label }), () => { s.model = down; paintAi(); }));
|
|
1095
|
+
if (down && s.choice !== 'other') row.append(button('wl-btn ghost small', t('Choose a smaller one · {model}', { model: down.label }), () => { s.model = down; paintAi(); }));
|
|
536
1096
|
parts.push(row, el('small', 'wl-tiny', t('It downloads once and stays in Ollama.')));
|
|
537
1097
|
return parts;
|
|
538
1098
|
}
|
|
1099
|
+
// The memory's own line: its model downloading after the AI, or there.
|
|
1100
|
+
function memoryLine() {
|
|
1101
|
+
if (hasModel(EMBED_MODEL)) return [chip('ok', t('Memory model ready · {model}', { model: EMBED_MODEL }))];
|
|
1102
|
+
const pull = s.pulls.get(EMBED_MODEL);
|
|
1103
|
+
if (pull?.running) {
|
|
1104
|
+
const line = el('div', 'wl-row wl-pull-line');
|
|
1105
|
+
line.append(el('small', 'wl-tiny', t('Its memory · {pct} % · {mb} MB', { pct: Math.round(pull.pct ?? 0), mb: EMBED_MB })), el('span', 'wl-grow'), cancelKey(EMBED_MODEL, pull));
|
|
1106
|
+
return [bar(pull.pct ?? 0), line];
|
|
1107
|
+
}
|
|
1108
|
+
if (pull?.error) return [note('bad', pull.trouble && TROUBLE[pull.trouble] ? TROUBLE[pull.trouble]() : t('The download stopped: {error}', { error: pull.error }), fix(pull.trouble === 'disk' ? 'disk-full' : pull.trouble === 'dns' ? 'name-lookup' : pull.trouble === 'network' ? 'install-offline' : 'model-download')), button('wl-btn small', t('Try again'), () => void startPull(EMBED_MODEL))];
|
|
1109
|
+
if (pull?.cancelled) return [button('wl-btn small', t('Continue the download'), () => void startPull(EMBED_MODEL))];
|
|
1110
|
+
return [button('wl-btn small', t('Download the memory model · {mb} MB', { mb: EMBED_MB }), () => void startPull(EMBED_MODEL))];
|
|
1111
|
+
}
|
|
1112
|
+
// One press: the AI, then its memory. Ollama takes one download at a time, so the second waits.
|
|
1113
|
+
function getAll(model) {
|
|
1114
|
+
s.queue = hasModel(EMBED_MODEL) || s.pulls.get(EMBED_MODEL)?.running ? [] : [EMBED_MODEL];
|
|
1115
|
+
return startPull(model);
|
|
1116
|
+
}
|
|
539
1117
|
// Stopping a download halfway: the server stops asking Ollama for it (/api/ollama/pull/cancel).
|
|
540
1118
|
const cancelKey = (model, pull) => {
|
|
541
1119
|
const key = button('wl-btn ghost small', pull.cancelling ? t('Cancelling…') : t('Cancel'), async () => {
|
|
542
1120
|
pull.cancelling = true;
|
|
543
1121
|
key.disabled = true;
|
|
544
1122
|
key.textContent = t('Cancelling…');
|
|
1123
|
+
s.queue = [];
|
|
545
1124
|
const answer = await post('/api/ollama/pull/cancel', { model });
|
|
546
1125
|
if (!answer.ok) { pull.cancelling = false; key.disabled = false; key.textContent = t('Cancel'); }
|
|
547
1126
|
});
|
|
@@ -555,24 +1134,28 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
555
1134
|
if (!answer.ok) s.pulls.set(model, { error: answer.body?.error ?? t('Home did not answer.') });
|
|
556
1135
|
repaint();
|
|
557
1136
|
}
|
|
558
|
-
// «
|
|
559
|
-
// there, answers as it writes (the server streams what Ollama says), and keeps the
|
|
560
|
-
// the person can go on.
|
|
561
|
-
//
|
|
562
|
-
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
|
|
1137
|
+
// «Say hello» (2026-10-28, again in 1.1): a talk with @madre, not a form. It greets first as soon
|
|
1138
|
+
// as its model is there, answers as it writes (the server streams what Ollama says), and keeps the
|
|
1139
|
+
// turns before, so the person can go on. Under each answer, how long it took and where it ran. Its
|
|
1140
|
+
// suggestions follow what MADRE is for to this person, and leave once used. Built once and kept:
|
|
1141
|
+
// the downloads repaint the step, and a talk being written must not be rebuilt under the person.
|
|
1142
|
+
const GREETING = () => t('Introduce yourself in one or two short, warm sentences, as a person would: you are @madre, you live on this computer, and what is written to you stays here, even without internet. Ask how you can help.');
|
|
1143
|
+
const offline = () => localHost(s.ollama?.host);
|
|
1144
|
+
function talkFlow() {
|
|
1145
|
+
s.talk ??= { messages: [], busy: false, error: null, node: null, greeted: false, asked: new Set() };
|
|
566
1146
|
if (!s.talk.node) s.talk.node = talkNode();
|
|
567
1147
|
if (!s.talk.greeted) { s.talk.greeted = true; void say(GREETING(), { hidden: true }); }
|
|
568
|
-
return
|
|
1148
|
+
return s.talk.node;
|
|
569
1149
|
}
|
|
570
1150
|
function talkNode() {
|
|
571
1151
|
const box = el('div', 'wl-talk-card');
|
|
1152
|
+
const top = el('div', 'wl-talk-head');
|
|
1153
|
+
const words = el('div');
|
|
1154
|
+
words.append(el('b', null, '@madre'), el('small', null, t('In any project you call it by writing @madre.')));
|
|
1155
|
+
top.append(host.mark?.('madre', 28) ?? el('span', 'wl-msg-face'), words, chip('ok', offline() ? t('No internet') : t('On the other computer')));
|
|
572
1156
|
const list = el('div', 'wl-talk');
|
|
573
1157
|
list.setAttribute('aria-live', 'polite');
|
|
574
1158
|
const chips = el('div', 'wl-chips');
|
|
575
|
-
for (const words of SUGGESTIONS()) chips.append(button('wl-chip-key', words, () => void say(words)));
|
|
576
1159
|
const form = el('form', 'wl-try wl-talk-form');
|
|
577
1160
|
const input = el('input', 'wl-field');
|
|
578
1161
|
input.placeholder = t('Write to @madre…');
|
|
@@ -581,11 +1164,18 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
581
1164
|
send.type = 'submit';
|
|
582
1165
|
form.append(input, send);
|
|
583
1166
|
form.addEventListener('submit', (event) => { event.preventDefault(); const words = input.value.trim(); if (!words) return; input.value = ''; void say(words); });
|
|
584
|
-
|
|
585
|
-
box.append(list, chips, form, el('small', 'wl-tiny', where));
|
|
1167
|
+
box.append(top, list, chips, form);
|
|
586
1168
|
box.refs = { list, chips, input, send };
|
|
1169
|
+
paintChips(box.refs);
|
|
587
1170
|
return box;
|
|
588
1171
|
}
|
|
1172
|
+
function paintChips({ chips }) {
|
|
1173
|
+
const said = s.talk?.asked ?? new Set();
|
|
1174
|
+
const own = SUGGESTIONS[profileOf()]?.() ?? SUGGESTIONS.curious();
|
|
1175
|
+
chips.replaceChildren();
|
|
1176
|
+
for (const words of [...own, t('What can you do without internet?')].filter((one) => !said.has(one))) chips.append(button('wl-chip-key', words, () => void say(words)));
|
|
1177
|
+
chips.hidden = (s.talk?.messages ?? []).filter((one) => one.role === 'user').length > 3;
|
|
1178
|
+
}
|
|
589
1179
|
async function say(words, { hidden = false } = {}) {
|
|
590
1180
|
const talk = s.talk;
|
|
591
1181
|
const { list, chips, input, send } = talk.node.refs;
|
|
@@ -594,17 +1184,18 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
594
1184
|
talk.error = null;
|
|
595
1185
|
send.disabled = true;
|
|
596
1186
|
chips.hidden = true;
|
|
1187
|
+
if (!hidden) talk.asked.add(words);
|
|
597
1188
|
talk.node.querySelector('.wl-talk-error')?.remove();
|
|
598
1189
|
talk.messages.push({ role: 'user', content: words });
|
|
599
1190
|
if (!hidden) list.append(el('p', 'wl-bubble me', words));
|
|
600
|
-
// @madre's turn:
|
|
1191
|
+
// @madre's turn: three dots while it thinks, then its words as they come, then how it went.
|
|
601
1192
|
const row = el('div', 'wl-msg');
|
|
602
|
-
const face = host.mark?.('madre', 26) ?? el('span', 'wl-msg-face');
|
|
603
1193
|
const bubble = el('p', 'wl-bubble wl-typing');
|
|
604
1194
|
bubble.append(el('i'), el('i'), el('i'));
|
|
605
|
-
row.append(
|
|
1195
|
+
row.append(bubble);
|
|
606
1196
|
list.append(row);
|
|
607
1197
|
list.scrollTop = list.scrollHeight;
|
|
1198
|
+
const started = performance.now();
|
|
608
1199
|
let text = '';
|
|
609
1200
|
try {
|
|
610
1201
|
const response = await fetch('/api/local-ai/try', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ messages: talk.messages }) });
|
|
@@ -619,6 +1210,8 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
619
1210
|
}
|
|
620
1211
|
if (!text.trim()) throw new Error(t('The local AI did not answer.'));
|
|
621
1212
|
talk.messages.push({ role: 'assistant', content: text.trim() });
|
|
1213
|
+
const seconds = number(Math.max(0.1, (performance.now() - started) / 1000));
|
|
1214
|
+
row.append(el('small', 'wl-msg-meta', offline() ? t('Answered in {s} s · on your computer · no internet', { s: seconds }) : t('Answered in {s} s · on the other computer', { s: seconds })));
|
|
622
1215
|
} catch (error) {
|
|
623
1216
|
row.remove();
|
|
624
1217
|
talk.messages.pop();
|
|
@@ -630,11 +1223,11 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
630
1223
|
bubble.classList.remove('wl-writing');
|
|
631
1224
|
talk.busy = false;
|
|
632
1225
|
send.disabled = false;
|
|
633
|
-
|
|
1226
|
+
paintChips(talk.node.refs);
|
|
1227
|
+
list.scrollTop = list.scrollHeight;
|
|
634
1228
|
if (!hidden && document.activeElement === document.body) input.focus({ preventScroll: true });
|
|
635
1229
|
}
|
|
636
1230
|
}
|
|
637
|
-
// The AI of another computer, or of Windows from inside WSL: its address, tried before it is kept.
|
|
638
1231
|
function addressFlow() {
|
|
639
1232
|
const env = s.env ?? {};
|
|
640
1233
|
const box = el('div', 'wl-card wl-flow');
|
|
@@ -672,114 +1265,10 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
672
1265
|
return box;
|
|
673
1266
|
}
|
|
674
1267
|
|
|
675
|
-
// ---- 6 ·
|
|
676
|
-
|
|
677
|
-
function memoryStep() {
|
|
678
|
-
memoryBody = el('div', 'wl-memory');
|
|
679
|
-
content.replaceChildren(...head(t('Memory'), t('MADRE remembers what you decide in each project. With search by meaning it finds it even when you ask in other words.')), memoryBody);
|
|
680
|
-
paintMemory();
|
|
681
|
-
// A Gemini key pasted in step 3 counts here: asked again, not the one read when the welcome opened.
|
|
682
|
-
void getJson('/api/environment').then((environment) => {
|
|
683
|
-
if (!environment) return;
|
|
684
|
-
const had = s.geminiKey;
|
|
685
|
-
s.geminiKey = Boolean(environment.geminiKey);
|
|
686
|
-
s.memory = environment.memory ?? s.memory;
|
|
687
|
-
if (had !== s.geminiKey) paintMemory();
|
|
688
|
-
});
|
|
689
|
-
// With the AI of step 4 there, its memory model comes on its own: nothing to press — unless
|
|
690
|
-
// another download is still running (step 4's model): Ollama takes one at a time.
|
|
691
|
-
const busy = [...s.pulls.values()].some((one) => one.running);
|
|
692
|
-
if (s.memoryChoice === 'local' && !hasModel(EMBED_MODEL) && !s.pulls.has(EMBED_MODEL) && !busy) void startPull(EMBED_MODEL);
|
|
693
|
-
}
|
|
694
|
-
function paintMemory() {
|
|
695
|
-
if (!memoryBody?.isConnected) return;
|
|
696
|
-
const local = Boolean(s.ollama?.running);
|
|
697
|
-
const said = s.memory?.embedProvider;
|
|
698
|
-
s.memoryChoice ??= said === 'ollama' && local ? 'local' : said === 'gemini' ? 'gemini' : said === 'off' ? 'off' : local ? 'local' : s.geminiKey ? 'gemini' : 'off';
|
|
699
|
-
if (s.memoryChoice === 'local' && !local) s.memoryChoice = s.geminiKey ? 'gemini' : 'off';
|
|
700
|
-
const pick = (value) => { s.memoryChoice = value; if (value === 'local' && !hasModel(EMBED_MODEL) && !s.pulls.get(EMBED_MODEL)?.running) void startPull(EMBED_MODEL); paintMemory(); };
|
|
701
|
-
const embedReady = hasModel(EMBED_MODEL);
|
|
702
|
-
const group = choices(t('Memory'),
|
|
703
|
-
choice('memory', 'local', s.memoryChoice, s.ollama?.host && !localHost(s.ollama.host) ? t('With your Ollama') : t('On your computer'), local ? (embedReady ? (s.ollama?.host && !localHost(s.ollama.host) ? t('With the Ollama of the other computer, on your network. Its memory model is already there. Free and private.') : t('With Ollama. Its memory model is already here. Free and private.')) : t('With Ollama. Downloads a memory model of {mb} MB. Free and private.', { mb: EMBED_MB })) : t('Needs the AI on your computer (step {n}).', { n: stepOf('ai') }), pick, { badge: local ? t('Recommended') : null, disabled: !local }),
|
|
704
|
-
choice('memory', 'gemini', s.memoryChoice, t('With Gemini'), s.geminiKey ? t('Uses your Gemini key, already on this computer. Paid per use, very little. What it searches is sent to Google.') : t('Needs your Gemini key: paste it in step 3, in Gemini.'), pick, { badge: !local && s.geminiKey ? t('Recommended') : null }),
|
|
705
|
-
choice('memory', 'off', s.memoryChoice, t('Exact words only'), t('Nothing extra. It finds what you ask for with the same words.'), pick),
|
|
706
|
-
);
|
|
707
|
-
const parts = [group];
|
|
708
|
-
if (s.memoryChoice === 'local') {
|
|
709
|
-
const pull = s.pulls.get(EMBED_MODEL);
|
|
710
|
-
if (embedReady) parts.push(chip('ok', t('Memory model ready · {model}', { model: EMBED_MODEL })));
|
|
711
|
-
else if (pull?.running) {
|
|
712
|
-
const line = el('div', 'wl-row wl-pull-line');
|
|
713
|
-
line.append(el('small', 'wl-tiny', t('{pct} % · {mb} MB', { pct: Math.round(pull.pct ?? 0), mb: EMBED_MB })), el('span', 'wl-grow'), cancelKey(EMBED_MODEL, pull));
|
|
714
|
-
parts.push(bar(pull.pct ?? 0), line);
|
|
715
|
-
} else if (pull?.cancelled) parts.push(note('', t('You cancelled the download. What already arrived stays in Ollama: download it again and it picks up from there.')), button('wl-btn primary small', t('Continue the download'), () => void startPull(EMBED_MODEL)));
|
|
716
|
-
else if (pull?.error) parts.push(note('bad', pull.trouble && TROUBLE[pull.trouble] ? TROUBLE[pull.trouble]() : t('The download stopped: {error}', { error: pull.error }), fix(pull.trouble === 'disk' ? 'disk-full' : 'model-download')), button('wl-btn small', t('Try again'), () => void startPull(EMBED_MODEL)));
|
|
717
|
-
else parts.push(button('wl-btn primary small', t('Download the memory model · {mb} MB', { mb: EMBED_MB }), () => void startPull(EMBED_MODEL)));
|
|
718
|
-
}
|
|
719
|
-
if (s.memoryChoice === 'gemini' && !s.geminiKey) parts.push(button('wl-btn small', t('Go to step 3'), () => go('agents')));
|
|
720
|
-
memoryBody.replaceChildren(...parts);
|
|
721
|
-
const blocked = (s.memoryChoice === 'local' && !embedReady) || (s.memoryChoice === 'gemini' && !s.geminiKey);
|
|
722
|
-
footer({
|
|
723
|
-
nextOff: blocked,
|
|
724
|
-
onNext: async () => {
|
|
725
|
-
const provider = { local: 'ollama', gemini: 'gemini', off: 'off' }[s.memoryChoice];
|
|
726
|
-
const answer = await post('/api/settings', { memory: { embedProvider: provider } });
|
|
727
|
-
if (answer.ok) s.memory = { ...(s.memory ?? {}), embedProvider: provider };
|
|
728
|
-
go(s.step + 1, s.memoryChoice === 'off' ? 'skip' : 'done');
|
|
729
|
-
},
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
// ---- 4 · YOUR PROJECT: a new one or a folder that already is one.
|
|
734
|
-
function project() {
|
|
735
|
-
const had = host.projects?.() ?? [];
|
|
736
|
-
const lead = t('A project is a folder you work in: a store, a website, your documents. Each one has its own conversations and its own memory.');
|
|
737
|
-
const parts = [...head(t('Your first project'), lead)];
|
|
738
|
-
if (had.length) parts.push(note('ok', had.length === 1 ? t('You already have a project in Home: {name}. Add another one, or continue.', { name: had[0].name }) : t('You already have {n} projects in Home. Add another one, or continue.', { n: had.length })));
|
|
739
|
-
if (s.env?.place === 'wsl') parts.push(note('warn', t('Keep your projects inside Linux (your folder in /home). A Windows folder (/mnt/c/…) makes MADRE slower and protects your files less.'), fix('wsl-windows-folder')));
|
|
740
|
-
let picker = null;
|
|
741
|
-
const primary = () => actions.querySelector('[data-next]');
|
|
742
|
-
picker = host.projectPicker?.({
|
|
743
|
-
withAdd: false,
|
|
744
|
-
onChange: (n) => { const key = primary(); if (key) { key.textContent = n ? t('Add and continue') : t('Continue'); key.disabled = !n && !(host.projects?.() ?? []).length; } },
|
|
745
|
-
// A project made new here does not drop the folders already chosen (QA 1.1.0, NUE-08): they
|
|
746
|
-
// are added too, and only then the step is done.
|
|
747
|
-
onAdded: (added) => {
|
|
748
|
-
s.added = [...s.added, ...(added ?? [])];
|
|
749
|
-
if (stepId() !== 'project') return;
|
|
750
|
-
if (picker?.count()) { void picker.add(); return; }
|
|
751
|
-
go(s.step + 1, 'done');
|
|
752
|
-
},
|
|
753
|
-
});
|
|
754
|
-
if (picker) parts.push(picker.node);
|
|
755
|
-
// No project at hand (2026-11-01): one made to try MADRE, a page with a list of tasks and a README
|
|
756
|
-
// with what to ask. «I do not know what I would do with MADRE» is answered by having something.
|
|
757
|
-
const sample = el('div', 'wl-card wl-sample');
|
|
758
|
-
const said = el('p', 'wl-muted', t('No project at hand? Make one to try: a page with a list of tasks, to ask your AIs for changes without fear of breaking anything.'));
|
|
759
|
-
const make = button('wl-btn small', t('Make the project to try'), async () => {
|
|
760
|
-
make.disabled = true;
|
|
761
|
-
const answer = await post('/api/salas/new', { sample: true, language: language() });
|
|
762
|
-
if (!answer.ok) { said.textContent = answer.body?.error ?? t('The project to try MADRE could not be made.'); make.disabled = false; return; }
|
|
763
|
-
s.added = [...s.added, ...(answer.body.added ?? [])];
|
|
764
|
-
await host.refresh?.();
|
|
765
|
-
if (stepId() === 'project') go(s.step + 1, 'done');
|
|
766
|
-
});
|
|
767
|
-
sample.append(said, make);
|
|
768
|
-
parts.push(sample);
|
|
769
|
-
content.replaceChildren(...parts);
|
|
770
|
-
footer({
|
|
771
|
-
nextOff: !had.length,
|
|
772
|
-
onNext: async () => {
|
|
773
|
-
if (picker?.count()) { await picker.add(); return; }
|
|
774
|
-
go(s.step + 1, 'done');
|
|
775
|
-
},
|
|
776
|
-
skip: had.length ? null : { note: t('You can add it from Home.') },
|
|
777
|
-
});
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
// ---- 7 · READY: what is set, what was left for later with its key, and what comes next.
|
|
1268
|
+
// ---- 6 · YOUR FIRST MESSAGE: what is ready, said in one line each, and a project opened with a
|
|
1269
|
+
// first message already written for this person. Anything left for later has its key.
|
|
781
1270
|
async function ready() {
|
|
782
|
-
content.replaceChildren(...head(t('
|
|
1271
|
+
content.replaceChildren(...head(t('Where do we start?'), null, { id: 'ready', data: () => ({ text: '' }) }, t('Reading…')));
|
|
783
1272
|
actions.replaceChildren();
|
|
784
1273
|
const settings = s.agents ?? await getJson('/api/settings');
|
|
785
1274
|
await readOllama();
|
|
@@ -788,13 +1277,32 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
788
1277
|
const rooms = host.projects?.() ?? [];
|
|
789
1278
|
const added = s.added.map((one) => rooms.find((room) => room.root === one.root || room.name === one.name)).filter(Boolean);
|
|
790
1279
|
const room = added[0] ?? rooms[0] ?? null;
|
|
791
|
-
const
|
|
792
|
-
|
|
1280
|
+
const sample = s.added.some((one) => one.sample && (room?.root === one.root || room?.name === one.name));
|
|
1281
|
+
// Ideas for what is in that folder (2026-11-10, the author: «for the project the person chose»):
|
|
1282
|
+
// its sheets, documents, pages or code by name; an empty one is a project being born, and gets
|
|
1283
|
+
// ideas to make something, by what MADRE is for to this person. The practice one has its own.
|
|
1284
|
+
const inside = room && !sample ? await getJson(`/api/salas/peek?room=${encodeURIComponent(room.id)}`) : null;
|
|
1285
|
+
if (stepId() !== 'ready') return;
|
|
1286
|
+
const born = Array.isArray(inside?.entries) && !inside.entries.some((entry) => !String(entry.name).startsWith('.'));
|
|
1287
|
+
// MESSAGES FOR THE PROJECT (2026-11-11, the author: «the ideas at the end lack logic; say the
|
|
1288
|
+
// messages they can send to their project»): the practice one says what each message will do to
|
|
1289
|
+
// its page; one made here from an idea opens with that idea's message first; the rest, messages
|
|
1290
|
+
// for what is in the folder.
|
|
1291
|
+
const intent = room ? s.intents.get(room.root) ?? null : null;
|
|
1292
|
+
let ideas = sample
|
|
1293
|
+
? PRACTICE_MESSAGES().map(([icon, text, what]) => ({ icon, text, what, open: false }))
|
|
1294
|
+
: Array.isArray(inside?.entries)
|
|
1295
|
+
? startersFor({ entries: inside.entries, profile: [...s.profile], project: room.name, t, count: 4 })
|
|
1296
|
+
: (IDEAS[profileOf() ?? 'none'] ?? IDEAS.none)().map((text) => ({ icon: 'compose', text, open: false }));
|
|
1297
|
+
if (intent) ideas = [{ icon: 'spark', text: intent, what: t('The idea you chose when you made it.'), open: false }, ...ideas.filter((one) => one.text !== intent)].slice(0, 4);
|
|
1298
|
+
const pull = pulling();
|
|
1299
|
+
const aiWords = aiReady() && !pull
|
|
1300
|
+
? (s.talk?.messages?.length > 1 ? t('Ready, and you have already met') : `${s.ollama.chatModel ?? chatModels()[0].name}${localHost(s.ollama.host) ? '' : ` · ${t('on another computer')}`}`)
|
|
1301
|
+
: pull ? t('Still downloading; we will tell you when it arrives') : t('Whenever you want, in Settings');
|
|
793
1302
|
const rows = [
|
|
794
|
-
[t('
|
|
795
|
-
[t('
|
|
796
|
-
[t('
|
|
797
|
-
[t('Project'), room ? room.name : t('None yet'), Boolean(room), 'project'],
|
|
1303
|
+
[t('Your AIs'), connected.length ? new Intl.ListFormat(language(), { type: 'conjunction' }).format(connected) : t('None connected yet'), connected.length > 0, 'agents'],
|
|
1304
|
+
[t('Your projects'), s.added.length ? (s.added.length === 1 ? t('You brought {name}', { name: s.added[0].name }) : t('You brought {n}', { n: s.added.length })) : room ? room.name : t('None yet'), Boolean(room), 'project'],
|
|
1305
|
+
[t('AI on your computer'), aiWords, aiReady() || Boolean(pull), 'ai'],
|
|
798
1306
|
];
|
|
799
1307
|
const summary = el('div', 'wl-card wl-checks');
|
|
800
1308
|
for (const [title, sub, ok, id] of rows) {
|
|
@@ -808,43 +1316,65 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
808
1316
|
if (!ok) row.append(button('wl-btn small', t('Do it now'), () => go(id)));
|
|
809
1317
|
summary.append(row);
|
|
810
1318
|
}
|
|
811
|
-
const
|
|
812
|
-
const
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
trainCard.append(el('b', null, t('Train your own AI')));
|
|
822
|
-
if (train) {
|
|
823
|
-
trainCard.append(el('p', 'wl-muted', t('Your computer can train its own AI with what your project knows, up to {model}. Everything is ready: you turn it on in your project\'s Settings › Memory › Train your own AI.', { model: train.label })));
|
|
824
|
-
const reqs = el('ul', 'wl-reqs');
|
|
825
|
-
reqs.append(el('li', null, facts().accelerator === 'apple' ? t('Apple chip with 12 GB of memory or more') : t('NVIDIA card with 9 GB or more and CUDA 12 (experimental)')));
|
|
826
|
-
reqs.append(el('li', null, t('About {gb} GB free while it trains', { gb: Math.ceil(train.params * 5.5) + 2 })));
|
|
827
|
-
trainCard.append(reqs);
|
|
828
|
-
// How it is done, step by step, in the manual (2026-10-28).
|
|
829
|
-
trainCard.append(button('wl-btn ghost small', t('How it is trained'), () => window.open(`/manual?lang=${language()}#entrena`, '_blank', 'noopener')));
|
|
830
|
-
} else {
|
|
831
|
-
trainCard.append(el('p', 'wl-muted', t('This computer cannot train. It takes a Mac with an Apple chip and 12 GB of memory, or an NVIDIA card with 9 GB or more.')));
|
|
1319
|
+
const parts = [];
|
|
1320
|
+
const lead = room && connected.length
|
|
1321
|
+
? t('Everything is ready. Next, {name} opens, and you can start with one of these messages or write your own.', { name: room.name })
|
|
1322
|
+
: t('Here is what is ready. Anything you left for later has its button.');
|
|
1323
|
+
parts.push(...head(t('Where do we start?'), lead, { id: 'ready', data: () => ({ text: ideas[0]?.text ?? '', note: Boolean(room && connected.length) }) }, room && connected.length ? t('Your first message, almost written.') : t('Almost there.')), summary);
|
|
1324
|
+
// The AI arrived while the person was elsewhere: say so, and offer the hello.
|
|
1325
|
+
if (aiReady() && !pull && !(s.talk?.messages?.length > 1)) {
|
|
1326
|
+
const arrived = el('div', 'wl-arrived');
|
|
1327
|
+
arrived.append(el('span', null, t('The AI on your computer has arrived.')), button('wl-btn small', t('Say hello'), () => go('ai')));
|
|
1328
|
+
parts.push(arrived);
|
|
832
1329
|
}
|
|
833
|
-
|
|
834
|
-
|
|
1330
|
+
const learn = button('wl-btn ghost', t('Get to know MADRE'), () => { const after = then ?? host.chapters; finish(); after?.(); });
|
|
1331
|
+
// Into the project without a stop on Home (1.1): it starts waking as this step shows, and the
|
|
1332
|
+
// welcome stays on screen, saying it is opening, until the project's page takes over.
|
|
1333
|
+
const warm = room && connected.length ? (host.warmProject?.(room) ?? Promise.resolve(true)) : null;
|
|
1334
|
+
const enter = async (draft = null, key = null) => {
|
|
1335
|
+
for (const one of actions.querySelectorAll('button')) one.disabled = true;
|
|
1336
|
+
for (const one of content.querySelectorAll('.wl-idea')) one.disabled = true;
|
|
1337
|
+
if (key) key.textContent = t('Opening {name}…', { name: room.name });
|
|
1338
|
+
scene.say(t('Opening {name}…', { name: room.name }));
|
|
1339
|
+
finished = true;
|
|
1340
|
+
await save({ finished: true, done: 'ready', at: 'ready' });
|
|
1341
|
+
await warm?.catch(() => null);
|
|
1342
|
+
const answer = await host.openProject?.(room, { draft });
|
|
1343
|
+
// It did not open: Home says why, on the project's card.
|
|
1344
|
+
if (!answer?.ok) dialog.close();
|
|
1345
|
+
};
|
|
835
1346
|
// Into the project when there is one and an agent to answer (2026-11-01): 90 of 147 copies never
|
|
836
|
-
// opened a project
|
|
837
|
-
//
|
|
838
|
-
// project or an agent, Home as before (2026-10-30), whose first-time cards walk the person there.
|
|
1347
|
+
// opened a project. Since 1.1 with the first message already written (`#escribe=`): the person only
|
|
1348
|
+
// sends it. Without a project or an agent, Home as before, whose first-time cards walk them there.
|
|
839
1349
|
if (room && connected.length) {
|
|
1350
|
+
parts.push(el('p', 'wl-section', born && !intent ? t('Messages to get {name} going', { name: room.name }) : t('Messages you can send to {name}', { name: room.name })));
|
|
1351
|
+
parts.push(el('p', 'wl-ideas-lead', sample
|
|
1352
|
+
? t('{name} is a page with a to-do list. Pick a message: it opens written in the project, and you decide when to send it.', { name: room.name })
|
|
1353
|
+
: t('Pick one: it opens written in {name}, and you decide when to send it. Your AIs read the folder before they answer.', { name: room.name })));
|
|
1354
|
+
const list = el('div', 'wl-ideas');
|
|
1355
|
+
for (const idea of ideas) {
|
|
1356
|
+
// One that ends open is for the person to finish: it opens written up to there.
|
|
1357
|
+
const key = button('wl-idea', null, () => void enter(idea.text, key));
|
|
1358
|
+
const mark = el('span', 'wl-idea-icon');
|
|
1359
|
+
mark.setAttribute('aria-hidden', 'true');
|
|
1360
|
+
mark.innerHTML = trazo(idea.icon); // trusted: our own SVG string
|
|
1361
|
+
const words = el('span', 'wl-idea-text');
|
|
1362
|
+
words.append(el('b', null, idea.open ? `${idea.text.trim()}…` : idea.text));
|
|
1363
|
+
if (idea.what) words.append(el('small', null, idea.what));
|
|
1364
|
+
key.append(mark, words);
|
|
1365
|
+
list.append(key);
|
|
1366
|
+
}
|
|
1367
|
+
parts.push(list);
|
|
1368
|
+
content.replaceChildren(...parts);
|
|
840
1369
|
const home = button('wl-btn ghost', t('Go to Home'), () => finish());
|
|
841
|
-
footer({
|
|
842
|
-
next: t('Open {name}
|
|
843
|
-
onNext: () =>
|
|
1370
|
+
const opening = footer({
|
|
1371
|
+
next: t('Open {name}', { name: room.name }),
|
|
1372
|
+
onNext: () => enter(null, opening),
|
|
844
1373
|
extra: (() => { const keys = el('span', 'wl-keys'); keys.append(learn, home); return keys; })(),
|
|
845
1374
|
});
|
|
846
1375
|
return;
|
|
847
1376
|
}
|
|
1377
|
+
content.replaceChildren(...parts);
|
|
848
1378
|
footer({
|
|
849
1379
|
next: t('Go to Home'),
|
|
850
1380
|
onNext: () => finish(),
|
|
@@ -882,12 +1412,22 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
882
1412
|
} else if (s.install?.running) {
|
|
883
1413
|
s.install = event.payload.ok ? null : { error: event.payload.detail ?? t('It did not install.'), trouble: event.payload.trouble ?? null, manual: event.payload.trouble === 'permission' };
|
|
884
1414
|
}
|
|
885
|
-
void readOllama({ probe: true }).then(
|
|
1415
|
+
void readOllama({ probe: true }).then(async () => {
|
|
1416
|
+
// The next in line goes once the one before is done; the memory is switched on when it is there.
|
|
1417
|
+
if (pull && event.payload.ok && s.queue.length) void startPull(s.queue.shift());
|
|
1418
|
+
if (pull && !event.payload.ok) s.queue = [];
|
|
1419
|
+
if (hasModel(EMBED_MODEL) && s.choice !== 'skip' && s.ollama?.running) { await enableLocal(); }
|
|
1420
|
+
repaint();
|
|
1421
|
+
});
|
|
886
1422
|
}
|
|
887
1423
|
};
|
|
888
1424
|
} catch { /* no stream: «I did it» and the probe keep it current */ }
|
|
889
1425
|
}
|
|
890
|
-
const repaint = () => {
|
|
1426
|
+
const repaint = () => {
|
|
1427
|
+
if (stepId() === 'ai') paintAi();
|
|
1428
|
+
else if (stepId() === 'ready' && !pulling()) void ready();
|
|
1429
|
+
scene.redraw();
|
|
1430
|
+
};
|
|
891
1431
|
|
|
892
1432
|
function show() {
|
|
893
1433
|
leave?.();
|
|
@@ -896,10 +1436,9 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
896
1436
|
content.scrollTop = 0;
|
|
897
1437
|
const id = stepId();
|
|
898
1438
|
if (id === 'hello') hello();
|
|
899
|
-
else if (id === '
|
|
1439
|
+
else if (id === 'use') use();
|
|
900
1440
|
else if (id === 'agents') agents();
|
|
901
1441
|
else if (id === 'ai') ai();
|
|
902
|
-
else if (id === 'memory') memoryStep();
|
|
903
1442
|
else if (id === 'project') project();
|
|
904
1443
|
else void ready();
|
|
905
1444
|
// The key just pressed left with the step it was on: the keyboard and a screen reader start
|
|
@@ -920,6 +1459,7 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
920
1459
|
leave?.();
|
|
921
1460
|
stream?.close();
|
|
922
1461
|
clearInterval(pollTimer);
|
|
1462
|
+
scene.stop();
|
|
923
1463
|
current = null;
|
|
924
1464
|
dialog.remove();
|
|
925
1465
|
host.closed?.();
|
|
@@ -933,19 +1473,24 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
933
1473
|
current = { go: (to) => { s.step = Math.max(0, WELCOME_STEPS.indexOf(to)); show(); }, close: () => dialog.close(), node: dialog };
|
|
934
1474
|
void Promise.all([getJson('/api/tour'), getJson('/api/environment'), readOllama()]).then(([tour, environment]) => {
|
|
935
1475
|
if (!current) return;
|
|
936
|
-
s.progress = tour?.state?.welcome ??
|
|
1476
|
+
s.progress = { ...s.progress, ...(tour?.state?.welcome ?? {}) };
|
|
1477
|
+
s.profile = new Set(s.progress.profile ?? []);
|
|
937
1478
|
s.env = environment?.environment ?? null;
|
|
938
1479
|
s.hardware = environment?.hardware ?? null;
|
|
939
1480
|
s.geminiKey = Boolean(environment?.geminiKey);
|
|
940
1481
|
s.memory = environment?.memory ?? null;
|
|
941
1482
|
const from = at ?? s.progress.at ?? 'hello';
|
|
942
1483
|
s.step = Math.max(0, WELCOME_STEPS.indexOf(from));
|
|
1484
|
+
// Back to a later step, the computer was already read.
|
|
1485
|
+
if (s.step > 0) s.scanned = true;
|
|
943
1486
|
listen();
|
|
944
1487
|
show();
|
|
945
1488
|
if (!s.progress.at) void save({ at: WELCOME_STEPS[s.step] });
|
|
946
1489
|
// The opening plays on the first step; after it the rail's logo is already drawn, and stays still.
|
|
947
1490
|
dialog.classList.remove('waiting');
|
|
948
|
-
|
|
1491
|
+
// Played already as the license was accepted (terms.js): not twice in a row.
|
|
1492
|
+
if (WELCOME_STEPS[s.step] === 'hello' && openingPlayed()) brand.classList.add('still');
|
|
1493
|
+
else if (WELCOME_STEPS[s.step] === 'hello') void playOpening(dialog, { skipLabel: t('Skip') }).then((played) => { if (played) brand.classList.add('still'); });
|
|
949
1494
|
});
|
|
950
1495
|
return current;
|
|
951
1496
|
}
|