ai-first-os 2.0.0 → 2.1.1
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/README.md +12 -8
- package/bin/ai-first-os.js +67 -8
- package/core/CLAUDE.md +2 -1
- package/core/VERSION +1 -1
- package/core/lib/bootstrap.sh +9 -7
- package/core/lib/build-indexes.sh +415 -59
- package/core/lib/common.sh +137 -13
- package/core/lib/focus-read.sh +59 -3
- package/core/lib/migrate-layout.sh +1 -1
- package/core/lib/migrate-root.sh +1 -1
- package/core/lib/mount-repo.sh +5 -3
- package/core/lib/recall.sh +15 -4
- package/core/lib/session-read.sh +3 -3
- package/core/lib/session-start.sh +4 -7
- package/core/manual/COMO-FUNCIONA.md +39 -18
- package/core/manual/HOW-IT-WORKS.md +39 -18
- package/core/skills/bootstrap.md +18 -13
- package/core/skills/mount-repo.md +3 -2
- package/core/skills/recall.md +6 -0
- package/core/templates/operator.md +1 -1
- package/core/templates/strings.md +185 -11
- package/core/templates/voice.md +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,23 +15,27 @@ This document is written for your agent to execute, not for you to follow step b
|
|
|
15
15
|
|
|
16
16
|
## Requirements
|
|
17
17
|
|
|
18
|
-
**Installing the system takes
|
|
19
|
-
— an agent that installs first and reads the error afterwards leaves you with
|
|
20
|
-
instead of an answer.
|
|
18
|
+
**Installing the system takes one thing: git. Python 3 is recommended.** They are checked before
|
|
19
|
+
anything runs — an agent that installs first and reads the error afterwards leaves you with
|
|
20
|
+
`command not found` instead of an answer.
|
|
21
21
|
|
|
22
22
|
| What | When it is needed | How the agent checks it | Where it comes from if it is missing |
|
|
23
23
|
|---|---|---|---|
|
|
24
24
|
| git | To install the system | `git --version` | macOS: `xcode-select --install` · Windows: git-scm.com |
|
|
25
|
-
| python3 |
|
|
25
|
+
| python3 | Recommended, not required — without it the install goes on and warns that two features are missing: connecting a code repository (`mount-repo`) and Living Memory search (`recall`). It is found as `python3`, `python` or `py -3` | `python3 --version` (or `python --version`, or `py -3 --version`) | macOS: `xcode-select --install` (same command as git) · Windows: python.org · Linux: your distro's package manager |
|
|
26
26
|
| Node.js | Only for the `npx` install path and for the pack of skills offered at the end of the install — installing the system by git clone never needs it | `node --version` | The LTS installer at nodejs.org |
|
|
27
27
|
|
|
28
28
|
**The agent guides; you install.** System software is never installed by the agent on its own: it
|
|
29
29
|
points at the official channel, waits for you to run it, and checks again.
|
|
30
30
|
|
|
31
|
-
**git has no path around it
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
**git has no path around it.** Every brain is versioned from the moment it exists — that is what gives
|
|
32
|
+
you an auditable history and updates you can undo — so nothing gets written until git is there.
|
|
33
|
+
Install it and say "run bootstrap" again; nothing you already answered is lost.
|
|
34
|
+
|
|
35
|
+
**Python 3 does not stop the install.** Without it the system installs completely and warns, once,
|
|
36
|
+
that two features will not be available: connecting a code repository (`mount-repo`) and Living Memory
|
|
37
|
+
search (`recall`; the AI searches files as plain text instead). Install Python from python.org later
|
|
38
|
+
and they start working; nothing needs to be reinstalled.
|
|
35
39
|
|
|
36
40
|
**Node is not a requirement of the git-clone path below, and that path never runs `npx`.** Node
|
|
37
41
|
belongs to two optional things: installing with `npx ai-first-os` instead of cloning, and the pack of
|
package/bin/ai-first-os.js
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
// AI First OS launcher — this is what `npx ai-first-os` runs.
|
|
5
5
|
//
|
|
6
6
|
// It does three things, in this order, and nothing else:
|
|
7
|
-
// 1. checks git
|
|
8
|
-
// core/lib/bootstrap.sh
|
|
7
|
+
// 1. checks git is on PATH — the one hard requirement of the system, the same check
|
|
8
|
+
// core/lib/bootstrap.sh makes before writing anything. Python 3 is looked up by its three names
|
|
9
|
+
// (python3, python, py -3: the same order and the same test as os_python_find in
|
|
10
|
+
// core/lib/common.sh); without it the install goes on and prints a warning;
|
|
9
11
|
// 2. copies core/, README.md and LICENSE from this package to a fixed folder, ~/.ai-first-os,
|
|
10
12
|
// replacing whatever was already there — the npm cache this script runs from is reclaimed,
|
|
11
13
|
// so the system cannot keep living inside it;
|
|
@@ -31,6 +33,43 @@ function fail(message) {
|
|
|
31
33
|
process.exit(1);
|
|
32
34
|
}
|
|
33
35
|
|
|
36
|
+
// A candidate is accepted only if it runs and exits 0 exactly when its major version is 3. That
|
|
37
|
+
// leaves out the Microsoft Store shortcut (it fails) and a Python 2. Same order as os_python_find.
|
|
38
|
+
const PYTHON_PROBE = 'import sys; sys.exit(0 if sys.version_info[0] == 3 else 1)';
|
|
39
|
+
const PYTHON_CANDIDATES = [['python3'], ['python'], ['py', '-3']];
|
|
40
|
+
|
|
41
|
+
// Each probe has a deadline: a candidate that hangs counts as failed and the next one is tried.
|
|
42
|
+
const PROBE_TIMEOUT_MS = Number(process.env.AI_FIRST_OS_PROBE_TIMEOUT_MS) || 10000;
|
|
43
|
+
|
|
44
|
+
// Runs one probe of `argv` (command first). On Windows, a `.cmd` shim (pyenv-win and some managers)
|
|
45
|
+
// cannot be spawned directly: the spawn fails with ENOENT or EINVAL, and the probe is retried through
|
|
46
|
+
// `cmd.exe /d /s /c` with the line quoted. `.exe` candidates never reach that retry.
|
|
47
|
+
function runProbe(argv) {
|
|
48
|
+
const opts = { stdio: 'ignore', timeout: PROBE_TIMEOUT_MS };
|
|
49
|
+
let result = spawnSync(argv[0], argv.slice(1), opts);
|
|
50
|
+
if (result.error && process.platform === 'win32' && (result.error.code === 'ENOENT' || result.error.code === 'EINVAL')) {
|
|
51
|
+
const line = argv.map((a) => (/[\s"]/.test(a) ? '"' + a + '"' : a)).join(' ');
|
|
52
|
+
result = spawnSync(process.env.ComSpec || 'cmd.exe', ['/d', '/s', '/c', '"' + line + '"'], {
|
|
53
|
+
...opts,
|
|
54
|
+
windowsVerbatimArguments: true,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return !result.error && result.status === 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function findPython() {
|
|
61
|
+
for (const candidate of PYTHON_CANDIDATES) {
|
|
62
|
+
if (runProbe(candidate.concat(['-c', PYTHON_PROBE]))) return candidate.join(' ');
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Required by the evals (S080-C1) to run findPython alone; `npx` runs this file directly, never so.
|
|
68
|
+
if (require.main !== module) {
|
|
69
|
+
module.exports = { findPython };
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
34
73
|
if (!hasCommand('git')) {
|
|
35
74
|
fail(
|
|
36
75
|
'git is missing. Install it from the official channel (macOS: `xcode-select --install`; ' +
|
|
@@ -38,12 +77,29 @@ if (!hasCommand('git')) {
|
|
|
38
77
|
);
|
|
39
78
|
}
|
|
40
79
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
80
|
+
// Printed in both languages, English first: the brain does not exist yet, so its language is unknown.
|
|
81
|
+
const PYTHON_WARNING =
|
|
82
|
+
"Python 3 was not found \u2014 installing anyway. Without Python, 2 features won't be available:\n" +
|
|
83
|
+
' \u2022 Connecting a code repository (mount-repo).\n' +
|
|
84
|
+
' \u2022 Living Memory search (recall). The AI searches files as plain text instead: it can\'t put the\n' +
|
|
85
|
+
' current version of a document above a replaced one, open the exact section, or follow what a\n' +
|
|
86
|
+
' document is about or what replaced it.\n' +
|
|
87
|
+
'To get them: install Python (python.org). Nothing needs to be reinstalled.\n' +
|
|
88
|
+
'\n' +
|
|
89
|
+
'No se encontr\u00f3 Python 3: la instalaci\u00f3n sigue. Sin Python hay 2 funcionalidades que no vas a tener disponibles:\n' +
|
|
90
|
+
' \u2022 Conectar un repositorio de c\u00f3digo (mount-repo).\n' +
|
|
91
|
+
' \u2022 La b\u00fasqueda de Living Memory (recall). La IA busca en los archivos como texto com\u00fan: no puede\n' +
|
|
92
|
+
' poner la versi\u00f3n vigente de un documento por encima de una reemplazada, abrir la secci\u00f3n exacta\n' +
|
|
93
|
+
' ni seguir de qu\u00e9 trata un documento o qu\u00e9 lo reemplaz\u00f3.\n' +
|
|
94
|
+
'Para tenerlas: instal\u00e1 Python (python.org). No hace falta reinstalar nada.\n';
|
|
95
|
+
|
|
96
|
+
// The marker means "the launcher already warned during this install": it is deleted at the start of
|
|
97
|
+
// every run and written only when this run warns. A retry of the launcher warns again.
|
|
98
|
+
const warnedMarker = path.join(os.homedir(), '.ai-first-os', '.python-warned');
|
|
99
|
+
fs.rmSync(warnedMarker, { force: true });
|
|
100
|
+
const pythonFound = findPython() !== null;
|
|
101
|
+
if (!pythonFound) {
|
|
102
|
+
process.stderr.write(PYTHON_WARNING);
|
|
47
103
|
}
|
|
48
104
|
|
|
49
105
|
const packageRoot = path.join(__dirname, '..');
|
|
@@ -61,6 +117,8 @@ copyReplace('core');
|
|
|
61
117
|
copyReplace('README.md');
|
|
62
118
|
copyReplace('LICENSE');
|
|
63
119
|
|
|
120
|
+
if (!pythonFound) fs.writeFileSync(warnedMarker, 'The launcher warned that Python 3 was not found.\n');
|
|
121
|
+
|
|
64
122
|
const LOGO = [
|
|
65
123
|
' █████╗ ██╗ ███████╗██╗██████╗ ███████╗████████╗ ██████╗ ███████╗',
|
|
66
124
|
'██╔══██╗██║ ██╔════╝██║██╔══██╗██╔════╝╚══██╔══╝ ██╔═══██╗██╔════╝',
|
|
@@ -185,3 +243,4 @@ printLogo().then(() => {
|
|
|
185
243
|
);
|
|
186
244
|
process.stdout.write('Tell your agent: read and follow ' + bootstrapPath + '\n');
|
|
187
245
|
});
|
|
246
|
+
|
package/core/CLAUDE.md
CHANGED
|
@@ -43,7 +43,8 @@ commit `.system/tree.md` in that same turn, like any other file the brain edits.
|
|
|
43
43
|
could not be written and the reason the line gives, and do not retry silently.
|
|
44
44
|
|
|
45
45
|
If the read prints `gitignore-declared:`, it generated an index for the first time and added that
|
|
46
|
-
exact path to the brain's `.gitignore
|
|
46
|
+
exact path to the brain's `.gitignore`, or retired an index it no longer generates and dropped that
|
|
47
|
+
exact path from it: commit `.gitignore` in that same turn, the same way. The
|
|
47
48
|
index itself is never committed. If it prints `gitignore-declare-failed:`, that index could not be
|
|
48
49
|
kept out of git and was not written: tell the operator, in outcome language, and do not retry silently.
|
|
49
50
|
|
package/core/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.1.1
|
package/core/lib/bootstrap.sh
CHANGED
|
@@ -62,13 +62,6 @@ done
|
|
|
62
62
|
command -v git > /dev/null 2>&1 \
|
|
63
63
|
|| os_die "falta git: instalalo desde el canal oficial (macOS: correr \`xcode-select --install\`; Windows: bajarlo de git-scm.com — lo instala el operador, nunca el agente) y volvé a correr este mismo comando — el bootstrap no escribió nada"
|
|
64
64
|
|
|
65
|
-
# python3 es requisito duro junto a git (spec 030): mount-repo lo necesita para autorizar el
|
|
66
|
-
# checkout que monta. Mismo patrón y mismo momento que el chequeo de git — la segunda verificación,
|
|
67
|
-
# todavía antes de crear ningún archivo. Con git ausente el mensaje de arriba ya frenó, así que este
|
|
68
|
-
# chequeo solo se alcanza con git presente.
|
|
69
|
-
command -v python3 > /dev/null 2>&1 \
|
|
70
|
-
|| os_die "falta python3: instalalo desde el canal oficial (macOS: correr \`xcode-select --install\`, el mismo comando que trae git; Windows: bajarlo de python.org; Linux: el gestor de paquetes de la distro) y volvé a correr este mismo comando — el bootstrap no escribió nada"
|
|
71
|
-
|
|
72
65
|
name=""
|
|
73
66
|
language=""
|
|
74
67
|
profile=""
|
|
@@ -183,6 +176,15 @@ elif ! os_language_valido "$language"; then
|
|
|
183
176
|
fi
|
|
184
177
|
os_lang_load "$language"
|
|
185
178
|
|
|
179
|
+
# Python 3 es recomendado, no obligatorio (spec 080; reemplaza el requisito duro de la spec 030). Se
|
|
180
|
+
# busca por sus tres nombres (`os_python_find`). Sin él el cerebro nace completo y el aviso dice, en el
|
|
181
|
+
# idioma del cerebro, qué dos funcionalidades no van a estar. La persona lo ve una sola vez por
|
|
182
|
+
# instalación: si el lanzador `npx` ya lo imprimió (antes de que existiera un cerebro, en los dos
|
|
183
|
+
# idiomas) dejó `.python-warned` en la raíz del producto instalado, y acá no se repite.
|
|
184
|
+
if ! os_python_find && [ ! -f "$here/../../.python-warned" ]; then
|
|
185
|
+
printf '%s\n' "$S_PYTHON_MISSING_WARNING" >&2
|
|
186
|
+
fi
|
|
187
|
+
|
|
186
188
|
templates="$here/../templates"
|
|
187
189
|
mkdir -p "$brain"
|
|
188
190
|
# Ruta física: `git rev-parse --show-toplevel` la devuelve resuelta, y comparar contra una ruta con
|