corvusmem 0.3.0 → 0.3.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/CHANGELOG.md +9 -0
- package/package.json +1 -1
- package/src/facts.mjs +7 -4
- package/src/lib.mjs +30 -2
- package/src/session-state.mjs +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,15 @@ Format based on [Keep a Changelog](https://keepachangelog.com/); versions follow
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.3.1] — 2026-11-07
|
|
9
|
+
### Fixed
|
|
10
|
+
- **Standalone memory folder is now English.** When Corvus runs on its own (no Senzu), project facts live in
|
|
11
|
+
`.corvusmem/memory/facts.jsonl` (and corrupted lines in `facts.corrupt.jsonl`) instead of the Spanish
|
|
12
|
+
`memoria/hechos.jsonl` — consistent with the English-first product. **Coupled to Senzu it is unchanged**
|
|
13
|
+
(`senzu/memoria/hechos.jsonl`, shared with Senzu), and the user-global memory is unchanged too. Existing
|
|
14
|
+
standalone installs are **migrated automatically and idempotently** on first read or write: the old
|
|
15
|
+
`.corvusmem/memoria/` is renamed to `.corvusmem/memory/` with the facts intact, so nothing is lost.
|
|
16
|
+
|
|
8
17
|
## [0.3.0] — 2026-11-05
|
|
9
18
|
### Added
|
|
10
19
|
- **Standalone project folder.** In a project without Senzu, Corvus now keeps its memory in its own
|
package/package.json
CHANGED
package/src/facts.mjs
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
// VARIOS (objetivo, pendiente, nota…) acumulan.
|
|
9
9
|
// · búsqueda: palabras con Intl.Segmenter (también japonés, chino, árabe…), sin tildes ni mayúsculas, BM25,
|
|
10
10
|
// erratas por distancia de edición acotada y «claves» que el agente añade en otros idiomas para buscar entre idiomas.
|
|
11
|
-
// Almacén
|
|
11
|
+
// Almacén (proyecto): acoplado a Senzu -> senzu/memoria/hechos.jsonl; standalone -> .corvusmem/memory/facts.jsonl.
|
|
12
|
+
// Memoria del usuario (todos sus proyectos): hechos.jsonl junto a ella (compartida con Senzu, nombre en español).
|
|
12
13
|
|
|
13
14
|
import fs from 'node:fs';
|
|
14
15
|
import path from 'node:path';
|
|
@@ -16,7 +17,7 @@ import crypto from 'node:crypto';
|
|
|
16
17
|
import os from 'node:os';
|
|
17
18
|
import { spawnSync } from 'node:child_process';
|
|
18
19
|
import { fileURLToPath } from 'node:url';
|
|
19
|
-
import { ruta, rutaMemoriaUsuario, rutaEstado, localeUI } from './lib.mjs';
|
|
20
|
+
import { ruta, rutaMemoriaUsuario, rutaEstado, localeUI, nombresMemoria, migrarMemoriaCorvus } from './lib.mjs';
|
|
20
21
|
export { rutaNativa, localeUI, carpetaBase } from './lib.mjs'; // memory.mjs: --path (C:\, C:/, /c/ de Git Bash → el mismo almacén), idioma de UI y carpeta base (senzu/ vs .corvusmem/)
|
|
21
22
|
|
|
22
23
|
export const FAMILIAS_VARIOS = /^(objetivo|pendiente|nota|hecho|enlace|aprendizaje)(\.|$)/;
|
|
@@ -39,7 +40,9 @@ function autorActual(root, env = process.env) {
|
|
|
39
40
|
return 'unknown';
|
|
40
41
|
}
|
|
41
42
|
export function rutaHechos(root, alcance = 'proyecto') {
|
|
42
|
-
|
|
43
|
+
if (alcance === 'usuario') return path.join(path.dirname(rutaMemoriaUsuario()), 'hechos.jsonl'); // compartida con Senzu: nombre en español
|
|
44
|
+
migrarMemoriaCorvus(root); // instalaciones viejas: .corvusmem/memoria/hechos.jsonl -> .corvusmem/memory/facts.jsonl (idempotente)
|
|
45
|
+
return path.join(ruta(root, 'memoria'), nombresMemoria(root).facts); // standalone: memory/facts.jsonl · acoplado/legacy: memoria/hechos.jsonl
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
// ---------------------------------------------------------------- texto: normalizar y partir en palabras
|
|
@@ -226,7 +229,7 @@ function conCerrojo(file, fn, espera = 8000) {
|
|
|
226
229
|
function escribirHechos(file, lista, ilegibles = []) {
|
|
227
230
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
228
231
|
if (ilegibles.length) { // lo ilegible no se pierde: se aparta para recuperarlo a mano
|
|
229
|
-
const danado = path.join(path.dirname(file), 'hechos.danado.jsonl');
|
|
232
|
+
const danado = path.join(path.dirname(file), path.basename(file) === 'facts.jsonl' ? 'facts.corrupt.jsonl' : 'hechos.danado.jsonl');
|
|
230
233
|
let ya = ''; try { ya = fs.readFileSync(danado, 'utf8'); } catch { }
|
|
231
234
|
const nuevas = ilegibles.filter(l => !ya.includes(l));
|
|
232
235
|
if (nuevas.length) fs.appendFileSync(danado, nuevas.map(l => l.replace(/\r/g, '')).join('\n') + '\n');
|
package/src/lib.mjs
CHANGED
|
@@ -101,9 +101,37 @@ export function carpetaBase(root) {
|
|
|
101
101
|
if (esLegado(root)) return CARPETA; // legacy Senzu project (root devlog / .dev-standards.json)
|
|
102
102
|
return CARPETA_CORVUS; // brand-new, no Senzu -> Corvus owns its dir
|
|
103
103
|
}
|
|
104
|
+
// Facts storage names. Standalone (Corvus's own .corvusmem/) uses English names; coupled to Senzu (or a legacy
|
|
105
|
+
// layout) keeps Senzu's Spanish names, because the file is SHARED with Senzu and must stay compatible.
|
|
106
|
+
export const MEM_DIR_ES = 'memoria', MEM_FACTS_ES = 'hechos.jsonl', MEM_CORRUPT_ES = 'hechos.danado.jsonl';
|
|
107
|
+
export const MEM_DIR_EN = 'memory', MEM_FACTS_EN = 'facts.jsonl', MEM_CORRUPT_EN = 'facts.corrupt.jsonl';
|
|
108
|
+
export function nombresMemoria(root) {
|
|
109
|
+
return carpetaBase(root) === CARPETA_CORVUS
|
|
110
|
+
? { dir: MEM_DIR_EN, facts: MEM_FACTS_EN, corrupt: MEM_CORRUPT_EN }
|
|
111
|
+
: { dir: MEM_DIR_ES, facts: MEM_FACTS_ES, corrupt: MEM_CORRUPT_ES };
|
|
112
|
+
}
|
|
113
|
+
// One-time, idempotent migration: older standalone installs kept facts in .corvusmem/memoria/hechos.jsonl.
|
|
114
|
+
// Rename that to .corvusmem/memory/facts.jsonl (and the corrupted-lines file) so a standalone Corvus reads English.
|
|
115
|
+
// NEVER touches a Senzu-coupled or legacy project (base must be .corvusmem). Safe under races: best-effort, swallowed.
|
|
116
|
+
export function migrarMemoriaCorvus(root) {
|
|
117
|
+
if (carpetaBase(root) !== CARPETA_CORVUS) return;
|
|
118
|
+
const base = path.join(root, CARPETA_CORVUS), viejoDir = path.join(base, MEM_DIR_ES), nuevoDir = path.join(base, MEM_DIR_EN);
|
|
119
|
+
try {
|
|
120
|
+
if (!fs.existsSync(path.join(viejoDir, MEM_FACTS_ES)) || fs.existsSync(path.join(nuevoDir, MEM_FACTS_EN))) return;
|
|
121
|
+
fs.mkdirSync(nuevoDir, { recursive: true });
|
|
122
|
+
for (const [de, a] of [[MEM_FACTS_ES, MEM_FACTS_EN], [MEM_CORRUPT_ES, MEM_CORRUPT_EN]]) {
|
|
123
|
+
const o = path.join(viejoDir, de), n = path.join(nuevoDir, a);
|
|
124
|
+
if (fs.existsSync(o) && !fs.existsSync(n)) { try { fs.renameSync(o, n); } catch { try { fs.copyFileSync(o, n); fs.rmSync(o, { force: true }); } catch { } } }
|
|
125
|
+
}
|
|
126
|
+
try { if (!fs.readdirSync(viejoDir).length) fs.rmdirSync(viejoDir); } catch { } // si queda vacía, se va
|
|
127
|
+
} catch { /* best-effort: si no se puede migrar, se sigue leyendo el viejo via ruta() */ }
|
|
128
|
+
}
|
|
104
129
|
const VIEJA = { 'ui-verify': '.ui-verify', 'senzu.json': '.dev-standards.json', auditoria: 'docs/auditoria', entrega: 'docs/entrega', 'mapa.md': 'docs/MAPA.md' };
|
|
105
|
-
export function ruta(root, nombre) { // 'devlog' | 'plan' | 'design-system' | 'conventions.md' | 'conventions.json' | 'ui-verify' | 'senzu.json'
|
|
106
|
-
const
|
|
130
|
+
export function ruta(root, nombre) { // 'devlog' | 'plan' | 'design-system' | 'conventions.md' | 'conventions.json' | 'ui-verify' | 'senzu.json' | 'memoria'
|
|
131
|
+
const base = carpetaBase(root);
|
|
132
|
+
// 'memoria' es la carpeta de hechos: en standalone (.corvusmem) se llama 'memory' (inglés); acoplado/legacy sigue 'memoria'
|
|
133
|
+
const nombreReal = nombre === 'memoria' && base === CARPETA_CORVUS ? MEM_DIR_EN : nombre;
|
|
134
|
+
const nueva = path.join(root, base, nombreReal);
|
|
107
135
|
const vieja = path.join(root, VIEJA[nombre] || nombre);
|
|
108
136
|
const [primera, segunda] = esLegado(root) ? [vieja, nueva] : [nueva, vieja];
|
|
109
137
|
if (fs.existsSync(primera)) return primera;
|
package/src/session-state.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
readHookInput, projectRoot, sessionFlag, testOnce, editadosSesion, gitCambios, gitBranch, planStatus,
|
|
12
12
|
devlogEntradas, readText, rutaEstado, memoriaProyecto, rutaMemoriaUsuario, ruta, rutaRel,
|
|
13
13
|
} from './lib.mjs';
|
|
14
|
-
import { todosLosHechos, marcarUsoSesion, textosDelAgente, rutaBuscador, rutaUso } from './facts.mjs'; // la de facts.mjs: ruta REAL junto al hook
|
|
14
|
+
import { todosLosHechos, marcarUsoSesion, textosDelAgente, rutaBuscador, rutaUso, rutaHechos } from './facts.mjs'; // la de facts.mjs: ruta REAL junto al hook
|
|
15
15
|
|
|
16
16
|
const p = readHookInput() || {};
|
|
17
17
|
const root = projectRoot();
|
|
@@ -55,7 +55,7 @@ try { marcarUsoSesion(root, sid, p.transcript_path ? textosDelAgente(p.transcrip
|
|
|
55
55
|
// idioma; también la vista de cliente si existe). Si nunca lo generó, no se crea nada.
|
|
56
56
|
if (evento === 'Stop') try {
|
|
57
57
|
const dir = ruta(root, 'cortex'), mt = f => { try { return fs.statSync(f).mtimeMs; } catch { return 0; } };
|
|
58
|
-
const fuentes = Math.max(mt(
|
|
58
|
+
const fuentes = Math.max(mt(rutaHechos(root)), mt(path.join(ruta(root, 'devlog'), 'MEMORIA.md')), mt(path.join(ruta(root, 'devlog'), 'INDEX.md')), mt(rutaUso(root))); // X-T10: también lo que ha consultado (cómo piensa)
|
|
59
59
|
const cli = rutaBuscador(root).replace(/buscar\.mjs$/, 'memory.mjs');
|
|
60
60
|
for (const [archivo, extra] of [['index.html', []], ['cliente.html', ['--cliente']]]) {
|
|
61
61
|
const f = path.join(dir, archivo);
|