@jossuealcala/madre 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.en.md +21 -1
- package/CHANGELOG.md +21 -1
- package/README.en.md +3 -3
- package/README.md +3 -3
- package/SECURITY.md +11 -6
- package/bin/madre.mjs +74 -11
- package/docs/REFERENCE.md +13 -7
- package/docs/SDK.md +8 -8
- package/docs/en/REFERENCE.md +10 -6
- package/docs/en/SDK.md +8 -8
- package/docs/en/training/README.md +1 -1
- package/docs/sdk/connector-module.mjs +1 -1
- package/docs/sdk/hello-module.mjs +1 -1
- package/docs/training/README.md +1 -1
- package/docs/training/train.sh +3 -0
- package/package.json +4 -2
- package/public/activity.js +9 -0
- package/public/app.js +988 -171
- package/public/attribution.js +9 -0
- package/public/brands.js +27 -13
- package/public/en.js +1 -2
- package/public/es.js +834 -257
- package/public/index.html +3 -0
- package/public/macroverso.js +24 -5
- package/public/manual-content.js +32 -2
- package/public/market-view.js +116 -9
- package/public/market.js +15 -0
- package/public/news-scenes.js +185 -0
- package/public/notices.js +66 -0
- package/public/power.js +1 -1
- package/public/resay.js +3 -0
- package/public/salas-mac.css +229 -26
- package/public/salas-mac.html +3 -0
- package/public/salas-mac.js +454 -37
- package/public/styles.css +393 -17
- package/public/tips.js +124 -0
- package/public/tour-chapters.js +75 -75
- package/public/tour.js +36 -8
- package/public/troubleshooting.js +215 -22
- package/public/welcome-scene.js +358 -0
- package/public/welcome.js +514 -273
- package/src/adapters/gemini-rest.mjs +236 -0
- package/src/adapters/gemini.mjs +9 -7
- package/src/adapters/grok.mjs +288 -0
- package/src/adapters/process.mjs +14 -3
- package/src/auth-probe.mjs +32 -0
- package/src/bridge/policy.mjs +1 -1
- package/src/capabilities.mjs +30 -0
- package/src/checkpoint.mjs +115 -1
- package/src/codex-route.mjs +113 -0
- package/src/credentials.mjs +46 -8
- package/src/dataset.mjs +18 -7
- package/src/event-store.mjs +10 -2
- package/src/ficha.mjs +142 -0
- package/src/files.mjs +36 -2
- package/src/lease.mjs +5 -0
- package/src/market-check.mjs +1 -1
- package/src/market-remote.mjs +135 -1
- package/src/mcp/image-server.mjs +1 -1
- package/src/mcp/memory-server.mjs +10 -0
- package/src/memory-tools.mjs +3 -0
- package/src/memory.mjs +29 -4
- package/src/models.mjs +21 -3
- package/src/modules/ahp.mjs +8 -3
- package/src/modules/bishop-exam.mjs +41 -12
- package/src/modules/bishop.mjs +2 -2
- package/src/modules/choices.mjs +12 -10
- package/src/modules/fetch-alone.mjs +7 -0
- package/src/modules/helpers.mjs +23 -5
- package/src/modules/image-studio.mjs +13 -27
- package/src/modules/index.mjs +54 -11
- package/src/modules/isolated.mjs +160 -0
- package/src/modules/ollama.mjs +35 -6
- package/src/modules/playwright.mjs +46 -17
- package/src/modules/run-alone.mjs +122 -0
- package/src/modules/runs.mjs +11 -8
- package/src/modules/sdk.mjs +4 -2
- package/src/notices-key.mjs +8 -0
- package/src/notices.mjs +185 -0
- package/src/ollama.mjs +57 -15
- package/src/outbound.mjs +45 -8
- package/src/room/archivist.mjs +30 -5
- package/src/room/busy.mjs +16 -0
- package/src/room/control.mjs +36 -6
- package/src/room/guard.mjs +32 -2
- package/src/room/prompt.mjs +32 -5
- package/src/room/vectors.mjs +7 -1
- package/src/room.mjs +94 -28
- package/src/router.mjs +1 -1
- package/src/runs.mjs +39 -0
- package/src/runtime-detection.mjs +46 -6
- package/src/salas.mjs +151 -15
- package/src/server.mjs +577 -80
- package/src/service.mjs +116 -0
- package/src/setup-trouble.mjs +20 -1
- package/src/skill-check.mjs +269 -0
- package/src/skills-import.mjs +128 -0
- package/src/skills.mjs +492 -0
- package/src/tour.mjs +14 -3
- package/src/whats-new.mjs +48 -0
- package/src/rumbo.mjs +0 -337
package/public/welcome.js
CHANGED
|
@@ -1,24 +1,33 @@
|
|
|
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
28
|
import { MADRE_LOGO as BRAND_LOGO, playOpening } from './loader.js';
|
|
21
29
|
import { trazo } from './icons.js';
|
|
30
|
+
import { createScene } from './welcome-scene.js';
|
|
22
31
|
|
|
23
32
|
const el = (tag, className = null, text = null) => {
|
|
24
33
|
const node = document.createElement(tag);
|
|
@@ -45,11 +54,43 @@ const number = (value) => new Intl.NumberFormat(language(), { maximumFractionDig
|
|
|
45
54
|
|
|
46
55
|
// The project comes right after the agents (2026-11-01): 90 of 147 copies never opened one, and
|
|
47
56
|
// 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;
|
|
57
|
+
export const WELCOME_STEPS = ['hello', 'use', 'agents', 'project', 'ai', 'ready'];
|
|
50
58
|
const STEP_NAMES = {
|
|
51
|
-
hello: () => t('Hello'),
|
|
52
|
-
|
|
59
|
+
hello: () => t('Hello'), use: () => t('What you want it for'), agents: () => t('Your AIs'), project: () => t('Your projects'),
|
|
60
|
+
ai: () => t('AI on your computer'), ready: () => t('Your first message'),
|
|
61
|
+
};
|
|
62
|
+
// What MADRE is for to this person (src/tour.mjs, WELCOME_PROFILES): the examples follow it.
|
|
63
|
+
const PROFILES = [
|
|
64
|
+
{ id: 'business', title: () => t('My business'), sub: () => t('What I sell, my customers, my social media.') },
|
|
65
|
+
{ id: 'numbers', title: () => t('Invoices and numbers'), sub: () => t('The spreadsheet, the expenses, what the accountant asks for.') },
|
|
66
|
+
{ id: 'code', title: () => t('Programming'), sub: () => t('Websites, apps, the usual repository.') },
|
|
67
|
+
{ id: 'notes', title: () => t('Writing and getting organised'), sub: () => t('Loose notes, to-dos, long texts.') },
|
|
68
|
+
{ id: 'curious', title: () => t('I just want to see what it does'), sub: () => t('Show me, and then I will decide.') },
|
|
69
|
+
];
|
|
70
|
+
// A first message for each, written as a person would ask it, and what to say first to @madre.
|
|
71
|
+
const IDEAS = {
|
|
72
|
+
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')],
|
|
73
|
+
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')],
|
|
74
|
+
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')],
|
|
75
|
+
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')],
|
|
76
|
+
curious: () => [t('Change the colours of the page'), t('Add a task to the list'), t('Tell me what is in this folder')],
|
|
77
|
+
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?')],
|
|
78
|
+
};
|
|
79
|
+
const SUGGESTIONS = {
|
|
80
|
+
business: () => [t('Name an end-of-month promotion'), t('Write to a customer who has not paid, without sounding rude')],
|
|
81
|
+
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')],
|
|
82
|
+
code: () => [t('Explain what a git branch is in two lines'), t('Give me a name for a booking app')],
|
|
83
|
+
notes: () => [t('Make me a list to organise my week'), t('Give me an idea to start a long text')],
|
|
84
|
+
curious: () => [t('What can you do for me?'), t('Tell me something fun in one line')],
|
|
85
|
+
};
|
|
86
|
+
// «Do you already pay for an AI?»: each agent by the plan people know it by.
|
|
87
|
+
const PLANS = {
|
|
88
|
+
codex: () => t('You pay for ChatGPT Plus or Pro: here it is called Codex, ChatGPT working in your files.'),
|
|
89
|
+
claude: () => t('You pay for Claude Pro or Max: you sign in with the same account as on its website.'),
|
|
90
|
+
grok: () => t('You pay for SuperGrok: you sign in with your grok.com account.'),
|
|
91
|
+
cursor: () => t('You pay for Cursor: you sign in with your Cursor account.'),
|
|
92
|
+
gemini: () => t('With your company\'s Google account, or a free key from Google AI Studio.'),
|
|
93
|
+
opencode: () => t('You do not pay for any? OpenCode comes with free models, with a daily limit.'),
|
|
53
94
|
};
|
|
54
95
|
// Ollama's own installer for Linux, shown to copy where it asks for the administrator's password: MADRE
|
|
55
96
|
// never asks for a password nor keeps one (src/modules/ollama.mjs, NEEDS_PASSWORD).
|
|
@@ -66,16 +107,24 @@ const TROUBLE = {
|
|
|
66
107
|
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
108
|
disk: () => t('There is not enough free space on this computer. Free up some space or choose a smaller model.'),
|
|
68
109
|
permission: () => t('This computer did not let MADRE install it. Copy the line below into a terminal, once.'),
|
|
110
|
+
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.'),
|
|
111
|
+
'ollama-closed': () => t('Ollama closed the connection while downloading the model. Check that Ollama is still running and try again; what already arrived stays.'),
|
|
112
|
+
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
113
|
timeout: () => t('It took too long and was stopped. Try again.'),
|
|
70
114
|
};
|
|
71
115
|
|
|
72
116
|
// 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' };
|
|
117
|
+
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
118
|
|
|
75
119
|
// Ollama prints each piece it downloads as «pulling <digest> · 45%» (src/ollama.mjs, pullModel). The
|
|
76
120
|
// first piece is the model itself, by far the heaviest: its share is the download's.
|
|
77
121
|
const PULL_LINE = /^pulling ([0-9a-f]{6,})\b.*?(\d{1,3})%\s*$/;
|
|
78
122
|
|
|
123
|
+
// The tools other than MADRE a folder may come from (src/salas.mjs, TOOL_NAMES): their own names.
|
|
124
|
+
const TOOL_NAMES = { claude: 'Claude Code', codex: 'Codex', gemini: 'Gemini', cursor: 'Cursor', vscode: 'VS Code' };
|
|
125
|
+
// How many of the folders other tools know come marked: the newest, the ones the person works in.
|
|
126
|
+
const MARKED = 5;
|
|
127
|
+
|
|
79
128
|
// THE OPENING plays before the first step (loader.js, shared with the projects).
|
|
80
129
|
|
|
81
130
|
let current = null;
|
|
@@ -91,28 +140,36 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
91
140
|
const main = el('section', 'wl-main');
|
|
92
141
|
const content = el('div', 'wl-content');
|
|
93
142
|
const actions = el('div', 'wl-actions');
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
main.append(
|
|
143
|
+
// No close key (1.1): the welcome is left through its own keys, «Skip for now» on a step or «Go to
|
|
144
|
+
// Home» at the end, so nobody leaves it halfway by a corner without knowing what was left undone.
|
|
145
|
+
main.append(content, actions);
|
|
146
|
+
dialog.addEventListener('cancel', (event) => event.preventDefault());
|
|
97
147
|
shell.append(rail, main);
|
|
98
148
|
dialog.append(shell);
|
|
99
149
|
document.body.append(dialog);
|
|
150
|
+
// One picture for the whole welcome, kept across the steps: it changes shape, it is never rebuilt.
|
|
151
|
+
const scene = createScene();
|
|
100
152
|
|
|
101
153
|
// Everything the steps decide on, read once when it opens and again when it changes.
|
|
102
154
|
const s = {
|
|
103
155
|
step: 0,
|
|
104
|
-
progress: { at: null, done: [], skipped: [], finished: null },
|
|
156
|
+
progress: { at: null, done: [], skipped: [], finished: null, profile: [] },
|
|
105
157
|
env: null, hardware: null, geminiKey: false, memory: null,
|
|
106
158
|
ollama: null, recommended: null,
|
|
107
|
-
|
|
159
|
+
scanned: false, // the greeting has read the computer
|
|
160
|
+
profile: new Set(), // what MADRE is for to this person
|
|
161
|
+
choice: null, // the AI step: here · other · windows · remote · skip
|
|
108
162
|
model: null, // the model chosen for this computer (a rung of the Qwen2.5 ladder)
|
|
109
163
|
pulls: new Map(), // model → { pct, first, phase, error, trouble, running }
|
|
164
|
+
queue: [], // what downloads after the one running: Ollama takes one at a time
|
|
110
165
|
install: null, // Ollama's own install, while it runs: { lines, error, trouble, running }
|
|
111
|
-
tried: null, // «try it»: { said, answer, error, busy }
|
|
112
166
|
address: null, // the AI of another computer: { host, busy, error, ok }
|
|
113
|
-
|
|
167
|
+
talk: null, // the talk with @madre
|
|
114
168
|
agents: null, // /api/settings, as the agents panel last read it
|
|
115
169
|
ready: 0, // agents connected
|
|
170
|
+
found: null, // the folders that look like projects, and the ones other tools know
|
|
171
|
+
picked: null, // the ones marked to bring
|
|
172
|
+
picker: false, // «another folder or a new one» open
|
|
116
173
|
added: [], // the projects added while the welcome was open
|
|
117
174
|
};
|
|
118
175
|
let leave = null; // what the step on screen stops when another one comes
|
|
@@ -154,17 +211,22 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
154
211
|
if (!best) return 'no';
|
|
155
212
|
return fit().accelerated ? 'yes' : 'slow';
|
|
156
213
|
};
|
|
157
|
-
// The model offered first: the one MADRE recommends here, or the one the person
|
|
214
|
+
// The model offered first: the one MADRE recommends here, or the one the person chose instead.
|
|
158
215
|
const offered = () => s.model ?? fit()?.recommended?.run ?? null;
|
|
216
|
+
const fitting = () => (fit()?.models ?? []).filter((model) => model.run !== 'no');
|
|
159
217
|
const smaller = () => {
|
|
160
|
-
const rungs = (
|
|
218
|
+
const rungs = fitting();
|
|
161
219
|
const now = offered();
|
|
162
220
|
const at = rungs.findIndex((model) => model.id === now?.id);
|
|
163
221
|
return at > 0 ? rungs[at - 1] : null;
|
|
164
222
|
};
|
|
165
223
|
const roomFor = (gb) => (s.env?.disk?.freeGb == null ? true : s.env.disk.freeGb >= gb + 2);
|
|
224
|
+
const aiReady = () => Boolean(s.ollama?.running && chatModels().length > 0);
|
|
225
|
+
const pulling = () => [...s.pulls.entries()].find(([, pull]) => pull.running) ?? null;
|
|
226
|
+
const profileOf = () => [...s.profile][0] ?? null;
|
|
227
|
+
const who = () => (s.env?.os === 'macos' ? t('Your Mac') : t('Your computer'));
|
|
166
228
|
|
|
167
|
-
// ---- The rail: the
|
|
229
|
+
// ---- The rail: the steps, where the person is, what is done and what was left for later.
|
|
168
230
|
// The logo draws itself in once, when the welcome opens, and stays in the rail from then on: the
|
|
169
231
|
// steps are repainted under it, never the logo, or its drawing started over with every step.
|
|
170
232
|
const brand = el('div', 'wl-brand');
|
|
@@ -188,12 +250,16 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
188
250
|
item.append(key);
|
|
189
251
|
list.append(item);
|
|
190
252
|
});
|
|
191
|
-
railBody.replaceChildren(list, el('p', 'wl-rail-foot', t('
|
|
253
|
+
railBody.replaceChildren(list, el('p', 'wl-rail-foot', t('It takes about three minutes. What takes long to download keeps downloading while you go on.')));
|
|
192
254
|
}
|
|
193
255
|
|
|
194
256
|
// ---- The parts every step is made of.
|
|
195
|
-
|
|
196
|
-
|
|
257
|
+
// The picture first, then the question and what it means. `caption` says what is happening now.
|
|
258
|
+
const head = (title, lead, picture = null, caption = null) => {
|
|
259
|
+
const nodes = [];
|
|
260
|
+
if (picture) { scene.show(picture.id, picture.data); nodes.push(scene.node); }
|
|
261
|
+
if (caption !== null) scene.say(caption);
|
|
262
|
+
nodes.push(el('h2', 'wl-title', title));
|
|
197
263
|
if (lead) nodes.push(el('p', 'wl-lead', lead));
|
|
198
264
|
return nodes;
|
|
199
265
|
};
|
|
@@ -202,6 +268,12 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
202
268
|
box.append(...children.filter(Boolean).map((child) => (typeof child === 'string' ? el('p', null, child) : child)));
|
|
203
269
|
return box;
|
|
204
270
|
};
|
|
271
|
+
// A word MADRE uses, explained where it first appears, folded: «what is this?».
|
|
272
|
+
const what = (question, answer) => {
|
|
273
|
+
const box = el('details', 'wl-what');
|
|
274
|
+
box.append(el('summary', null, question), el('p', null, answer));
|
|
275
|
+
return box;
|
|
276
|
+
};
|
|
205
277
|
// «See how to fix it», under what went wrong: the card of Diagnostics for it, for this system.
|
|
206
278
|
const fix = (id) => (id ? remedyKey(id, { platform: platformOf(s.env) }) : null);
|
|
207
279
|
const chip = (tone, words) => { const node = el('span', `wl-chip${tone ? ` ${tone}` : ''}`); node.append(el('i'), el('span', null, words)); return node; };
|
|
@@ -246,46 +318,18 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
246
318
|
actions.replaceChildren(...parts);
|
|
247
319
|
return primary;
|
|
248
320
|
};
|
|
321
|
+
const ago = (iso) => {
|
|
322
|
+
if (!iso) return null;
|
|
323
|
+
const days = Math.round((Date.parse(iso) - Date.now()) / 86400000);
|
|
324
|
+
const say = new Intl.RelativeTimeFormat(language(), { numeric: 'auto' });
|
|
325
|
+
if (days > -1) return say.format(0, 'day');
|
|
326
|
+
if (days > -14) return say.format(days, 'day');
|
|
327
|
+
if (days > -60) return say.format(Math.round(days / 7), 'week');
|
|
328
|
+
return say.format(Math.round(days / 30), 'month');
|
|
329
|
+
};
|
|
330
|
+
const homeWord = (path) => String(path ?? '').replace(/^\/(Users|home)\/[^/]+/, '~');
|
|
249
331
|
|
|
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.
|
|
332
|
+
// ---- 1 · HELLO: the language, what MADRE is, and the computer read while the person reads.
|
|
289
333
|
function placeWords() {
|
|
290
334
|
const env = s.env ?? {};
|
|
291
335
|
if (env.place === 'ssh') return t('You\'re connected from another computer (SSH)');
|
|
@@ -300,7 +344,8 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
300
344
|
if (hw.accelerator === 'nvidia') return `${hw.gpus?.[0]?.name ?? 'NVIDIA'} · ${number(hw.acceleratorGb)} GB`;
|
|
301
345
|
return t('None the AI can use');
|
|
302
346
|
}
|
|
303
|
-
|
|
347
|
+
// What the computer is, folded: the person can look, nothing to decide.
|
|
348
|
+
function machineFacts() {
|
|
304
349
|
const env = s.env ?? {};
|
|
305
350
|
const hw = facts();
|
|
306
351
|
const grid = el('div', 'wl-facts');
|
|
@@ -311,11 +356,14 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
311
356
|
fact(t('Memory'), hw.memoryGb ? `${number(hw.memoryGb)} GB` : null);
|
|
312
357
|
fact(t('Graphics card'), graphicsWords());
|
|
313
358
|
fact(t('Free space'), env.disk ? t('{n} GB free', { n: number(env.disk.freeGb) }) : null);
|
|
359
|
+
const fold = el('details', 'wl-more');
|
|
360
|
+
fold.append(el('summary', null, t('See what we found on your computer')), grid, el('p', 'wl-tiny', t('This never leaves your computer. We only use it to know which AI fits.')));
|
|
361
|
+
return fold;
|
|
362
|
+
}
|
|
363
|
+
// What only some places need to know, said in the greeting so nothing surprises later.
|
|
364
|
+
function placeNotes() {
|
|
365
|
+
const env = s.env ?? {};
|
|
314
366
|
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
367
|
if (env.place === 'wsl') notes.push(note('', t('MADRE runs here on Linux, inside Windows (WSL). Your Windows browser opens it directly.')));
|
|
320
368
|
// On Windows itself (docs/WINDOWS.md, D-001): from 1.1.0 MADRE runs inside WSL2, not on Windows directly.
|
|
321
369
|
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 +371,95 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
323
371
|
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
372
|
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
373
|
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
|
-
|
|
374
|
+
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) })));
|
|
375
|
+
return notes;
|
|
376
|
+
}
|
|
377
|
+
function helloCaption() {
|
|
378
|
+
if (!s.scanned) return t('Seeing how powerful your computer is…');
|
|
379
|
+
const gb = number(facts().memoryGb ?? 0);
|
|
380
|
+
const carry = canCarry();
|
|
381
|
+
if (carry === 'yes') return t('{who} has {gb} GB of memory: an AI of its own fits without trouble.', { who: who(), gb });
|
|
382
|
+
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 });
|
|
383
|
+
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 });
|
|
384
|
+
}
|
|
385
|
+
function hello() {
|
|
386
|
+
const seg = el('div', 'wl-seg');
|
|
387
|
+
seg.setAttribute('role', 'radiogroup');
|
|
388
|
+
seg.setAttribute('aria-label', 'Idioma · Language');
|
|
389
|
+
for (const [code, words] of [['es', 'Español'], ['en', 'English']]) {
|
|
390
|
+
const option = button(null, words, async () => {
|
|
391
|
+
if (code === language()) return;
|
|
392
|
+
await host.setLanguage?.(code);
|
|
393
|
+
dialog.setAttribute('aria-label', t('Welcome to MADRE'));
|
|
394
|
+
paintRail();
|
|
395
|
+
show();
|
|
396
|
+
});
|
|
397
|
+
option.setAttribute('role', 'radio');
|
|
398
|
+
option.setAttribute('aria-checked', String(code === language()));
|
|
399
|
+
seg.append(option);
|
|
400
|
+
}
|
|
401
|
+
const picture = { id: 'hello', data: () => ({ scanned: s.scanned }) };
|
|
402
|
+
const greeting = el('div', 'wl-hello');
|
|
403
|
+
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);
|
|
404
|
+
content.replaceChildren(greeting, machineFacts(), ...placeNotes());
|
|
405
|
+
footer({ next: t('Start'), back: false });
|
|
406
|
+
// The computer was read when the welcome opened: the picture takes a moment to say so, as a
|
|
407
|
+
// person would look before answering.
|
|
408
|
+
if (!s.scanned) {
|
|
409
|
+
const timer = setTimeout(() => { s.scanned = true; if (stepId() === 'hello') scene.say(helloCaption()); }, 2400);
|
|
410
|
+
leave = () => clearTimeout(timer);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// ---- 2 · WHAT YOU WANT IT FOR: one or several; the examples from here on follow it.
|
|
415
|
+
function use() {
|
|
416
|
+
const picture = { id: 'use', data: () => ({ items: PROFILES.map((one) => ({ id: one.id, on: s.profile.has(one.id) })) }) };
|
|
417
|
+
const parts = head(t('What do you want it for?'), t('Mark whatever looks like yours. That way the examples we show you are ones that help you, not a programmer\'s.'), picture, s.profile.size ? t('This picks the examples you will see.') : t('Mark one or several.'));
|
|
418
|
+
const grid = el('div', 'wl-tiles');
|
|
419
|
+
for (const one of PROFILES) {
|
|
420
|
+
const tile = button('wl-tile', null, () => {
|
|
421
|
+
if (s.profile.has(one.id)) s.profile.delete(one.id); else s.profile.add(one.id);
|
|
422
|
+
tile.setAttribute('aria-pressed', String(s.profile.has(one.id)));
|
|
423
|
+
scene.say(s.profile.size ? t('This picks the examples you will see.') : t('Mark one or several.'));
|
|
424
|
+
paintUseKeys();
|
|
425
|
+
});
|
|
426
|
+
tile.setAttribute('aria-pressed', String(s.profile.has(one.id)));
|
|
427
|
+
tile.append(el('b', null, one.title()), el('small', null, one.sub()));
|
|
428
|
+
grid.append(tile);
|
|
429
|
+
}
|
|
430
|
+
parts.push(grid);
|
|
431
|
+
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.')));
|
|
432
|
+
content.replaceChildren(...parts);
|
|
433
|
+
paintUseKeys();
|
|
434
|
+
}
|
|
435
|
+
function paintUseKeys() {
|
|
436
|
+
footer({
|
|
437
|
+
next: s.profile.size ? t('Continue') : t('Continue without marking'),
|
|
438
|
+
onNext: async () => {
|
|
439
|
+
await save({ profile: [...s.profile] });
|
|
440
|
+
go(s.step + 1, s.profile.size ? 'done' : 'skip');
|
|
441
|
+
},
|
|
442
|
+
});
|
|
329
443
|
}
|
|
330
444
|
|
|
331
|
-
// ---- 3 · YOUR
|
|
445
|
+
// ---- 3 · YOUR AIs: «do you already pay for one?», in the names people know them by. Home's own
|
|
446
|
+
// panel connects them; the ones already signed in on this computer come connected.
|
|
332
447
|
function explainAgent(agent, state) {
|
|
333
448
|
const env = s.env ?? {};
|
|
334
|
-
|
|
335
|
-
if (
|
|
336
|
-
if (
|
|
337
|
-
if (
|
|
338
|
-
|
|
449
|
+
const lines = [];
|
|
450
|
+
if (!state.ok && PLANS[agent.id]) lines.push(el('p', 'wl-agent-plan', PLANS[agent.id]()));
|
|
451
|
+
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).')));
|
|
452
|
+
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.')));
|
|
453
|
+
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.')));
|
|
454
|
+
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.')));
|
|
455
|
+
if (!lines.length) return null;
|
|
456
|
+
if (lines.length === 1) return lines[0];
|
|
457
|
+
const box = el('div', 'wl-agent-notes');
|
|
458
|
+
box.append(...lines);
|
|
459
|
+
return box;
|
|
339
460
|
}
|
|
461
|
+
const agentItems = () => (s.agents?.agents ?? []).filter((agent) => agent.id !== 'madre').map((agent) => ({ id: agent.id, on: Boolean(host.agentState?.(agent, s.agents)?.ok) }));
|
|
462
|
+
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
463
|
function agents() {
|
|
341
464
|
const panel = host.agentsPanel?.({
|
|
342
465
|
compact: true,
|
|
@@ -344,15 +467,18 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
344
467
|
onPaint: (ready, answer) => {
|
|
345
468
|
s.ready = ready;
|
|
346
469
|
s.agents = answer;
|
|
470
|
+
scene.say(agentsCaption());
|
|
347
471
|
paintAgentKeys();
|
|
348
472
|
},
|
|
349
473
|
});
|
|
350
|
-
|
|
474
|
+
const picture = { id: 'agents', data: () => ({ items: agentItems() }) };
|
|
475
|
+
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
476
|
if (panel) {
|
|
352
477
|
content.append(panel.node);
|
|
353
478
|
void panel.paint().then(() => panel.live());
|
|
354
479
|
leave = () => panel.stop();
|
|
355
480
|
}
|
|
481
|
+
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
482
|
footer({ nextOff: !s.ready, skip: { note: t('Without agents, MADRE cannot work for you.') } });
|
|
357
483
|
paintAgentKeys();
|
|
358
484
|
}
|
|
@@ -363,78 +489,238 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
363
489
|
for (const node of actions.querySelectorAll('.wl-skipnote, [data-skip]')) node.hidden = Boolean(s.ready);
|
|
364
490
|
}
|
|
365
491
|
|
|
366
|
-
// ----
|
|
367
|
-
|
|
492
|
+
// ---- 4 · YOUR PROJECTS: what the person already has, brought along like a phone's backup.
|
|
493
|
+
async function loadFound() {
|
|
494
|
+
const answer = await getJson('/api/salas/suggestions');
|
|
495
|
+
s.found = answer?.suggestions ?? [];
|
|
496
|
+
s.finding = false;
|
|
497
|
+
// The newest folders another tool knows come marked; with none, nothing is marked for them.
|
|
498
|
+
if (!s.picked) s.picked = new Set(s.found.filter((one) => one.from?.length).slice(0, MARKED).map((one) => one.path));
|
|
499
|
+
if (stepId() === 'project') project();
|
|
500
|
+
}
|
|
501
|
+
const projectCaption = () => {
|
|
502
|
+
const n = s.picked?.size ?? 0;
|
|
503
|
+
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.');
|
|
504
|
+
};
|
|
505
|
+
function project() {
|
|
506
|
+
const had = host.projects?.() ?? [];
|
|
507
|
+
if (!s.found && !s.finding) { s.finding = true; void loadFound(); }
|
|
508
|
+
const found = s.found ?? [];
|
|
509
|
+
const looking = !s.found;
|
|
510
|
+
const known = found.some((one) => one.from?.length);
|
|
511
|
+
const picture = { id: 'project', data: () => ({ count: s.picked?.size ?? 0 }) };
|
|
512
|
+
const lead = looking ? t('Looking for your folders…') : !found.length ? t('Choose a folder you work in, or make a new one.')
|
|
513
|
+
: known ? t('You already opened these folders with other tools. We marked the ones you used most recently; untick the ones you do not want.')
|
|
514
|
+
: t('These folders look like projects. Mark the ones you want to bring.');
|
|
515
|
+
const parts = head(t('Bring what you already have'), lead, picture, projectCaption());
|
|
516
|
+
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.')));
|
|
517
|
+
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 })));
|
|
518
|
+
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')));
|
|
519
|
+
if (found.length) {
|
|
520
|
+
const list = el('div', 'wl-found');
|
|
521
|
+
for (const one of found) {
|
|
522
|
+
const on = s.picked?.has(one.path);
|
|
523
|
+
const row = button('wl-found-row', null, () => {
|
|
524
|
+
if (s.picked.has(one.path)) s.picked.delete(one.path); else s.picked.add(one.path);
|
|
525
|
+
row.setAttribute('aria-checked', String(s.picked.has(one.path)));
|
|
526
|
+
scene.say(projectCaption());
|
|
527
|
+
paintProjectKeys();
|
|
528
|
+
});
|
|
529
|
+
row.setAttribute('role', 'checkbox');
|
|
530
|
+
row.setAttribute('aria-checked', String(Boolean(on)));
|
|
531
|
+
const box = el('span', 'wl-box');
|
|
532
|
+
box.innerHTML = TICK; // trusted: our own SVG string
|
|
533
|
+
const words = el('span', 'wl-found-words');
|
|
534
|
+
words.append(el('b', null, one.name), el('small', null, [homeWord(one.path), ago(one.when)].filter(Boolean).join(' · ')));
|
|
535
|
+
const from = el('span', 'wl-from');
|
|
536
|
+
if (one.from?.length) for (const tool of one.from) from.append(el('span', null, t('You opened it with {tool}', { tool: TOOL_NAMES[tool] ?? tool })));
|
|
537
|
+
else from.append(el('span', null, t('Looks like a project')));
|
|
538
|
+
row.append(box, words, from);
|
|
539
|
+
list.append(row);
|
|
540
|
+
}
|
|
541
|
+
parts.push(list);
|
|
542
|
+
}
|
|
543
|
+
// Other ways in: any folder or a new one (Home's own picker), or a project made to practise in.
|
|
544
|
+
const others = el('div', 'wl-otherways');
|
|
545
|
+
const browse = button('wl-tile', null, () => { s.picker = !s.picker; project(); });
|
|
546
|
+
browse.setAttribute('aria-pressed', String(s.picker));
|
|
547
|
+
browse.append(el('b', null, t('Another folder, or a new one')), el('small', null, t('Look on your computer, or make an empty folder with a name.')));
|
|
548
|
+
// No project at hand (2026-11-01): one made to try MADRE, a page with a list of tasks and a README
|
|
549
|
+
// with what to ask. «I do not know what I would do with MADRE» is answered by having something.
|
|
550
|
+
const sample = button('wl-tile', null, async () => {
|
|
551
|
+
sample.disabled = true;
|
|
552
|
+
const answer = await post('/api/salas/new', { sample: true, language: language() });
|
|
553
|
+
if (!answer.ok) { sampleSaid.textContent = answer.body?.error ?? t('The project to try MADRE could not be made.'); sample.disabled = false; return; }
|
|
554
|
+
s.added = [...s.added, ...(answer.body.added ?? [])];
|
|
555
|
+
await host.refresh?.();
|
|
556
|
+
if (stepId() === 'project') go(s.step + 1, 'done');
|
|
557
|
+
});
|
|
558
|
+
const sampleSaid = el('small', null, t('A page with a list of tasks, to ask your AIs for changes without fear of breaking anything.'));
|
|
559
|
+
sample.append(el('b', null, t('A practice one')), sampleSaid);
|
|
560
|
+
others.append(browse, sample);
|
|
561
|
+
parts.push(el('p', 'wl-section', found.length ? t('Would you rather start another way?') : t('Or start another way')), others);
|
|
562
|
+
if (s.picker) {
|
|
563
|
+
const picker = host.projectPicker?.({
|
|
564
|
+
// A project made new here does not drop the folders already chosen (QA 1.1.0, NUE-08): they
|
|
565
|
+
// are added too, and the found ones stay marked.
|
|
566
|
+
onAdded: (added) => {
|
|
567
|
+
s.added = [...s.added, ...(added ?? [])];
|
|
568
|
+
s.picker = false;
|
|
569
|
+
s.found = null;
|
|
570
|
+
if (stepId() === 'project') project();
|
|
571
|
+
},
|
|
572
|
+
});
|
|
573
|
+
if (picker) parts.push(picker.node);
|
|
574
|
+
}
|
|
575
|
+
if (s.added.length) parts.push(note('ok', s.added.length === 1 ? t('{name} was added to Home.', { name: s.added[0].name }) : t('{n} projects were added to Home.', { n: s.added.length })));
|
|
576
|
+
content.replaceChildren(...parts);
|
|
577
|
+
paintProjectKeys();
|
|
578
|
+
}
|
|
579
|
+
function paintProjectKeys() {
|
|
580
|
+
const n = s.picked?.size ?? 0;
|
|
581
|
+
const had = (host.projects?.() ?? []).length + s.added.length;
|
|
582
|
+
footer({
|
|
583
|
+
next: n ? (n === 1 ? t('Bring 1 project') : t('Bring {n} projects', { n })) : t('Continue'),
|
|
584
|
+
nextOff: !n && !had,
|
|
585
|
+
onNext: async () => {
|
|
586
|
+
if (n) {
|
|
587
|
+
const answer = await post('/api/salas/projects', { roots: [...s.picked] });
|
|
588
|
+
if (!answer.ok) { content.append(note('bad', answer.body?.refused?.[0]?.error ?? answer.body?.error ?? t('They could not be added.'))); return; }
|
|
589
|
+
s.added = [...s.added, ...(answer.body.added ?? [])];
|
|
590
|
+
s.picked.clear();
|
|
591
|
+
s.found = null;
|
|
592
|
+
await host.refresh?.();
|
|
593
|
+
}
|
|
594
|
+
go(s.step + 1, 'done');
|
|
595
|
+
},
|
|
596
|
+
skip: n || had ? null : { note: t('You can add it from Home.') },
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// ---- 5 · AI ON YOUR COMPUTER: what it is, who uses it (the Coordinator), and one press that
|
|
601
|
+
// brings Ollama, the model and the memory's model, downloading while the person goes on. Or another
|
|
602
|
+
// computer's, or later. Once it is there, a first talk with it.
|
|
603
|
+
function aiPicture() {
|
|
604
|
+
const pull = pulling();
|
|
605
|
+
const model = offered();
|
|
606
|
+
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') };
|
|
607
|
+
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)} %` };
|
|
608
|
+
return { state: s.choice === 'skip' ? 'skip' : 'idle', model: model?.label ?? '', detail: '' };
|
|
609
|
+
}
|
|
610
|
+
function aiCaption() {
|
|
611
|
+
const pull = pulling();
|
|
612
|
+
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] });
|
|
613
|
+
if (aiReady()) return t('It lives here now. Say hello below.');
|
|
614
|
+
if (s.choice === 'skip') return t('You can turn it on whenever you want.');
|
|
615
|
+
return t('Choose, and it downloads while you go on.');
|
|
616
|
+
}
|
|
368
617
|
function aiChoices() {
|
|
369
618
|
const env = s.env ?? {};
|
|
370
619
|
const carry = canCarry();
|
|
371
|
-
const model = offered();
|
|
372
620
|
const pick = (value) => {
|
|
373
621
|
s.choice = value;
|
|
374
622
|
// 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());
|
|
623
|
+
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
624
|
paintAi();
|
|
377
625
|
};
|
|
378
626
|
const options = [];
|
|
379
|
-
|
|
627
|
+
const recommended = fit()?.recommended?.run ?? null;
|
|
628
|
+
if (recommended) {
|
|
380
629
|
const sub = carry === 'yes'
|
|
381
|
-
? t('
|
|
382
|
-
: t('The one
|
|
383
|
-
options.push(choice('ai', 'here', s.choice, t('
|
|
630
|
+
? 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 })
|
|
631
|
+
: 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) });
|
|
632
|
+
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
633
|
}
|
|
634
|
+
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
635
|
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
636
|
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
637
|
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
638
|
return choices(t('AI on your computer'), ...options);
|
|
389
639
|
}
|
|
640
|
+
// The other models this computer carries: the same ladder, each with what it weighs.
|
|
641
|
+
function otherModels() {
|
|
642
|
+
const grid = el('div', 'wl-models');
|
|
643
|
+
const best = fit()?.recommended?.run?.id;
|
|
644
|
+
for (const model of fitting()) {
|
|
645
|
+
const key = button('wl-model', null, () => { s.model = model; paintAi(); });
|
|
646
|
+
key.setAttribute('aria-pressed', String(offered()?.id === model.id));
|
|
647
|
+
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')));
|
|
648
|
+
grid.append(key);
|
|
649
|
+
}
|
|
650
|
+
return grid;
|
|
651
|
+
}
|
|
390
652
|
let aiBody = null;
|
|
391
653
|
function ai() {
|
|
392
654
|
const carry = canCarry();
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
|
|
655
|
+
const lead = carry === 'no'
|
|
656
|
+
? 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.')
|
|
657
|
+
: carry === 'slow'
|
|
658
|
+
? 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.')
|
|
659
|
+
: 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
660
|
// Chosen before: what is already there says which way this goes.
|
|
397
661
|
if (!s.choice && s.ollama?.running && chatModels().length) s.choice = localHost(s.ollama.host) ? 'here' : (s.env?.place === 'wsl' ? 'windows' : 'remote');
|
|
662
|
+
const coordinator = el('div', 'wl-coordinator');
|
|
663
|
+
const words = el('div');
|
|
664
|
+
words.append(
|
|
665
|
+
el('b', null, t('Your Coordinator works with it')),
|
|
666
|
+
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.')),
|
|
667
|
+
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.')),
|
|
668
|
+
);
|
|
669
|
+
coordinator.append(host.mark?.('bishop', 34) ?? el('span'), words);
|
|
398
670
|
aiBody = el('div', 'wl-ai');
|
|
399
|
-
content.replaceChildren(...head(t('AI on your computer'),
|
|
671
|
+
content.replaceChildren(...head(t('An AI that lives on your computer'), lead, { id: 'ai', data: aiPicture }, aiCaption()), coordinator, aiBody);
|
|
400
672
|
paintAi();
|
|
401
673
|
// While Ollama is not there yet, MADRE looks every few seconds: «I did it» is a courtesy.
|
|
402
674
|
clearInterval(pollTimer);
|
|
403
675
|
pollTimer = setInterval(() => {
|
|
404
|
-
if (document.hidden || !['here', '
|
|
405
|
-
if (s.choice !== 'here') return;
|
|
676
|
+
if (document.hidden || !['here', 'other'].includes(s.choice) || s.ollama?.running) return;
|
|
406
677
|
void readOllama({ probe: true }).then(() => { if (stepId() === 'ai') paintAi(); });
|
|
407
678
|
}, 5000);
|
|
408
679
|
leave = () => { clearInterval(pollTimer); pollTimer = 0; };
|
|
409
680
|
}
|
|
410
681
|
function paintAi() {
|
|
411
682
|
if (!aiBody?.isConnected) return;
|
|
683
|
+
scene.say(aiCaption());
|
|
684
|
+
scene.redraw();
|
|
412
685
|
const blocks = [aiChoices()];
|
|
413
|
-
if (s.choice === '
|
|
686
|
+
if (s.choice === 'other') blocks.push(otherModels());
|
|
687
|
+
if (s.choice === 'here' || s.choice === 'other') blocks.push(installFlow());
|
|
414
688
|
if (s.choice === 'windows' || s.choice === 'remote') blocks.push(addressFlow());
|
|
689
|
+
// Once its model is there, a first talk with it, wherever it runs.
|
|
690
|
+
if (s.choice !== 'skip' && aiReady()) blocks.push(talkFlow());
|
|
415
691
|
aiBody.replaceChildren(...blocks);
|
|
416
|
-
|
|
692
|
+
// With the AI there, its memory comes on its own: nothing to press.
|
|
693
|
+
if ((s.choice === 'here' || s.choice === 'other') && aiReady() && !hasModel(EMBED_MODEL) && !s.pulls.has(EMBED_MODEL) && !pulling()) void startPull(EMBED_MODEL);
|
|
694
|
+
const going = Boolean(pulling()) || s.queue.length > 0;
|
|
417
695
|
// «Not now» is one of the choices: no second key to leave it for later.
|
|
418
696
|
footer({
|
|
419
|
-
|
|
697
|
+
next: going ? t('Continue while it downloads') : t('Continue'),
|
|
698
|
+
nextOff: s.choice === null || (s.choice !== 'skip' && !aiReady() && !going),
|
|
420
699
|
onNext: async () => {
|
|
421
700
|
if (s.choice === 'skip') { go(s.step + 1, 'skip'); return; }
|
|
422
|
-
await enableLocal();
|
|
701
|
+
if (s.ollama?.running) await enableLocal();
|
|
423
702
|
go(s.step + 1, 'done');
|
|
424
703
|
},
|
|
425
704
|
});
|
|
426
705
|
}
|
|
427
|
-
// On for every project, and every open project told (Home › Settings › Local AI does the same).
|
|
706
|
+
// On for every project, and every open project told (Home › Settings › Local AI does the same). The
|
|
707
|
+
// memory searches by meaning on this computer as soon as its model is there.
|
|
428
708
|
async function enableLocal() {
|
|
429
709
|
await post('/api/ollama/settings', { enabled: true, embeddings: true });
|
|
430
710
|
await post('/api/salas/local-ai', {});
|
|
711
|
+
if (hasModel(EMBED_MODEL)) await useLocalMemory();
|
|
712
|
+
}
|
|
713
|
+
async function useLocalMemory() {
|
|
714
|
+
if (s.memory?.embedProvider === 'ollama') return;
|
|
715
|
+
const answer = await post('/api/settings', { memory: { embedProvider: 'ollama' } });
|
|
716
|
+
if (answer.ok) s.memory = { ...(s.memory ?? {}), embedProvider: 'ollama' };
|
|
431
717
|
}
|
|
432
718
|
function installFlow() {
|
|
433
719
|
const env = s.env ?? {};
|
|
434
720
|
const box = el('div', 'wl-card wl-flow');
|
|
435
721
|
const info = s.ollama ?? {};
|
|
436
722
|
// 1 · Ollama itself.
|
|
437
|
-
box.append(el('b', 'wl-flow-title', t('1 ·
|
|
723
|
+
box.append(el('b', 'wl-flow-title', t('1 · Ollama, the program that runs it')));
|
|
438
724
|
if (info.running) box.append(chip('ok', info.version ? t('Installed and open · {version}', { version: info.version }) : t('Installed and open')));
|
|
439
725
|
else if (info.binary) {
|
|
440
726
|
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 +766,7 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
480
766
|
box.append(row);
|
|
481
767
|
}
|
|
482
768
|
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
|
|
769
|
+
// 2 · The model and its memory, once Ollama answers.
|
|
484
770
|
if (info.running) box.append(...modelFlow());
|
|
485
771
|
return box;
|
|
486
772
|
}
|
|
@@ -496,52 +782,73 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
496
782
|
});
|
|
497
783
|
return key;
|
|
498
784
|
};
|
|
499
|
-
// The model
|
|
785
|
+
// The model and the memory's model, downloaded one after the other with their real share.
|
|
500
786
|
function modelFlow() {
|
|
501
787
|
const parts = [];
|
|
502
788
|
const have = chatModels();
|
|
503
789
|
const model = offered();
|
|
504
|
-
const
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
parts.push(
|
|
790
|
+
const memory = memoryLine();
|
|
791
|
+
// Another model chosen and not there yet is downloaded; otherwise the one there is used.
|
|
792
|
+
const wantsOther = s.choice === 'other' && s.model && !hasModel(s.model.ollama);
|
|
793
|
+
if (have.length && !wantsOther && (!model || !s.pulls.get(model.ollama)?.running)) {
|
|
794
|
+
parts.push(el('b', 'wl-flow-title', t('2 · The AI and its memory')));
|
|
795
|
+
parts.push(chip('ok', t('Ready · {model}', { model: s.ollama?.chatModel ?? have[0].name })));
|
|
796
|
+
if (memory) parts.push(...memory);
|
|
509
797
|
return parts;
|
|
510
798
|
}
|
|
511
799
|
if (!model) {
|
|
512
|
-
parts.push(el('b', 'wl-flow-title', t('2 · The
|
|
800
|
+
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
801
|
return parts;
|
|
514
802
|
}
|
|
515
|
-
parts.push(el('b', 'wl-flow-title', t('2 · Download {model}', { model: model.label })));
|
|
803
|
+
parts.push(el('b', 'wl-flow-title', t('2 · Download {model} and its memory', { model: model.label })));
|
|
516
804
|
const pull = s.pulls.get(model.ollama);
|
|
517
805
|
if (pull?.running) {
|
|
518
806
|
const pct = pull.pct ?? 0;
|
|
519
807
|
const got = ((model.sizeGb ?? 0) * pct) / 100;
|
|
520
808
|
const line = el('div', 'wl-row wl-pull-line');
|
|
521
809
|
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);
|
|
810
|
+
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
811
|
return parts;
|
|
524
812
|
}
|
|
525
813
|
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
814
|
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')));
|
|
815
|
+
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
816
|
}
|
|
529
817
|
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
818
|
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
|
|
819
|
+
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
820
|
get.disabled = !roomFor(model.sizeGb ?? 0) && !pull?.error;
|
|
533
821
|
row.append(get);
|
|
534
822
|
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(); }));
|
|
823
|
+
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
824
|
parts.push(row, el('small', 'wl-tiny', t('It downloads once and stays in Ollama.')));
|
|
537
825
|
return parts;
|
|
538
826
|
}
|
|
827
|
+
// The memory's own line: its model downloading after the AI, or there.
|
|
828
|
+
function memoryLine() {
|
|
829
|
+
if (hasModel(EMBED_MODEL)) return [chip('ok', t('Memory model ready · {model}', { model: EMBED_MODEL }))];
|
|
830
|
+
const pull = s.pulls.get(EMBED_MODEL);
|
|
831
|
+
if (pull?.running) {
|
|
832
|
+
const line = el('div', 'wl-row wl-pull-line');
|
|
833
|
+
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));
|
|
834
|
+
return [bar(pull.pct ?? 0), line];
|
|
835
|
+
}
|
|
836
|
+
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))];
|
|
837
|
+
if (pull?.cancelled) return [button('wl-btn small', t('Continue the download'), () => void startPull(EMBED_MODEL))];
|
|
838
|
+
return [button('wl-btn small', t('Download the memory model · {mb} MB', { mb: EMBED_MB }), () => void startPull(EMBED_MODEL))];
|
|
839
|
+
}
|
|
840
|
+
// One press: the AI, then its memory. Ollama takes one download at a time, so the second waits.
|
|
841
|
+
function getAll(model) {
|
|
842
|
+
s.queue = hasModel(EMBED_MODEL) || s.pulls.get(EMBED_MODEL)?.running ? [] : [EMBED_MODEL];
|
|
843
|
+
return startPull(model);
|
|
844
|
+
}
|
|
539
845
|
// Stopping a download halfway: the server stops asking Ollama for it (/api/ollama/pull/cancel).
|
|
540
846
|
const cancelKey = (model, pull) => {
|
|
541
847
|
const key = button('wl-btn ghost small', pull.cancelling ? t('Cancelling…') : t('Cancel'), async () => {
|
|
542
848
|
pull.cancelling = true;
|
|
543
849
|
key.disabled = true;
|
|
544
850
|
key.textContent = t('Cancelling…');
|
|
851
|
+
s.queue = [];
|
|
545
852
|
const answer = await post('/api/ollama/pull/cancel', { model });
|
|
546
853
|
if (!answer.ok) { pull.cancelling = false; key.disabled = false; key.textContent = t('Cancel'); }
|
|
547
854
|
});
|
|
@@ -555,24 +862,28 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
555
862
|
if (!answer.ok) s.pulls.set(model, { error: answer.body?.error ?? t('Home did not answer.') });
|
|
556
863
|
repaint();
|
|
557
864
|
}
|
|
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
|
-
|
|
865
|
+
// «Say hello» (2026-10-28, again in 1.1): a talk with @madre, not a form. It greets first as soon
|
|
866
|
+
// as its model is there, answers as it writes (the server streams what Ollama says), and keeps the
|
|
867
|
+
// turns before, so the person can go on. Under each answer, how long it took and where it ran. Its
|
|
868
|
+
// suggestions follow what MADRE is for to this person, and leave once used. Built once and kept:
|
|
869
|
+
// the downloads repaint the step, and a talk being written must not be rebuilt under the person.
|
|
870
|
+
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.');
|
|
871
|
+
const offline = () => localHost(s.ollama?.host);
|
|
872
|
+
function talkFlow() {
|
|
873
|
+
s.talk ??= { messages: [], busy: false, error: null, node: null, greeted: false, asked: new Set() };
|
|
566
874
|
if (!s.talk.node) s.talk.node = talkNode();
|
|
567
875
|
if (!s.talk.greeted) { s.talk.greeted = true; void say(GREETING(), { hidden: true }); }
|
|
568
|
-
return
|
|
876
|
+
return s.talk.node;
|
|
569
877
|
}
|
|
570
878
|
function talkNode() {
|
|
571
879
|
const box = el('div', 'wl-talk-card');
|
|
880
|
+
const top = el('div', 'wl-talk-head');
|
|
881
|
+
const words = el('div');
|
|
882
|
+
words.append(el('b', null, '@madre'), el('small', null, t('In any project you call it by writing @madre.')));
|
|
883
|
+
top.append(host.mark?.('madre', 28) ?? el('span', 'wl-msg-face'), words, chip('ok', offline() ? t('No internet') : t('On the other computer')));
|
|
572
884
|
const list = el('div', 'wl-talk');
|
|
573
885
|
list.setAttribute('aria-live', 'polite');
|
|
574
886
|
const chips = el('div', 'wl-chips');
|
|
575
|
-
for (const words of SUGGESTIONS()) chips.append(button('wl-chip-key', words, () => void say(words)));
|
|
576
887
|
const form = el('form', 'wl-try wl-talk-form');
|
|
577
888
|
const input = el('input', 'wl-field');
|
|
578
889
|
input.placeholder = t('Write to @madre…');
|
|
@@ -581,11 +892,18 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
581
892
|
send.type = 'submit';
|
|
582
893
|
form.append(input, send);
|
|
583
894
|
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));
|
|
895
|
+
box.append(top, list, chips, form);
|
|
586
896
|
box.refs = { list, chips, input, send };
|
|
897
|
+
paintChips(box.refs);
|
|
587
898
|
return box;
|
|
588
899
|
}
|
|
900
|
+
function paintChips({ chips }) {
|
|
901
|
+
const said = s.talk?.asked ?? new Set();
|
|
902
|
+
const own = SUGGESTIONS[profileOf()]?.() ?? SUGGESTIONS.curious();
|
|
903
|
+
chips.replaceChildren();
|
|
904
|
+
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)));
|
|
905
|
+
chips.hidden = (s.talk?.messages ?? []).filter((one) => one.role === 'user').length > 3;
|
|
906
|
+
}
|
|
589
907
|
async function say(words, { hidden = false } = {}) {
|
|
590
908
|
const talk = s.talk;
|
|
591
909
|
const { list, chips, input, send } = talk.node.refs;
|
|
@@ -594,17 +912,18 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
594
912
|
talk.error = null;
|
|
595
913
|
send.disabled = true;
|
|
596
914
|
chips.hidden = true;
|
|
915
|
+
if (!hidden) talk.asked.add(words);
|
|
597
916
|
talk.node.querySelector('.wl-talk-error')?.remove();
|
|
598
917
|
talk.messages.push({ role: 'user', content: words });
|
|
599
918
|
if (!hidden) list.append(el('p', 'wl-bubble me', words));
|
|
600
|
-
// @madre's turn:
|
|
919
|
+
// @madre's turn: three dots while it thinks, then its words as they come, then how it went.
|
|
601
920
|
const row = el('div', 'wl-msg');
|
|
602
|
-
const face = host.mark?.('madre', 26) ?? el('span', 'wl-msg-face');
|
|
603
921
|
const bubble = el('p', 'wl-bubble wl-typing');
|
|
604
922
|
bubble.append(el('i'), el('i'), el('i'));
|
|
605
|
-
row.append(
|
|
923
|
+
row.append(bubble);
|
|
606
924
|
list.append(row);
|
|
607
925
|
list.scrollTop = list.scrollHeight;
|
|
926
|
+
const started = performance.now();
|
|
608
927
|
let text = '';
|
|
609
928
|
try {
|
|
610
929
|
const response = await fetch('/api/local-ai/try', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ messages: talk.messages }) });
|
|
@@ -619,6 +938,8 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
619
938
|
}
|
|
620
939
|
if (!text.trim()) throw new Error(t('The local AI did not answer.'));
|
|
621
940
|
talk.messages.push({ role: 'assistant', content: text.trim() });
|
|
941
|
+
const seconds = number(Math.max(0.1, (performance.now() - started) / 1000));
|
|
942
|
+
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
943
|
} catch (error) {
|
|
623
944
|
row.remove();
|
|
624
945
|
talk.messages.pop();
|
|
@@ -630,11 +951,11 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
630
951
|
bubble.classList.remove('wl-writing');
|
|
631
952
|
talk.busy = false;
|
|
632
953
|
send.disabled = false;
|
|
633
|
-
|
|
954
|
+
paintChips(talk.node.refs);
|
|
955
|
+
list.scrollTop = list.scrollHeight;
|
|
634
956
|
if (!hidden && document.activeElement === document.body) input.focus({ preventScroll: true });
|
|
635
957
|
}
|
|
636
958
|
}
|
|
637
|
-
// The AI of another computer, or of Windows from inside WSL: its address, tried before it is kept.
|
|
638
959
|
function addressFlow() {
|
|
639
960
|
const env = s.env ?? {};
|
|
640
961
|
const box = el('div', 'wl-card wl-flow');
|
|
@@ -672,114 +993,10 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
672
993
|
return box;
|
|
673
994
|
}
|
|
674
995
|
|
|
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.
|
|
996
|
+
// ---- 6 · YOUR FIRST MESSAGE: what is ready, said in one line each, and a project opened with a
|
|
997
|
+
// first message already written for this person. Anything left for later has its key.
|
|
781
998
|
async function ready() {
|
|
782
|
-
content.replaceChildren(...head(t('
|
|
999
|
+
content.replaceChildren(...head(t('Where do we start?'), null, { id: 'ready', data: () => ({ text: '' }) }, t('Reading…')));
|
|
783
1000
|
actions.replaceChildren();
|
|
784
1001
|
const settings = s.agents ?? await getJson('/api/settings');
|
|
785
1002
|
await readOllama();
|
|
@@ -788,13 +1005,16 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
788
1005
|
const rooms = host.projects?.() ?? [];
|
|
789
1006
|
const added = s.added.map((one) => rooms.find((room) => room.root === one.root || room.name === one.name)).filter(Boolean);
|
|
790
1007
|
const room = added[0] ?? rooms[0] ?? null;
|
|
791
|
-
const
|
|
792
|
-
const
|
|
1008
|
+
const sample = s.added.some((one) => one.sample && (room?.root === one.root || room?.name === one.name));
|
|
1009
|
+
const ideas = (IDEAS[sample ? 'curious' : profileOf() ?? 'none'] ?? IDEAS.none)();
|
|
1010
|
+
const pull = pulling();
|
|
1011
|
+
const aiWords = aiReady() && !pull
|
|
1012
|
+
? (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')}`}`)
|
|
1013
|
+
: pull ? t('Still downloading; we will tell you when it arrives') : t('Whenever you want, in Settings');
|
|
793
1014
|
const rows = [
|
|
794
|
-
[t('
|
|
795
|
-
[t('
|
|
796
|
-
[t('
|
|
797
|
-
[t('Project'), room ? room.name : t('None yet'), Boolean(room), 'project'],
|
|
1015
|
+
[t('Your AIs'), connected.length ? new Intl.ListFormat(language(), { type: 'conjunction' }).format(connected) : t('None connected yet'), connected.length > 0, 'agents'],
|
|
1016
|
+
[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'],
|
|
1017
|
+
[t('AI on your computer'), aiWords, aiReady() || Boolean(pull), 'ai'],
|
|
798
1018
|
];
|
|
799
1019
|
const summary = el('div', 'wl-card wl-checks');
|
|
800
1020
|
for (const [title, sub, ok, id] of rows) {
|
|
@@ -808,43 +1028,51 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
808
1028
|
if (!ok) row.append(button('wl-btn small', t('Do it now'), () => go(id)));
|
|
809
1029
|
summary.append(row);
|
|
810
1030
|
}
|
|
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.')));
|
|
1031
|
+
const parts = [];
|
|
1032
|
+
const lead = room && connected.length
|
|
1033
|
+
? t('We open {name}. Tap an idea and it stays written so you only send it, or write your own.', { name: room.name })
|
|
1034
|
+
: t('Here is what is ready. Anything you left for later has its button.');
|
|
1035
|
+
parts.push(...head(t('Where do we start?'), lead, { id: 'ready', data: () => ({ text: ideas[0] }) }, room && connected.length ? t('Your first message, almost written.') : t('Almost there.')), summary);
|
|
1036
|
+
// The AI arrived while the person was elsewhere: say so, and offer the hello.
|
|
1037
|
+
if (aiReady() && !pull && !(s.talk?.messages?.length > 1)) {
|
|
1038
|
+
const arrived = el('div', 'wl-arrived');
|
|
1039
|
+
arrived.append(el('span', null, t('The AI on your computer has arrived.')), button('wl-btn small', t('Say hello'), () => go('ai')));
|
|
1040
|
+
parts.push(arrived);
|
|
832
1041
|
}
|
|
833
|
-
|
|
834
|
-
|
|
1042
|
+
const learn = button('wl-btn ghost', t('Get to know MADRE'), () => { const after = then ?? host.chapters; finish(); after?.(); });
|
|
1043
|
+
// Into the project without a stop on Home (1.1): it starts waking as this step shows, and the
|
|
1044
|
+
// welcome stays on screen, saying it is opening, until the project's page takes over.
|
|
1045
|
+
const warm = room && connected.length ? (host.warmProject?.(room) ?? Promise.resolve(true)) : null;
|
|
1046
|
+
const enter = async (draft = null, key = null) => {
|
|
1047
|
+
for (const one of actions.querySelectorAll('button')) one.disabled = true;
|
|
1048
|
+
for (const one of content.querySelectorAll('.wl-idea')) one.disabled = true;
|
|
1049
|
+
if (key) key.textContent = t('Opening {name}…', { name: room.name });
|
|
1050
|
+
scene.say(t('Opening {name}…', { name: room.name }));
|
|
1051
|
+
finished = true;
|
|
1052
|
+
await save({ finished: true, done: 'ready', at: 'ready' });
|
|
1053
|
+
await warm?.catch(() => null);
|
|
1054
|
+
const answer = await host.openProject?.(room, { draft });
|
|
1055
|
+
// It did not open: Home says why, on the project's card.
|
|
1056
|
+
if (!answer?.ok) dialog.close();
|
|
1057
|
+
};
|
|
835
1058
|
// 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.
|
|
1059
|
+
// opened a project. Since 1.1 with the first message already written (`#escribe=`): the person only
|
|
1060
|
+
// sends it. Without a project or an agent, Home as before, whose first-time cards walk them there.
|
|
839
1061
|
if (room && connected.length) {
|
|
1062
|
+
parts.push(el('p', 'wl-section', t('Ideas for {name}', { name: room.name })));
|
|
1063
|
+
const list = el('div', 'wl-ideas');
|
|
1064
|
+
for (const idea of ideas) { const key = button('wl-idea', idea, () => void enter(idea, key)); list.append(key); }
|
|
1065
|
+
parts.push(list);
|
|
1066
|
+
content.replaceChildren(...parts);
|
|
840
1067
|
const home = button('wl-btn ghost', t('Go to Home'), () => finish());
|
|
841
|
-
footer({
|
|
842
|
-
next: t('Open {name}
|
|
843
|
-
onNext: () =>
|
|
1068
|
+
const opening = footer({
|
|
1069
|
+
next: t('Open {name}', { name: room.name }),
|
|
1070
|
+
onNext: () => enter(null, opening),
|
|
844
1071
|
extra: (() => { const keys = el('span', 'wl-keys'); keys.append(learn, home); return keys; })(),
|
|
845
1072
|
});
|
|
846
1073
|
return;
|
|
847
1074
|
}
|
|
1075
|
+
content.replaceChildren(...parts);
|
|
848
1076
|
footer({
|
|
849
1077
|
next: t('Go to Home'),
|
|
850
1078
|
onNext: () => finish(),
|
|
@@ -882,12 +1110,22 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
882
1110
|
} else if (s.install?.running) {
|
|
883
1111
|
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
1112
|
}
|
|
885
|
-
void readOllama({ probe: true }).then(
|
|
1113
|
+
void readOllama({ probe: true }).then(async () => {
|
|
1114
|
+
// The next in line goes once the one before is done; the memory is switched on when it is there.
|
|
1115
|
+
if (pull && event.payload.ok && s.queue.length) void startPull(s.queue.shift());
|
|
1116
|
+
if (pull && !event.payload.ok) s.queue = [];
|
|
1117
|
+
if (hasModel(EMBED_MODEL) && s.choice !== 'skip' && s.ollama?.running) { await enableLocal(); }
|
|
1118
|
+
repaint();
|
|
1119
|
+
});
|
|
886
1120
|
}
|
|
887
1121
|
};
|
|
888
1122
|
} catch { /* no stream: «I did it» and the probe keep it current */ }
|
|
889
1123
|
}
|
|
890
|
-
const repaint = () => {
|
|
1124
|
+
const repaint = () => {
|
|
1125
|
+
if (stepId() === 'ai') paintAi();
|
|
1126
|
+
else if (stepId() === 'ready' && !pulling()) void ready();
|
|
1127
|
+
scene.redraw();
|
|
1128
|
+
};
|
|
891
1129
|
|
|
892
1130
|
function show() {
|
|
893
1131
|
leave?.();
|
|
@@ -896,10 +1134,9 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
896
1134
|
content.scrollTop = 0;
|
|
897
1135
|
const id = stepId();
|
|
898
1136
|
if (id === 'hello') hello();
|
|
899
|
-
else if (id === '
|
|
1137
|
+
else if (id === 'use') use();
|
|
900
1138
|
else if (id === 'agents') agents();
|
|
901
1139
|
else if (id === 'ai') ai();
|
|
902
|
-
else if (id === 'memory') memoryStep();
|
|
903
1140
|
else if (id === 'project') project();
|
|
904
1141
|
else void ready();
|
|
905
1142
|
// The key just pressed left with the step it was on: the keyboard and a screen reader start
|
|
@@ -920,6 +1157,7 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
920
1157
|
leave?.();
|
|
921
1158
|
stream?.close();
|
|
922
1159
|
clearInterval(pollTimer);
|
|
1160
|
+
scene.stop();
|
|
923
1161
|
current = null;
|
|
924
1162
|
dialog.remove();
|
|
925
1163
|
host.closed?.();
|
|
@@ -933,13 +1171,16 @@ export function openWelcome({ at = null, then = null, host = {} } = {}) {
|
|
|
933
1171
|
current = { go: (to) => { s.step = Math.max(0, WELCOME_STEPS.indexOf(to)); show(); }, close: () => dialog.close(), node: dialog };
|
|
934
1172
|
void Promise.all([getJson('/api/tour'), getJson('/api/environment'), readOllama()]).then(([tour, environment]) => {
|
|
935
1173
|
if (!current) return;
|
|
936
|
-
s.progress = tour?.state?.welcome ??
|
|
1174
|
+
s.progress = { ...s.progress, ...(tour?.state?.welcome ?? {}) };
|
|
1175
|
+
s.profile = new Set(s.progress.profile ?? []);
|
|
937
1176
|
s.env = environment?.environment ?? null;
|
|
938
1177
|
s.hardware = environment?.hardware ?? null;
|
|
939
1178
|
s.geminiKey = Boolean(environment?.geminiKey);
|
|
940
1179
|
s.memory = environment?.memory ?? null;
|
|
941
1180
|
const from = at ?? s.progress.at ?? 'hello';
|
|
942
1181
|
s.step = Math.max(0, WELCOME_STEPS.indexOf(from));
|
|
1182
|
+
// Back to a later step, the computer was already read.
|
|
1183
|
+
if (s.step > 0) s.scanned = true;
|
|
943
1184
|
listen();
|
|
944
1185
|
show();
|
|
945
1186
|
if (!s.progress.at) void save({ at: WELCOME_STEPS[s.step] });
|