@jossuealcala/madre 1.0.4 → 1.1.0
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/ADDITIONAL-TERMS.md +7 -2
- package/CHANGELOG.en.md +152 -1
- package/CHANGELOG.md +152 -1
- package/CONTRIBUTING.md +2 -2
- package/LICENSE +111 -661
- package/NOTICE +59 -24
- package/README.en.md +36 -204
- package/README.md +36 -210
- package/SECURITY.md +1 -0
- package/TRADEMARKS.en.md +13 -14
- package/TRADEMARKS.md +42 -26
- package/bin/madre.cjs +2 -2
- package/bin/madre.mjs +114 -42
- package/docs/REFERENCE.md +53 -6
- package/docs/SDK.md +44 -5
- package/docs/en/REFERENCE.md +53 -6
- package/docs/en/SDK.md +43 -4
- package/docs/madre-banner.png +0 -0
- package/docs/sdk/hello-module.mjs +3 -0
- package/package.json +3 -2
- package/public/abduction.js +6 -6
- package/public/activity.js +425 -0
- package/public/app.js +3519 -647
- package/public/assets/abduction-cat-blink.webp +0 -0
- package/public/assets/abduction-cat-control-left.webp +0 -0
- package/public/assets/abduction-cat-control-right.webp +0 -0
- package/public/assets/abduction-cat.webp +0 -0
- package/public/assets/manual/shots/en-agents.webp +0 -0
- package/public/assets/manual/shots/en-chats.webp +0 -0
- package/public/assets/manual/shots/en-code.webp +0 -0
- package/public/assets/manual/shots/en-composer.webp +0 -0
- package/public/assets/manual/shots/en-connectors.webp +0 -0
- package/public/assets/manual/shots/en-continuity.webp +0 -0
- package/public/assets/manual/shots/en-coordinator.webp +0 -0
- package/public/assets/manual/shots/en-copilot.webp +0 -0
- package/public/assets/manual/shots/en-diagnostics.webp +0 -0
- package/public/assets/manual/shots/en-home.webp +0 -0
- package/public/assets/manual/shots/en-local.webp +0 -0
- package/public/assets/manual/shots/en-market.webp +0 -0
- package/public/assets/manual/shots/en-memory.webp +0 -0
- package/public/assets/manual/shots/en-modes.webp +0 -0
- package/public/assets/manual/shots/en-notes.webp +0 -0
- package/public/assets/manual/shots/en-settings.webp +0 -0
- package/public/assets/manual/shots/en-welcome.webp +0 -0
- package/public/assets/manual/shots/en-windows.webp +0 -0
- package/public/assets/manual/shots/es-agents.webp +0 -0
- package/public/assets/manual/shots/es-chats.webp +0 -0
- package/public/assets/manual/shots/es-code.webp +0 -0
- package/public/assets/manual/shots/es-composer.webp +0 -0
- package/public/assets/manual/shots/es-connectors.webp +0 -0
- package/public/assets/manual/shots/es-continuity.webp +0 -0
- package/public/assets/manual/shots/es-coordinator.webp +0 -0
- package/public/assets/manual/shots/es-copilot.webp +0 -0
- package/public/assets/manual/shots/es-diagnostics.webp +0 -0
- package/public/assets/manual/shots/es-home.webp +0 -0
- package/public/assets/manual/shots/es-local.webp +0 -0
- package/public/assets/manual/shots/es-market.webp +0 -0
- package/public/assets/manual/shots/es-memory.webp +0 -0
- package/public/assets/manual/shots/es-modes.webp +0 -0
- package/public/assets/manual/shots/es-notes.webp +0 -0
- package/public/assets/manual/shots/es-settings.webp +0 -0
- package/public/assets/manual/shots/es-welcome.webp +0 -0
- package/public/assets/manual/shots/es-windows.webp +0 -0
- package/public/assets/news/1.1/en/chats.webp +0 -0
- package/public/assets/news/1.1/en/home.webp +0 -0
- package/public/assets/news/1.1/en/maps.webp +0 -0
- package/public/assets/news/1.1/en/market.webp +0 -0
- package/public/assets/news/1.1/en/permissions.webp +0 -0
- package/public/assets/news/1.1/en/privacy.webp +0 -0
- package/public/assets/news/1.1/en/welcome.webp +0 -0
- package/public/assets/news/1.1/es/chats.webp +0 -0
- package/public/assets/news/1.1/es/home.webp +0 -0
- package/public/assets/news/1.1/es/maps.webp +0 -0
- package/public/assets/news/1.1/es/market.webp +0 -0
- package/public/assets/news/1.1/es/permissions.webp +0 -0
- package/public/assets/news/1.1/es/privacy.webp +0 -0
- package/public/assets/news/1.1/es/welcome.webp +0 -0
- package/public/attribution.js +15 -16
- package/public/brands.js +2 -2
- package/public/code-tools.js +2 -2
- package/public/editor.js +13 -13
- package/public/en.js +483 -0
- package/public/es.js +1817 -598
- package/public/hardware.js +2 -2
- package/public/i18n.js +47 -9
- package/public/icons.js +158 -0
- package/public/index.html +68 -51
- package/public/inquiry.js +2 -2
- package/public/loader.js +271 -2
- package/public/macroverso.js +60 -21
- package/public/manual-content.js +900 -0
- package/public/manual-shots.js +47 -0
- package/public/manual.css +246 -0
- package/public/manual.html +15 -0
- package/public/manual.js +427 -0
- package/public/market-art.js +99 -41
- package/public/market-view.js +243 -47
- package/public/market.js +139 -26
- package/public/mcp-catalog.js +62 -0
- package/public/neural.js +64 -8
- package/public/nostromo-engine.js +709 -40
- package/public/page-errors.js +29 -0
- package/public/power.js +350 -11
- package/public/remedy.js +89 -0
- package/public/resay.js +4 -2
- package/public/review-ask.js +12 -7
- package/public/routing.js +3 -3
- package/public/salas-mac.css +875 -48
- package/public/salas-mac.html +27 -15
- package/public/salas-mac.js +1668 -338
- package/public/salas.css +2 -2
- package/public/salas.html +3 -3
- package/public/salas.js +3 -3
- package/public/styles.css +2694 -323
- package/public/syntax.js +2 -2
- package/public/terms.js +152 -0
- package/public/touch.js +2 -2
- package/public/tour-chapters.js +100 -92
- package/public/tour.js +118 -28
- package/public/troubleshooting.js +327 -21
- package/public/wallpaper.js +4 -3
- package/public/welcome.js +923 -0
- package/src/activity.mjs +85 -0
- package/src/adapters/claude.mjs +61 -35
- package/src/adapters/codex.mjs +18 -5
- package/src/adapters/cursor.mjs +60 -9
- package/src/adapters/gemini.mjs +17 -4
- package/src/adapters/madre.mjs +30 -9
- package/src/adapters/opencode.mjs +73 -10
- package/src/adapters/process.mjs +19 -15
- package/src/adapters/subagents.mjs +159 -0
- package/src/asking.mjs +8 -2
- package/src/auth-probe.mjs +47 -11
- package/src/bridge/devices.mjs +2 -2
- package/src/bridge/handoff.mjs +2 -2
- package/src/bridge/host.mjs +2 -2
- package/src/bridge/network.mjs +2 -2
- package/src/bridge/policy.mjs +3 -3
- package/src/bridge/qr.mjs +2 -2
- package/src/bridge/server.mjs +3 -3
- package/src/builtin-updates.mjs +87 -0
- package/src/capabilities.mjs +5 -5
- package/src/chats.mjs +51 -2
- package/src/checkpoint.mjs +67 -9
- package/src/choices.mjs +2 -2
- package/src/cli-args.mjs +2 -2
- package/src/cold.mjs +2 -2
- package/src/commands.mjs +2 -2
- package/src/config.mjs +2 -2
- package/src/conversation-context.mjs +2 -2
- package/src/credentials.mjs +80 -18
- package/src/dataset.mjs +2 -2
- package/src/directives.mjs +2 -2
- package/src/distiller.mjs +2 -2
- package/src/embeddings.mjs +2 -2
- package/src/enlaces.mjs +2 -2
- package/src/environment.mjs +147 -0
- package/src/event-store.mjs +2 -2
- package/src/exam.mjs +2 -2
- package/src/extensions.mjs +2 -2
- package/src/eyecat-watch.mjs +2 -2
- package/src/eyecat.mjs +2 -2
- package/src/file-ops.mjs +2 -2
- package/src/files.mjs +2 -2
- package/src/github.mjs +2 -2
- package/src/heartbeat.mjs +2 -2
- package/src/history.mjs +76 -0
- package/src/i18n.mjs +32 -3
- package/src/image-studio.mjs +2 -2
- package/src/install-metrics.mjs +109 -0
- package/src/json-file.mjs +2 -2
- package/src/launch.mjs +2 -2
- package/src/lease.mjs +15 -4
- package/src/lobby-work.mjs +11 -4
- package/src/local-ai.mjs +12 -4
- package/src/looks.mjs +19 -7
- package/src/market-check.mjs +165 -0
- package/src/market-key.mjs +10 -2
- package/src/market-license.mjs +104 -0
- package/src/market-remote.mjs +71 -13
- package/src/maturity.mjs +2 -2
- package/src/mcp/connect.mjs +2 -2
- package/src/mcp/github-server.mjs +2 -2
- package/src/mcp/image-server.mjs +2 -2
- package/src/mcp/memory-server.mjs +2 -2
- package/src/mcp/proxy.mjs +16 -5
- package/src/mcp/smtp-server.mjs +2 -2
- package/src/memory-dashboard.mjs +2 -2
- package/src/memory-tools.mjs +2 -2
- package/src/memory.mjs +2 -2
- package/src/models.mjs +115 -12
- package/src/module-scope.mjs +2 -2
- package/src/modules/ahp.mjs +2 -2
- package/src/modules/ash-policy.mjs +2 -2
- package/src/modules/ash.mjs +2 -2
- package/src/modules/bishop-exam.mjs +2 -2
- package/src/modules/bishop-plan.mjs +2 -2
- package/src/modules/bishop.mjs +9 -3
- package/src/modules/choices.mjs +2 -2
- package/src/modules/correo.mjs +2 -2
- package/src/modules/enlaces.mjs +2 -2
- package/src/modules/git-pulse.mjs +2 -2
- package/src/modules/github.mjs +2 -2
- package/src/modules/helpers.mjs +2 -2
- package/src/modules/image-studio.mjs +2 -2
- package/src/modules/index.mjs +92 -5
- package/src/modules/intents-calibration.mjs +2 -2
- package/src/modules/intents-desk.mjs +4 -3
- package/src/modules/intents-observe.mjs +2 -2
- package/src/modules/intents-policy.mjs +2 -2
- package/src/modules/intents-try.mjs +2 -2
- package/src/modules/intents.mjs +2 -2
- package/src/modules/local-models.mjs +41 -10
- package/src/modules/mcp-connect.mjs +2 -2
- package/src/modules/notes.mjs +281 -0
- package/src/modules/ollama.mjs +48 -13
- package/src/modules/playwright.mjs +16 -5
- package/src/modules/reminders.mjs +664 -0
- package/src/modules/ripley.mjs +3 -3
- package/src/modules/runs.mjs +2 -2
- package/src/modules/sdk.mjs +57 -9
- package/src/modules/updates.mjs +2 -2
- package/src/mother.mjs +13 -3
- package/src/npm-launch.mjs +2 -2
- package/src/ollama.mjs +8 -6
- package/src/opencode-health.mjs +83 -0
- package/src/outbound.mjs +35 -3
- package/src/override.mjs +27 -22
- package/src/ports.mjs +2 -2
- package/src/prices.mjs +2 -2
- package/src/privacy.mjs +2 -2
- package/src/quota-monitor.mjs +2 -2
- package/src/quota-sources.mjs +2 -2
- package/src/request-guard.mjs +2 -2
- package/src/review-ask.mjs +4 -3
- package/src/room/archivist.mjs +2 -2
- package/src/room/attachments.mjs +2 -2
- package/src/room/budget.mjs +2 -2
- package/src/room/context.mjs +2 -2
- package/src/room/control.mjs +2 -2
- package/src/room/copilot.mjs +2 -2
- package/src/room/economy.mjs +2 -2
- package/src/room/escalation.mjs +2 -2
- package/src/room/ghost.mjs +2 -2
- package/src/room/guard.mjs +6 -4
- package/src/room/prompt.mjs +3 -3
- package/src/room/returns.mjs +2 -2
- package/src/room/runs.mjs +6 -4
- package/src/room/vectors.mjs +2 -2
- package/src/room.mjs +144 -36
- package/src/router.mjs +2 -2
- package/src/runs.mjs +2 -2
- package/src/runtime-detection.mjs +36 -6
- package/src/salas.mjs +31 -6
- package/src/sentinel-errors.mjs +17 -7
- package/src/server-sentinel.mjs +2 -2
- package/src/server.mjs +980 -139
- package/src/setup-trouble.mjs +33 -0
- package/src/setup.mjs +4 -4
- package/src/smtp.mjs +2 -2
- package/src/telemetry.mjs +266 -0
- package/src/terms.mjs +43 -0
- package/src/tour.mjs +60 -7
- package/src/uninstall.mjs +225 -0
- package/src/updates.mjs +2 -2
- package/src/usage-sentinel.mjs +2 -2
- package/src/vault.mjs +2 -2
- package/src/verdict.mjs +13 -10
- package/src/whats-new.mjs +97 -3
- package/public/assets/abduction-cat-blink.png +0 -0
- package/public/assets/abduction-cat-control-left.png +0 -0
- package/public/assets/abduction-cat-control-right.png +0 -0
- package/public/assets/abduction-cat.png +0 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
2
|
-
// MADRE · © 2026 Jossue Alcalá ·
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
// MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
|
|
3
3
|
import { constants } from 'node:fs';
|
|
4
|
-
import { access } from 'node:fs/promises';
|
|
5
|
-
import { homedir } from 'node:os';
|
|
4
|
+
import { access, readFile, realpath, stat, writeFile, rename } from 'node:fs/promises';
|
|
5
|
+
import { homedir, tmpdir, userInfo } from 'node:os';
|
|
6
6
|
import { delimiter, join } from 'node:path';
|
|
7
7
|
import { execFile } from 'node:child_process';
|
|
8
8
|
import { promisify } from 'node:util';
|
|
9
9
|
|
|
10
|
+
const accountHome = () => { try { return userInfo().homedir || homedir(); } catch { return homedir(); } };
|
|
11
|
+
|
|
10
12
|
const execFileAsync = promisify(execFile);
|
|
11
13
|
|
|
12
14
|
const definitions = [
|
|
@@ -43,7 +45,9 @@ const definitions = [
|
|
|
43
45
|
// on the PATH a room is started with.
|
|
44
46
|
id: 'cursor',
|
|
45
47
|
label: 'Cursor',
|
|
46
|
-
|
|
48
|
+
// Also the account's own home, as the system knows it (2026-10-20): a MADRE started with
|
|
49
|
+
// another HOME (a test home, a launcher) still finds the CLI the person installed.
|
|
50
|
+
candidates: [...new Set(['cursor-agent', join(homedir(), '.local', 'bin', 'cursor-agent'), join(accountHome(), '.local', 'bin', 'cursor-agent')])],
|
|
47
51
|
versionArgs: ['--version'],
|
|
48
52
|
adapter: 'cursor-readonly',
|
|
49
53
|
},
|
|
@@ -113,6 +117,11 @@ const extensions = (env = process.env) => (process.platform === 'win32'
|
|
|
113
117
|
? (env.PATHEXT ?? '.COM;.EXE;.BAT;.CMD').split(';').filter(Boolean).map((extension) => extension.toLowerCase())
|
|
114
118
|
: ['']);
|
|
115
119
|
|
|
120
|
+
// Inside WSL the PATH also carries Windows' own folders (/mnt/c/…/AppData/Roaming/npm): every file
|
|
121
|
+
// there looks runnable, so a CLI installed on Windows counted as installed here, «install» said it
|
|
122
|
+
// already was, and every turn failed for want of the Linux one. Those folders are Windows', not WSL's.
|
|
123
|
+
const windowsSide = (directory, env) => process.platform === 'linux' && Boolean(env.WSL_DISTRO_NAME || env.WSL_INTEROP) && /^\/mnt\/[a-z]\//i.test(directory);
|
|
124
|
+
|
|
116
125
|
export async function findExecutable(candidates, envPath = process.env.PATH ?? '', env = process.env) {
|
|
117
126
|
const suffixes = extensions(env);
|
|
118
127
|
const runnable = async (path) => (process.platform === 'win32' ? access(path).then(() => true, () => false) : executable(path));
|
|
@@ -122,6 +131,7 @@ export async function findExecutable(candidates, envPath = process.env.PATH ?? '
|
|
|
122
131
|
continue;
|
|
123
132
|
}
|
|
124
133
|
for (const directory of envPath.split(delimiter).filter(Boolean)) {
|
|
134
|
+
if (windowsSide(directory, env)) continue;
|
|
125
135
|
for (const suffix of suffixes) {
|
|
126
136
|
const path = join(directory, `${candidate}${suffix}`);
|
|
127
137
|
if (await runnable(path)) return path;
|
|
@@ -131,10 +141,30 @@ export async function findExecutable(candidates, envPath = process.env.PATH ?? '
|
|
|
131
141
|
return null;
|
|
132
142
|
}
|
|
133
143
|
|
|
144
|
+
// What each CLI answered to --version, kept per binary (its real path, size and date) for every
|
|
145
|
+
// MADRE of this user (QA 1.1.0, ACT-15): each project used to run `gemini --version` as it came up,
|
|
146
|
+
// and several coming up together left Gemini's half-written projects.json.<uuid>.tmp behind in
|
|
147
|
+
// ~/.gemini. A binary that changes is asked again.
|
|
148
|
+
const versionsFile = () => join(tmpdir(), `madre-versions-${process.getuid?.() ?? 'user'}.json`);
|
|
149
|
+
async function rememberedVersions() { try { return JSON.parse(await readFile(versionsFile(), 'utf8')) ?? {}; } catch { return {}; } }
|
|
134
150
|
async function readVersion(path, args) {
|
|
151
|
+
let key = null;
|
|
152
|
+
try {
|
|
153
|
+
const real = await realpath(path);
|
|
154
|
+
const found = await stat(real);
|
|
155
|
+
key = `${real}:${found.size}:${Math.round(found.mtimeMs)}:${args.join(' ')}`;
|
|
156
|
+
const kept = (await rememberedVersions())[key];
|
|
157
|
+
if (typeof kept === 'string' && kept) return kept;
|
|
158
|
+
} catch { /* asked below */ }
|
|
135
159
|
try {
|
|
136
160
|
const { stdout, stderr } = await execFileAsync(path, args, { timeout: 3000 });
|
|
137
|
-
|
|
161
|
+
const version = (stdout || stderr).trim().split('\n')[0] || null;
|
|
162
|
+
if (version && key) {
|
|
163
|
+
const all = { ...(await rememberedVersions()), [key]: version };
|
|
164
|
+
const temp = `${versionsFile()}.${process.pid}.tmp`;
|
|
165
|
+
await writeFile(temp, JSON.stringify(Object.fromEntries(Object.entries(all).slice(-40)))).then(() => rename(temp, versionsFile())).catch(() => {});
|
|
166
|
+
}
|
|
167
|
+
return version;
|
|
138
168
|
} catch {
|
|
139
169
|
return null;
|
|
140
170
|
}
|
package/src/salas.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
2
|
-
// MADRE · © 2026 Jossue Alcalá ·
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
// MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
|
|
3
3
|
// Salas on the Mac (docs/MACROVERSO.md, phase 1): every room this Mac knows, open or asleep, and
|
|
4
4
|
// what one room may ask of another — to open, to close. The list is read from what each room
|
|
5
5
|
// leaves beside its record; nothing here touches a room's ledger or its memory.
|
|
@@ -14,6 +14,7 @@ import { spawn } from 'node:child_process';
|
|
|
14
14
|
import { createHash } from 'node:crypto';
|
|
15
15
|
import { closeSync, openSync, realpathSync } from 'node:fs';
|
|
16
16
|
import { mkdir, readdir, readFile, rename, stat } from 'node:fs/promises';
|
|
17
|
+
import * as nodePath from 'node:path';
|
|
17
18
|
import { basename, dirname, join, resolve } from 'node:path';
|
|
18
19
|
import { fileURLToPath } from 'node:url';
|
|
19
20
|
import { oneAtATime, writeWhole } from './json-file.mjs';
|
|
@@ -108,7 +109,17 @@ const NOT_PROJECTS = new Set(['node_modules', 'Library', 'Applications', 'Pictur
|
|
|
108
109
|
// Escritorio).
|
|
109
110
|
export const PROJECT_HOMES = ['', 'Projects', 'projects', 'Proyectos', 'proyectos', 'Developer', 'dev', 'Dev', 'code', 'Code', 'src', 'repos', 'Repos', 'GitHub', 'git', 'work', 'Work', 'Sites', 'Documents', 'Documentos', 'Desktop', 'Escritorio'];
|
|
110
111
|
|
|
111
|
-
|
|
112
|
+
// Whether a folder is the other one or inside it (WIN-028, 2026-10-28). Asked of the path module of
|
|
113
|
+
// the system it runs on, not of a '/': on Windows a path is written with '\' and its letters' case
|
|
114
|
+
// does not tell two folders apart, and comparing text with '/' refused every folder there, the
|
|
115
|
+
// home's own included («Only folders inside your home folder»). `path` is a parameter so the
|
|
116
|
+
// Windows rule can be checked anywhere.
|
|
117
|
+
export function insideFolder(child, parent, path = nodePath) {
|
|
118
|
+
const rel = path.relative(parent, child);
|
|
119
|
+
return rel === '' || (rel !== '..' && !rel.startsWith(`..${path.sep}`) && !path.isAbsolute(rel));
|
|
120
|
+
}
|
|
121
|
+
export const sameFolder = (one, other, path = nodePath) => path.relative(one, other) === '';
|
|
122
|
+
const inside = (child, parent) => insideFolder(child, parent);
|
|
112
123
|
async function looksLikeProject(folder) {
|
|
113
124
|
for (const mark of PROJECT_MARKS) if (await stat(join(folder, mark)).then(() => true, () => false)) return true;
|
|
114
125
|
return false;
|
|
@@ -140,7 +151,7 @@ export async function listFolders({ path = null, home, stateRoot }) {
|
|
|
140
151
|
entries.push({ name: entry.name, path: full, project: await looksLikeProject(full), known: known.has(full) });
|
|
141
152
|
}
|
|
142
153
|
entries.sort((a, b) => Number(b.project) - Number(a.project) || a.name.localeCompare(b.name));
|
|
143
|
-
return { path: here, home: top, parent: here
|
|
154
|
+
return { path: here, home: top, parent: sameFolder(here, top) ? null : dirname(here), entries: entries.slice(0, 400) };
|
|
144
155
|
}
|
|
145
156
|
|
|
146
157
|
// Folders that look like projects in the places people keep them, newest first, none already here.
|
|
@@ -173,7 +184,7 @@ export async function suggestProjects({ home, stateRoot, limit = 24 }) {
|
|
|
173
184
|
export async function associateProject({ root, home, stateRoot, now = new Date() }) {
|
|
174
185
|
const folder = realFolder(String(root ?? ''));
|
|
175
186
|
const top = realFolder(home);
|
|
176
|
-
if (!root || !inside(folder, top) || folder
|
|
187
|
+
if (!root || !inside(folder, top) || sameFolder(folder, top)) return { error: 'outside' };
|
|
177
188
|
if (inside(folder, realFolder(stateRoot))) return { error: 'madre' };
|
|
178
189
|
const info = await stat(folder).catch(() => null);
|
|
179
190
|
if (!info?.isDirectory()) return { error: 'missing' };
|
|
@@ -201,11 +212,22 @@ export function projectNameProblem(name) {
|
|
|
201
212
|
if (/[<>:"/\\|?*\u0000-\u001f]/.test(text) || text !== text.trim() || /[. ]$/.test(text) || text.startsWith('.') || DEVICE_NAMES.test(text)) return 'name';
|
|
202
213
|
return null;
|
|
203
214
|
}
|
|
215
|
+
// Where a new project goes when nobody chose (QA 1.1.0, NUE-09): the folder this person already
|
|
216
|
+
// keeps projects in, when there is one, rather than the top of their home folder.
|
|
217
|
+
const NEW_PROJECT_HOMES = ['Proyectos', 'Projects', 'proyectos', 'projects', 'Developer', 'Code', 'code', 'dev', 'src'];
|
|
218
|
+
export async function defaultProjectsFolder(home) {
|
|
219
|
+
for (const name of NEW_PROJECT_HOMES) {
|
|
220
|
+
const found = await stat(join(home, name)).catch(() => null);
|
|
221
|
+
if (found?.isDirectory()) return join(home, name);
|
|
222
|
+
}
|
|
223
|
+
return home;
|
|
224
|
+
}
|
|
225
|
+
|
|
204
226
|
export async function createProject({ name, parent = null, home, stateRoot, now = new Date() }) {
|
|
205
227
|
const problem = projectNameProblem(name);
|
|
206
228
|
if (problem) return { error: problem };
|
|
207
229
|
const top = realFolder(home);
|
|
208
|
-
const place = realFolder(parent || home);
|
|
230
|
+
const place = realFolder(parent || await defaultProjectsFolder(home));
|
|
209
231
|
if (!inside(place, top)) return { error: 'outside' };
|
|
210
232
|
if (inside(place, realFolder(stateRoot))) return { error: 'madre' };
|
|
211
233
|
if (!(await stat(place).catch(() => null))?.isDirectory()) return { error: 'missing' };
|
|
@@ -299,6 +321,7 @@ export async function roomComesUp(stateRoot, id, { timeoutMs = 60000, everyMs =
|
|
|
299
321
|
// `full`, no memory's words leave their room: a far universe is drawn from kinds, zones, how much
|
|
300
322
|
// ledger each memory covers, how often it was reached for, and the links between them. Only the
|
|
301
323
|
// chosen universe asks for the words, and only the Mac may ask (the route refuses a phone).
|
|
324
|
+
const wordCount = (text) => (typeof text === 'string' ? (text.match(/\S+/g) ?? []).length : 0);
|
|
302
325
|
export function universeOf(research, { full = false } = {}) {
|
|
303
326
|
const memories = (research?.memories ?? []).map((memory) => ({
|
|
304
327
|
id: memory.id,
|
|
@@ -307,6 +330,8 @@ export function universeOf(research, { full = false } = {}) {
|
|
|
307
330
|
fromSequence: memory.fromSequence ?? 0,
|
|
308
331
|
throughSequence: memory.throughSequence ?? 0,
|
|
309
332
|
sourcesCount: Array.isArray(memory.sources) ? memory.sources.length : 0,
|
|
333
|
+
// How much it holds, as a count: its size on the map (2026-10-28). The words stay in their room.
|
|
334
|
+
words: wordCount(memory.text),
|
|
310
335
|
recalled: memory.recalled ?? 0,
|
|
311
336
|
lastRecalled: memory.lastRecalled ?? null,
|
|
312
337
|
cold: memory.cold ?? null,
|
package/src/sentinel-errors.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
2
|
-
// MADRE · © 2026 Jossue Alcalá ·
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
// MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
|
|
3
3
|
// The error sentinel: what MADRE tells its author when something goes wrong
|
|
4
4
|
// that MU/TH/UR cannot explain. A failure that matches no known condition, or a
|
|
5
5
|
// crash of the process, becomes a report: the error redacted (no home paths,
|
|
6
6
|
// no user names, no keys, no emails), the versions involved, the platform.
|
|
7
7
|
// Reports stay in the room ledger (sentinel.report) and can be sent two ways:
|
|
8
8
|
// by hand as a prefilled GitHub issue, or automatically to a collector the
|
|
9
|
-
// author runs,
|
|
9
|
+
// author runs, while AUTO-REPORT is on: on by default since 1.1.0, with the anonymous diagnostics, and the human turns it off.
|
|
10
10
|
// Nothing leaves the machine otherwise.
|
|
11
11
|
|
|
12
12
|
import { createHash } from 'node:crypto';
|
|
@@ -69,14 +69,17 @@ export class ErrorSentinel {
|
|
|
69
69
|
#fetch;
|
|
70
70
|
#emit;
|
|
71
71
|
#save;
|
|
72
|
+
#told;
|
|
72
73
|
|
|
73
|
-
|
|
74
|
+
// `told`: every failure, known or not, for the anonymous diagnostics (src/telemetry.mjs).
|
|
75
|
+
constructor({ pkg = {}, agents = [], settings = {}, fetchImpl = globalThis.fetch, emit = async () => {}, save = async () => {}, told = () => {} } = {}) {
|
|
74
76
|
this.#pkg = pkg;
|
|
75
77
|
this.#agents = agents;
|
|
76
78
|
this.#settings = { autoReport: Boolean(settings.autoReport), reportUrl: String(settings.reportUrl ?? '').trim() };
|
|
77
79
|
this.#fetch = fetchImpl;
|
|
78
80
|
this.#emit = emit;
|
|
79
81
|
this.#save = save;
|
|
82
|
+
this.#told = told;
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
settings() { return { ...this.#settings, canSend: Boolean(this.#settings.reportUrl), repo: repoFromPackage(this.#pkg), home: HOME_SITE }; }
|
|
@@ -102,13 +105,19 @@ export class ErrorSentinel {
|
|
|
102
105
|
// A room event goes by: a failure MU/TH/UR cannot classify is worth a report.
|
|
103
106
|
async observe(event) {
|
|
104
107
|
if (event?.type !== 'message.failed') return null;
|
|
105
|
-
const { target, error, stopped } = event.payload ?? {};
|
|
108
|
+
const { target, error, stopped, closing } = event.payload ?? {};
|
|
106
109
|
if (typeof error !== 'string' || !error.trim()) return null;
|
|
107
110
|
// A turn the human stopped is not a condition. It ends exactly like a failure because the
|
|
108
111
|
// process really was killed, but nothing went wrong and there is nothing for anyone to
|
|
109
|
-
// diagnose — filing it would be reporting the brake as a fault.
|
|
110
|
-
|
|
112
|
+
// diagnose — filing it would be reporting the brake as a fault. A turn cut because MADRE was
|
|
113
|
+
// closing is the same: every room closed mid-turn filed «MADRE is shutting down» (2026-10-21).
|
|
114
|
+
if (stopped || closing) return null;
|
|
111
115
|
const known = diagnose(error, target ?? null);
|
|
116
|
+
const agentVersion = this.#agents.find((one) => one.id === target)?.version ?? null;
|
|
117
|
+
// Known or not, the author hears of it (2026-10-28): how often each known condition happens is
|
|
118
|
+
// as useful as the conditions nobody catalogued.
|
|
119
|
+
// A known one goes by its code alone: the agent's own words can repeat what the person wrote.
|
|
120
|
+
try { this.#told({ kind: 'agent', code: known[0]?.code ?? null, agent: target ?? null, agentVersion, message: known.length ? '' : error }); } catch { /* never in the way */ }
|
|
112
121
|
if (known.length) return null;
|
|
113
122
|
return this.record({ kind: 'unknown', agent: target ?? null, error, at: event.timestamp });
|
|
114
123
|
}
|
|
@@ -116,6 +125,7 @@ export class ErrorSentinel {
|
|
|
116
125
|
// The process itself failed somewhere the room did not catch.
|
|
117
126
|
async crash(error, origin = 'uncaughtException') {
|
|
118
127
|
const text = error instanceof Error ? `${error.stack ?? error.message}` : String(error);
|
|
128
|
+
try { this.#told({ kind: 'crash', where: origin, message: error instanceof Error ? error.message : text, stack: error instanceof Error ? error.stack : null }); } catch { /* never in the way */ }
|
|
119
129
|
return this.record({ kind: 'crash', agent: null, error: `${origin}: ${text}` });
|
|
120
130
|
}
|
|
121
131
|
|
package/src/server-sentinel.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
2
|
-
// MADRE · © 2026 Jossue Alcalá ·
|
|
1
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
2
|
+
// MADRE · © 2026 Jossue Alcalá · Business Source License 1.1: LICENSE
|
|
3
3
|
// The servers sentinel: what this project has listening, kept watch over while the room is open.
|
|
4
4
|
//
|
|
5
5
|
// RIPLEY opens a project's own dev server; this is what knows which servers those are. Only the
|