@nac3/forge-cli 1.14.0 → 1.16.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/dist/audit/persistence_async.d.ts +101 -0
- package/dist/audit/persistence_async.d.ts.map +1 -0
- package/dist/audit/persistence_async.js +435 -0
- package/dist/audit/persistence_async.js.map +1 -0
- package/dist/bin/yf.d.ts.map +1 -1
- package/dist/bin/yf.js +2 -0
- package/dist/bin/yf.js.map +1 -1
- package/dist/chat/doctrine_digest.d.ts.map +1 -1
- package/dist/chat/doctrine_digest.js +17 -9
- package/dist/chat/doctrine_digest.js.map +1 -1
- package/dist/chat/server.d.ts.map +1 -1
- package/dist/chat/server.js +71 -7
- package/dist/chat/server.js.map +1 -1
- package/dist/commands/audit-persistence.d.ts +33 -0
- package/dist/commands/audit-persistence.d.ts.map +1 -0
- package/dist/commands/audit-persistence.js +173 -0
- package/dist/commands/audit-persistence.js.map +1 -0
- package/dist/docs/doctrine/persistence-interface.md +113 -0
- package/dist/relay/presence_cadence.d.ts +105 -0
- package/dist/relay/presence_cadence.d.ts.map +1 -0
- package/dist/relay/presence_cadence.js +105 -0
- package/dist/relay/presence_cadence.js.map +1 -0
- package/dist/relay/relay_publisher.d.ts +5 -0
- package/dist/relay/relay_publisher.d.ts.map +1 -1
- package/dist/relay/relay_publisher.js +1 -0
- package/dist/relay/relay_publisher.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/doctrine/persistence-interface.md +113 -0
- package/package.json +1 -1
- package/templates/nextjs-app/package.json +2 -1
- package/templates/react-app/package.json +2 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `yf audit persistence [path]` -- la interfaz de persistencia es ASINCRONICA.
|
|
3
|
+
*
|
|
4
|
+
* El candado que le faltaba a Forge, y la razon esta en ADIP-Kikan (Pablo,
|
|
5
|
+
* 13-oct-2026): el brain construyo la capa de repositorio bien y persiste en
|
|
6
|
+
* MariaDB desde el primer commit, pero definio la interfaz SINCRONICA. Eso
|
|
7
|
+
* obligo al store de MariaDB a mantener el working set en RAM para servir
|
|
8
|
+
* lecturas sincronas, y de ahi el esquema degenero en una tabla generica de
|
|
9
|
+
* JSON. Una firma de funcion, 1.543 puntos de deuda y nueve slices de
|
|
10
|
+
* conversion.
|
|
11
|
+
*
|
|
12
|
+
* El analisis vive en `src/audit/persistence_async.ts`, puro y con bateria.
|
|
13
|
+
* Este archivo es solo el recorrido del arbol y el reporte.
|
|
14
|
+
*
|
|
15
|
+
* Corre sobre CUALQUIER proyecto -- recien nacido o heredado -- y no necesita
|
|
16
|
+
* configuracion: el detector reconoce un store por su nombre, por su carpeta o
|
|
17
|
+
* por su forma.
|
|
18
|
+
*
|
|
19
|
+
* ASCII-only.
|
|
20
|
+
*/
|
|
21
|
+
import type { Command } from 'commander';
|
|
22
|
+
export interface AuditPersistenceOptions {
|
|
23
|
+
json?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface Recolectado {
|
|
26
|
+
fuentes: Array<[string, string]>;
|
|
27
|
+
/** Salteados por generados/minificados. Se REPORTAN: un salteo invisible es
|
|
28
|
+
* un agujero del mismo tipo que un ilegible que cuenta cero. */
|
|
29
|
+
generados: string[];
|
|
30
|
+
}
|
|
31
|
+
export declare function recolectarFuentes(raiz: string): Recolectado;
|
|
32
|
+
export declare function registerAuditPersistenceCommand(program: Command): void;
|
|
33
|
+
//# sourceMappingURL=audit-persistence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-persistence.d.ts","sourceRoot":"","sources":["../../src/commands/audit-persistence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwCzC,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACjC;qEACiE;IACjE,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CA4B3D;AAoED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyBtE"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { readdirSync, statSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { c, header } from '../ui/colors.js';
|
|
4
|
+
import { analizar, aprueba } from '../audit/persistence_async.js';
|
|
5
|
+
const OMITIR = new Set([
|
|
6
|
+
'node_modules', 'dist', 'coverage', '.git', '.next', 'build', '.expo',
|
|
7
|
+
'.turbo', 'out', 'vendor', 'third_party', '__pycache__', 'site-packages',
|
|
8
|
+
'bower_components', '.cache', '.tox', 'target', '.gradle', '.idea',
|
|
9
|
+
]);
|
|
10
|
+
/* Los entornos virtuales de Python se llaman `.venv`, `venv`, `.venv_test`,
|
|
11
|
+
* `env`... y adentro traen el chromium de Playwright con sus bundles. */
|
|
12
|
+
const OMITIR_PREFIJO = ['.venv', 'venv', '.env-', 'env-'];
|
|
13
|
+
const EXT = /\.(js|mjs|cjs|ts|tsx)$/;
|
|
14
|
+
/* Las baterias quedan afuera: un doble de test SINCRONICO es legitimo -- lo que
|
|
15
|
+
* no puede ser sincronico es el store del que depende el producto. */
|
|
16
|
+
const ES_TEST = /\.(test|spec)\.[jt]sx?$/;
|
|
17
|
+
const ES_MINIFICADO = /\.(min|bundle|chunk)\.[jt]s$/;
|
|
18
|
+
/* Una linea de mas de 1000 caracteres no la escribio una persona: es un bundle,
|
|
19
|
+
* un minificado o un blob generado. Nunca es la capa de persistencia de nadie,
|
|
20
|
+
* y ademas no se puede analizar con sentido.
|
|
21
|
+
*
|
|
22
|
+
* Calibrado contra ADIP-Kikan (13-oct-2026): la primera corrida reporto 26
|
|
23
|
+
* hallazgos dentro de `xtermModule-COQkjINf.js`, un bundle de Playwright
|
|
24
|
+
* metido en un `.venv_harness`. Ese ruido es exactamente lo que hace que un
|
|
25
|
+
* equipo apague un control, y un control apagado no vigila nada. */
|
|
26
|
+
const LARGO_DE_LINEA_GENERADO = 1000;
|
|
27
|
+
function pareceGenerado(texto) {
|
|
28
|
+
let largo = 0;
|
|
29
|
+
for (let i = 0; i < texto.length; i++) {
|
|
30
|
+
if (texto[i] === '\n') {
|
|
31
|
+
largo = 0;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (++largo > LARGO_DE_LINEA_GENERADO)
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
export function recolectarFuentes(raiz) {
|
|
40
|
+
const fuentes = [];
|
|
41
|
+
const generados = [];
|
|
42
|
+
const omitirDir = (n) => OMITIR.has(n) || OMITIR_PREFIJO.some((p) => n.startsWith(p));
|
|
43
|
+
const rec = (dir) => {
|
|
44
|
+
let items;
|
|
45
|
+
try {
|
|
46
|
+
items = readdirSync(dir);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
for (const nombre of items.sort()) {
|
|
52
|
+
const p = path.join(dir, nombre);
|
|
53
|
+
let st;
|
|
54
|
+
try {
|
|
55
|
+
st = statSync(p);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (st.isDirectory()) {
|
|
61
|
+
if (!omitirDir(nombre))
|
|
62
|
+
rec(p);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (!EXT.test(nombre) || ES_TEST.test(nombre))
|
|
66
|
+
continue;
|
|
67
|
+
const rel = path.relative(raiz, p).split(path.sep).join('/');
|
|
68
|
+
if (ES_MINIFICADO.test(nombre)) {
|
|
69
|
+
generados.push(rel);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
let texto;
|
|
73
|
+
try {
|
|
74
|
+
texto = readFileSync(p, 'utf8');
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (pareceGenerado(texto)) {
|
|
80
|
+
generados.push(rel);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
fuentes.push([rel, texto]);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
rec(raiz);
|
|
87
|
+
return { fuentes, generados };
|
|
88
|
+
}
|
|
89
|
+
function imprimir(raiz, r, archivos, generados) {
|
|
90
|
+
header('Yujin Forge -- audit persistence');
|
|
91
|
+
console.log('');
|
|
92
|
+
console.log(' Proyecto: ' + c.dim(raiz));
|
|
93
|
+
console.log(' ' + c.dim(archivos + ' archivos leidos, ' + r.modulos.length + ' modulo(s) de persistencia'
|
|
94
|
+
+ (generados ? ', ' + generados + ' generado(s)/minificado(s) salteado(s)' : '')));
|
|
95
|
+
console.log('');
|
|
96
|
+
if (r.modulos.length === 0) {
|
|
97
|
+
console.log(c.dim(' No se detecto ninguna capa de persistencia.'));
|
|
98
|
+
console.log('');
|
|
99
|
+
console.log(c.success(' OK') + c.dim(' -- nada que vigilar todavia.'));
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
console.log(' Metodos de acceso a datos: ' + r.vistos
|
|
103
|
+
+ c.dim(' (async ' + r.asincronicos + ' / sincronicos ' + r.hallazgos.length + ')'));
|
|
104
|
+
console.log('');
|
|
105
|
+
if (r.hallazgos.length > 0) {
|
|
106
|
+
console.log(c.error(' SINCRONICOS -- cada uno es una interfaz que no puede envolver una base real:'));
|
|
107
|
+
const porArchivo = new Map();
|
|
108
|
+
for (const h of r.hallazgos) {
|
|
109
|
+
const lista = porArchivo.get(h.archivo) ?? [];
|
|
110
|
+
lista.push(h);
|
|
111
|
+
porArchivo.set(h.archivo, lista);
|
|
112
|
+
}
|
|
113
|
+
for (const [archivo, lista] of porArchivo) {
|
|
114
|
+
console.log(' ' + c.dim(archivo));
|
|
115
|
+
for (const h of lista) {
|
|
116
|
+
console.log(' ' + c.error('x') + ' linea ' + String(h.linea).padStart(4)
|
|
117
|
+
+ ' ' + h.metodo + '()' + c.dim(' [' + h.forma + ']'));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
console.log('');
|
|
121
|
+
}
|
|
122
|
+
if (r.exentos.length > 0) {
|
|
123
|
+
console.log(c.warn(' Eximidos a mano (' + r.exentos.length + '):'));
|
|
124
|
+
for (const e of r.exentos) {
|
|
125
|
+
console.log(' ' + c.dim(e.archivo + ':' + e.linea) + ' ' + e.metodo + '() -- ' + e.motivo);
|
|
126
|
+
}
|
|
127
|
+
console.log('');
|
|
128
|
+
}
|
|
129
|
+
if (r.ilegibles.length > 0) {
|
|
130
|
+
console.log(c.error(' NO SE PUDIERON ANALIZAR (' + r.ilegibles.length + '):'));
|
|
131
|
+
for (const f of r.ilegibles)
|
|
132
|
+
console.log(' ' + c.error('?') + ' ' + f);
|
|
133
|
+
console.log(c.dim(' Un archivo que no se puede afirmar NO cuenta como cero: el control falla.'));
|
|
134
|
+
console.log('');
|
|
135
|
+
}
|
|
136
|
+
if (aprueba(r)) {
|
|
137
|
+
console.log(c.success(' OK') + ' -- toda la interfaz de persistencia es asincronica.');
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
console.log(c.error(' FALLA'));
|
|
141
|
+
console.log('');
|
|
142
|
+
console.log(c.dim(' Por que esto importa, y por que se arregla AHORA y no despues:'));
|
|
143
|
+
console.log(c.dim(' `await` sobre un valor que no es Promise no hace nada, asi que declarar'));
|
|
144
|
+
console.log(c.dim(' el store async hoy cuesta CERO -- incluso con el store en memoria. El'));
|
|
145
|
+
console.log(c.dim(' camino inverso es cada punto de llamada del sistema: en ADIP-Kikan'));
|
|
146
|
+
console.log(c.dim(' fueron 1.543, en nueve slices. Las dos opciones no son simetricas.'));
|
|
147
|
+
}
|
|
148
|
+
export function registerAuditPersistenceCommand(program) {
|
|
149
|
+
const audit = program.commands.find((cmd) => cmd.name() === 'audit')
|
|
150
|
+
?? program.command('audit').description('Controles estaticos sobre un proyecto.');
|
|
151
|
+
audit
|
|
152
|
+
.command('persistence [path]')
|
|
153
|
+
.description('Exige que todo metodo de un store/repositorio este declarado async.')
|
|
154
|
+
.option('--json', 'emitir JSON en vez del reporte legible')
|
|
155
|
+
.action(async (where, opts) => {
|
|
156
|
+
const raiz = path.resolve(process.cwd(), where ?? '.');
|
|
157
|
+
const { fuentes, generados } = recolectarFuentes(raiz);
|
|
158
|
+
const r = analizar(fuentes);
|
|
159
|
+
if (opts.json) {
|
|
160
|
+
process.stdout.write(JSON.stringify({
|
|
161
|
+
root: raiz, files: fuentes.length, skipped_generated: generados,
|
|
162
|
+
ok: aprueba(r), ...r,
|
|
163
|
+
}, null, 2) + '\n');
|
|
164
|
+
if (!aprueba(r))
|
|
165
|
+
process.exitCode = 1;
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
imprimir(raiz, r, fuentes.length, generados.length);
|
|
169
|
+
if (!aprueba(r))
|
|
170
|
+
process.exitCode = 1;
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=audit-persistence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-persistence.js","sourceRoot":"","sources":["../../src/commands/audit-persistence.ts"],"names":[],"mappings":"AAqBA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAkB,MAAM,+BAA+B,CAAC;AAElF,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC;IACrB,cAAc,EAAE,MAAM,EAAE,UAAU,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I,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;gBAClC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,iBAAiB,EAAE,SAAS;gBAC/D,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;aACrB,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;YACpB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;gBAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACtC,OAAO;QACT,CAAC;QAED,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# The persistence interface is async from line one
|
|
2
|
+
|
|
3
|
+
A rule with no sizing round, no questions to the owner, and no exceptions
|
|
4
|
+
worth arguing about. It is free to obey and it is the most expensive thing
|
|
5
|
+
in this repo to disobey.
|
|
6
|
+
|
|
7
|
+
## The rule
|
|
8
|
+
|
|
9
|
+
**Every method of every store, repository or DAO is declared `async`, from
|
|
10
|
+
the first commit, whatever is behind it.** In memory, on disk, over a
|
|
11
|
+
network, a stub that returns `null` -- all of them.
|
|
12
|
+
|
|
13
|
+
Mechanically enforced by `yf audit persistence`. New projects carry it in
|
|
14
|
+
their own CI. The check fails on a synchronous method and it also fails on a
|
|
15
|
+
file it cannot analyse: a store whose signature cannot be asserted is not a
|
|
16
|
+
store that passed.
|
|
17
|
+
|
|
18
|
+
## Why it needs no information to decide
|
|
19
|
+
|
|
20
|
+
The two directions are not symmetric:
|
|
21
|
+
|
|
22
|
+
| Direction | Cost |
|
|
23
|
+
|---|---|
|
|
24
|
+
| async interface, synchronous implementation behind it | **zero.** `await` on a non-Promise is a no-op |
|
|
25
|
+
| synchronous interface, later made async | **every call site in the system** |
|
|
26
|
+
|
|
27
|
+
An asymmetric decision is always taken on the recoverable side. There is no
|
|
28
|
+
volumetry that makes the sync interface the better bet, because the sync
|
|
29
|
+
interface's only advantage is that it is marginally shorter to type.
|
|
30
|
+
|
|
31
|
+
So this rule does not wait for G9, does not wait for the owner to answer how
|
|
32
|
+
many rows per year, and does not appear in the options catalogue. It is not a
|
|
33
|
+
choice.
|
|
34
|
+
|
|
35
|
+
## What it actually prevents: ADIP-Kikan
|
|
36
|
+
|
|
37
|
+
Measured, 13-oct-2026. Kikan's first commit reads *"nucleo kawa/sazanami +
|
|
38
|
+
persistencia MariaDB"*. The brain built the repository layer, built two
|
|
39
|
+
implementations, and wired production to MariaDB with write-through and
|
|
40
|
+
boot-time hydration. The data was durable and always had been.
|
|
41
|
+
|
|
42
|
+
One decision was wrong, and it was a **signature**: the repository interface
|
|
43
|
+
was synchronous. Everything else followed mechanically.
|
|
44
|
+
|
|
45
|
+
1. A real SQL driver is asynchronous, and a synchronous interface cannot
|
|
46
|
+
wrap one.
|
|
47
|
+
2. So the "MariaDB store" had to keep the working set in RAM to serve reads
|
|
48
|
+
synchronously. Its own header says so: *"lecturas sincronas, interfaz
|
|
49
|
+
IDENTICA a createMemoryStore -> no reescribe el motor"*.
|
|
50
|
+
3. And because an in-memory working set needs no columns, the schema
|
|
51
|
+
degenerated into **one generic table of JSON rows** (`engine_rows`), with
|
|
52
|
+
the 57 normalised tables demoted to a derived read-model instead of being
|
|
53
|
+
the system of record.
|
|
54
|
+
|
|
55
|
+
The bill: **1.543 call sites**, nine conversion slices, a static ratchet
|
|
56
|
+
built to hold the line, and a reengineering plan of its own.
|
|
57
|
+
|
|
58
|
+
## Why a brain walks into it
|
|
59
|
+
|
|
60
|
+
Not from ignorance. Every step is locally correct:
|
|
61
|
+
|
|
62
|
+
- When the engine is being written there is **no database yet**. The first
|
|
63
|
+
store you write so the engine is testable is the in-memory one, and its
|
|
64
|
+
natural signature is synchronous -- correct, at that moment.
|
|
65
|
+
- The engine is written against that signature. Now every future store must
|
|
66
|
+
match it or the engine breaks.
|
|
67
|
+
- When the real SQL store finally gets written, that signature is
|
|
68
|
+
load-bearing for hundreds of call sites. Making it async is a repo-wide
|
|
69
|
+
change no single turn can justify and nobody asked for. So the SQL store
|
|
70
|
+
contorts to fit the signature instead.
|
|
71
|
+
|
|
72
|
+
Each step is reasonable. The aggregate is wrong. That is the failure mode of
|
|
73
|
+
incremental construction without an invariant that is checked, and it is why
|
|
74
|
+
this one is a mechanical gate and not a paragraph of advice.
|
|
75
|
+
|
|
76
|
+
Note also what the model never wrote: it never wrote "in-memory
|
|
77
|
+
persistence". It wrote "a repository with a synchronous interface", and that
|
|
78
|
+
shape is everywhere in any training corpus -- every test double, every
|
|
79
|
+
in-process repo, every small app without an ORM. The dangerous default is
|
|
80
|
+
the *common* one, not an exotic one.
|
|
81
|
+
|
|
82
|
+
## The decision that was never taken
|
|
83
|
+
|
|
84
|
+
There was no turn whose subject was "choose the persistence architecture".
|
|
85
|
+
It accumulated. `docs/doctrine/sizing.md` carries the same finding for
|
|
86
|
+
volumetry; this file carries it for the interface, because the interface is
|
|
87
|
+
the half that costs nothing to get right and everything to get wrong.
|
|
88
|
+
|
|
89
|
+
## Exemptions
|
|
90
|
+
|
|
91
|
+
A genuinely synchronous accessor that will never cross a process boundary
|
|
92
|
+
can be marked in place:
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
// persistence-async-ok: in-RAM index, never touches disk or network
|
|
96
|
+
get(key) { return this.index.get(key); }
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The checker **counts and reports** exemptions. An invisible exemption is a
|
|
100
|
+
hole; a counted one is a decision someone can review. Blanket-disabling the
|
|
101
|
+
check is not an exemption, it is the defect.
|
|
102
|
+
|
|
103
|
+
## What this rule does NOT say
|
|
104
|
+
|
|
105
|
+
- It does not say the store must be SQL. A memory store is fine for a
|
|
106
|
+
prototype; the sizing gate decides that. This rule is only about the
|
|
107
|
+
**signature**.
|
|
108
|
+
- It does not require returning a real Promise. `async` on something that
|
|
109
|
+
already returns one changes nothing; the rule is "declared `async`"
|
|
110
|
+
because that is trivial to satisfy and trivial to verify, and a strict
|
|
111
|
+
simple rule beats a clever one that needs interpreting.
|
|
112
|
+
- It does not apply to test doubles. A synchronous fake inside a battery is
|
|
113
|
+
legitimate; the checker skips `*.test.*` and `*.spec.*` for that reason.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cada cuanto late la presencia del desktop en el relay.
|
|
3
|
+
*
|
|
4
|
+
* Por que es un modulo con tests y no un ternario adentro del setInterval
|
|
5
|
+
* (Pablo, 12-oct-2026): el latido era fijo en 15s, ocioso o trabajando, y eso
|
|
6
|
+
* medido contra el D1 de produccion daba esto:
|
|
7
|
+
*
|
|
8
|
+
* - 426 de los 500 eventos retenidos del handle (85%) eran latido;
|
|
9
|
+
* - la ventana ENTERA del relay era de 107 minutos (RETAIN=500 / 4 por
|
|
10
|
+
* minuto), asi que todo lo que importa -- turnos, estados, tableros --
|
|
11
|
+
* se caia solo por el peso del latido;
|
|
12
|
+
* - la cola de 40 que pide un refresco traia 34 latidos y 6 eventos utiles:
|
|
13
|
+
* 8 minutos de ventana. Completamente ocioso, los 40 son latido y el
|
|
14
|
+
* refresco no trae NADA que mostrar. Eso es el "no actualiza ninguna
|
|
15
|
+
* pestana".
|
|
16
|
+
* - y cada latido son ~3 filas escritas en D1 (insert + seq + retencion):
|
|
17
|
+
* 17.280 filas por dia por instancia SIN HACER NADA, contra las 100.000
|
|
18
|
+
* del tier gratis.
|
|
19
|
+
*
|
|
20
|
+
* Es el mismo bug que se arreglo el 11-oct sacando `activity` de la cola del
|
|
21
|
+
* chat, y el arreglo no alcanzo: se quito al inundador para proteger al
|
|
22
|
+
* latido, y el latido paso a ser el inundador. La diferencia es que `activity`
|
|
23
|
+
* inunda mientras hay turno y el latido inunda PARA SIEMPRE.
|
|
24
|
+
*
|
|
25
|
+
* La cadencia no puede ser plana en el otro sentido tampoco: el turno en vuelo
|
|
26
|
+
* VIAJA dentro del latido (ver in_flight_turn.ts), que es justo lo que se
|
|
27
|
+
* arreglo el 11-oct para que el telefono muestre el pedido en proceso. Un
|
|
28
|
+
* latido de 5 minutos lo romperia.
|
|
29
|
+
*
|
|
30
|
+
* De ahi las tres reglas: rapido con turno en vuelo (acotado por la duracion
|
|
31
|
+
* del turno), lento ocioso (el caso eterno), e inmediato cuando el ESTADO
|
|
32
|
+
* cambia -- que es lo que hace que el pedido aparezca al instante sin pagar la
|
|
33
|
+
* cadencia rapida el resto del dia.
|
|
34
|
+
*
|
|
35
|
+
* ASCII puro.
|
|
36
|
+
*/
|
|
37
|
+
/** Con turno en vuelo. Lo paga la duracion del turno, no el dia entero. */
|
|
38
|
+
export declare const PRESENCE_WORKING_MS = 15000;
|
|
39
|
+
/** Ocioso. 20x mas lento que el anterior: 864 filas/dia en vez de 17.280, y
|
|
40
|
+
* la ventana del relay pasa de 2h a 41h. */
|
|
41
|
+
export declare const PRESENCE_IDLE_MS = 300000;
|
|
42
|
+
/** Cada cuanto se EVALUA la decision. No es la cadencia: es la resolucion con
|
|
43
|
+
* que se detecta un cambio de estado (regla 2), que es lo unico que necesita
|
|
44
|
+
* reaccionar rapido. Un tick que decide no latir no hace ninguna E/S. */
|
|
45
|
+
export declare const PRESENCE_TICK_MS = 5000;
|
|
46
|
+
export interface PresenceInfo {
|
|
47
|
+
hostname: string;
|
|
48
|
+
project_slug?: string | null;
|
|
49
|
+
turn?: {
|
|
50
|
+
id: string;
|
|
51
|
+
} | null;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* La firma del ESTADO anunciado. Dos latidos con la misma firma dicen lo
|
|
55
|
+
* mismo; uno con firma distinta es informacion nueva y no espera la cadencia.
|
|
56
|
+
*
|
|
57
|
+
* Lleva el id del turno y no el turno entero a proposito: `started_at` es
|
|
58
|
+
* constante dentro de un turno y `user` tambien, asi que el id ya distingue
|
|
59
|
+
* todo lo que cambia. Incluir el objeto completo haria que un cambio de
|
|
60
|
+
* formato de fecha se leyera como estado nuevo.
|
|
61
|
+
*/
|
|
62
|
+
export declare function presenceSignature(info: PresenceInfo): string;
|
|
63
|
+
export interface BeatDecision {
|
|
64
|
+
/** Si hay que publicar el latido en este tick. */
|
|
65
|
+
beat: boolean;
|
|
66
|
+
/** Por que. Solo para diagnostico y para que los tests afirmen la RAZON y
|
|
67
|
+
* no solo el booleano: un `true` por el motivo equivocado es un bug que
|
|
68
|
+
* pasa verde. */
|
|
69
|
+
reason: 'first' | 'state_changed' | 'working_cadence' | 'idle_cadence' | 'hold';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Decide si late. Pura: toda la entrada es argumento.
|
|
73
|
+
*
|
|
74
|
+
* El orden importa. `state_changed` va ANTES de las cadencias porque un turno
|
|
75
|
+
* que arranca no puede esperar: si el cambio de estado quedara detras de la
|
|
76
|
+
* cadencia ociosa, el pedido en proceso tardaria hasta 5 minutos en aparecer
|
|
77
|
+
* en el telefono, que es exactamente el sintoma que el latido con turno vino
|
|
78
|
+
* a resolver.
|
|
79
|
+
*/
|
|
80
|
+
export declare function decideBeat(args: {
|
|
81
|
+
now: number;
|
|
82
|
+
/** Momento del ultimo latido publicado, o null si no hubo ninguno. */
|
|
83
|
+
lastBeatAt: number | null;
|
|
84
|
+
/** Firma del ultimo latido publicado, o null si no hubo ninguno. */
|
|
85
|
+
lastSig: string | null;
|
|
86
|
+
/** Firma del estado actual. */
|
|
87
|
+
sig: string;
|
|
88
|
+
/** Si hay un turno en vuelo. */
|
|
89
|
+
working: boolean;
|
|
90
|
+
}): BeatDecision;
|
|
91
|
+
/**
|
|
92
|
+
* TTL minimo que puede usar el telefono para dar por muerta a una instancia,
|
|
93
|
+
* derivado de la cadencia en vez de escrito a mano en el otro lado del repo.
|
|
94
|
+
*
|
|
95
|
+
* Por que derivado: antes eran 48.000 ms contra un latido de 15.000, o sea 3
|
|
96
|
+
* latidos de margen, y las dos constantes vivian en archivos distintos sin
|
|
97
|
+
* nada que las ligara. Bajar la cadencia sin tocar el TTL habria hecho que el
|
|
98
|
+
* telefono borre como muerta a toda instancia ociosa viva -- y eso se ve como
|
|
99
|
+
* "el desktop se desconecto", el sintoma que estamos persiguiendo.
|
|
100
|
+
*
|
|
101
|
+
* Tres latidos ociosos: tolera dos perdidos seguidos (un flush fallido, un
|
|
102
|
+
* corte de red corto) antes de declarar muerta a una instancia que esta viva.
|
|
103
|
+
*/
|
|
104
|
+
export declare const INSTANCE_TTL_MS: number;
|
|
105
|
+
//# sourceMappingURL=presence_cadence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presence_cadence.d.ts","sourceRoot":"","sources":["../../src/relay/presence_cadence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAC1C;6CAC6C;AAC7C,eAAO,MAAM,gBAAgB,SAAU,CAAC;AACxC;;0EAE0E;AAC1E,eAAO,MAAM,gBAAgB,OAAQ,CAAC;AAEtC,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAK5D;AAED,MAAM,WAAW,YAAY;IAC3B,kDAAkD;IAClD,IAAI,EAAE,OAAO,CAAC;IACd;;sBAEkB;IAClB,MAAM,EAAE,OAAO,GAAG,eAAe,GAAG,iBAAiB,GAAG,cAAc,GAAG,MAAM,CAAC;CACjF;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,sEAAsE;IACtE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oEAAoE;IACpE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,gCAAgC;IAChC,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,YAAY,CAiBf;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,QAAuB,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cada cuanto late la presencia del desktop en el relay.
|
|
3
|
+
*
|
|
4
|
+
* Por que es un modulo con tests y no un ternario adentro del setInterval
|
|
5
|
+
* (Pablo, 12-oct-2026): el latido era fijo en 15s, ocioso o trabajando, y eso
|
|
6
|
+
* medido contra el D1 de produccion daba esto:
|
|
7
|
+
*
|
|
8
|
+
* - 426 de los 500 eventos retenidos del handle (85%) eran latido;
|
|
9
|
+
* - la ventana ENTERA del relay era de 107 minutos (RETAIN=500 / 4 por
|
|
10
|
+
* minuto), asi que todo lo que importa -- turnos, estados, tableros --
|
|
11
|
+
* se caia solo por el peso del latido;
|
|
12
|
+
* - la cola de 40 que pide un refresco traia 34 latidos y 6 eventos utiles:
|
|
13
|
+
* 8 minutos de ventana. Completamente ocioso, los 40 son latido y el
|
|
14
|
+
* refresco no trae NADA que mostrar. Eso es el "no actualiza ninguna
|
|
15
|
+
* pestana".
|
|
16
|
+
* - y cada latido son ~3 filas escritas en D1 (insert + seq + retencion):
|
|
17
|
+
* 17.280 filas por dia por instancia SIN HACER NADA, contra las 100.000
|
|
18
|
+
* del tier gratis.
|
|
19
|
+
*
|
|
20
|
+
* Es el mismo bug que se arreglo el 11-oct sacando `activity` de la cola del
|
|
21
|
+
* chat, y el arreglo no alcanzo: se quito al inundador para proteger al
|
|
22
|
+
* latido, y el latido paso a ser el inundador. La diferencia es que `activity`
|
|
23
|
+
* inunda mientras hay turno y el latido inunda PARA SIEMPRE.
|
|
24
|
+
*
|
|
25
|
+
* La cadencia no puede ser plana en el otro sentido tampoco: el turno en vuelo
|
|
26
|
+
* VIAJA dentro del latido (ver in_flight_turn.ts), que es justo lo que se
|
|
27
|
+
* arreglo el 11-oct para que el telefono muestre el pedido en proceso. Un
|
|
28
|
+
* latido de 5 minutos lo romperia.
|
|
29
|
+
*
|
|
30
|
+
* De ahi las tres reglas: rapido con turno en vuelo (acotado por la duracion
|
|
31
|
+
* del turno), lento ocioso (el caso eterno), e inmediato cuando el ESTADO
|
|
32
|
+
* cambia -- que es lo que hace que el pedido aparezca al instante sin pagar la
|
|
33
|
+
* cadencia rapida el resto del dia.
|
|
34
|
+
*
|
|
35
|
+
* ASCII puro.
|
|
36
|
+
*/
|
|
37
|
+
/** Con turno en vuelo. Lo paga la duracion del turno, no el dia entero. */
|
|
38
|
+
export const PRESENCE_WORKING_MS = 15_000;
|
|
39
|
+
/** Ocioso. 20x mas lento que el anterior: 864 filas/dia en vez de 17.280, y
|
|
40
|
+
* la ventana del relay pasa de 2h a 41h. */
|
|
41
|
+
export const PRESENCE_IDLE_MS = 300_000;
|
|
42
|
+
/** Cada cuanto se EVALUA la decision. No es la cadencia: es la resolucion con
|
|
43
|
+
* que se detecta un cambio de estado (regla 2), que es lo unico que necesita
|
|
44
|
+
* reaccionar rapido. Un tick que decide no latir no hace ninguna E/S. */
|
|
45
|
+
export const PRESENCE_TICK_MS = 5_000;
|
|
46
|
+
/**
|
|
47
|
+
* La firma del ESTADO anunciado. Dos latidos con la misma firma dicen lo
|
|
48
|
+
* mismo; uno con firma distinta es informacion nueva y no espera la cadencia.
|
|
49
|
+
*
|
|
50
|
+
* Lleva el id del turno y no el turno entero a proposito: `started_at` es
|
|
51
|
+
* constante dentro de un turno y `user` tambien, asi que el id ya distingue
|
|
52
|
+
* todo lo que cambia. Incluir el objeto completo haria que un cambio de
|
|
53
|
+
* formato de fecha se leyera como estado nuevo.
|
|
54
|
+
*/
|
|
55
|
+
export function presenceSignature(info) {
|
|
56
|
+
const host = String(info.hostname || '');
|
|
57
|
+
const slug = info.project_slug ? String(info.project_slug) : '';
|
|
58
|
+
const turn = info.turn && info.turn.id ? String(info.turn.id) : '';
|
|
59
|
+
return host + '|' + slug + '|' + turn;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Decide si late. Pura: toda la entrada es argumento.
|
|
63
|
+
*
|
|
64
|
+
* El orden importa. `state_changed` va ANTES de las cadencias porque un turno
|
|
65
|
+
* que arranca no puede esperar: si el cambio de estado quedara detras de la
|
|
66
|
+
* cadencia ociosa, el pedido en proceso tardaria hasta 5 minutos en aparecer
|
|
67
|
+
* en el telefono, que es exactamente el sintoma que el latido con turno vino
|
|
68
|
+
* a resolver.
|
|
69
|
+
*/
|
|
70
|
+
export function decideBeat(args) {
|
|
71
|
+
const { now, lastBeatAt, lastSig, sig, working } = args;
|
|
72
|
+
if (lastBeatAt === null || lastSig === null)
|
|
73
|
+
return { beat: true, reason: 'first' };
|
|
74
|
+
if (sig !== lastSig)
|
|
75
|
+
return { beat: true, reason: 'state_changed' };
|
|
76
|
+
const edad = now - lastBeatAt;
|
|
77
|
+
/* Un reloj que salta hacia atras (NTP, suspension) daria edad negativa y
|
|
78
|
+
* congelaria el latido hasta recuperar la diferencia. Se trata como vencido:
|
|
79
|
+
* latir de mas es barato, callarse de mas es el bug que estamos arreglando. */
|
|
80
|
+
if (edad < 0)
|
|
81
|
+
return { beat: true, reason: working ? 'working_cadence' : 'idle_cadence' };
|
|
82
|
+
if (working) {
|
|
83
|
+
return edad >= PRESENCE_WORKING_MS
|
|
84
|
+
? { beat: true, reason: 'working_cadence' }
|
|
85
|
+
: { beat: false, reason: 'hold' };
|
|
86
|
+
}
|
|
87
|
+
return edad >= PRESENCE_IDLE_MS
|
|
88
|
+
? { beat: true, reason: 'idle_cadence' }
|
|
89
|
+
: { beat: false, reason: 'hold' };
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* TTL minimo que puede usar el telefono para dar por muerta a una instancia,
|
|
93
|
+
* derivado de la cadencia en vez de escrito a mano en el otro lado del repo.
|
|
94
|
+
*
|
|
95
|
+
* Por que derivado: antes eran 48.000 ms contra un latido de 15.000, o sea 3
|
|
96
|
+
* latidos de margen, y las dos constantes vivian en archivos distintos sin
|
|
97
|
+
* nada que las ligara. Bajar la cadencia sin tocar el TTL habria hecho que el
|
|
98
|
+
* telefono borre como muerta a toda instancia ociosa viva -- y eso se ve como
|
|
99
|
+
* "el desktop se desconecto", el sintoma que estamos persiguiendo.
|
|
100
|
+
*
|
|
101
|
+
* Tres latidos ociosos: tolera dos perdidos seguidos (un flush fallido, un
|
|
102
|
+
* corte de red corto) antes de declarar muerta a una instancia que esta viva.
|
|
103
|
+
*/
|
|
104
|
+
export const INSTANCE_TTL_MS = PRESENCE_IDLE_MS * 3;
|
|
105
|
+
//# sourceMappingURL=presence_cadence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presence_cadence.js","sourceRoot":"","sources":["../../src/relay/presence_cadence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAC1C;6CAC6C;AAC7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AACxC;;0EAE0E;AAC1E,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAQtC;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAkB;IAClD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,IAAI,CAAC,YAA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AAI,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE;QACxC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACtC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,GAAG,CAAC,CAAC"}
|
|
@@ -47,6 +47,11 @@ export declare class RelayPublisher {
|
|
|
47
47
|
user: string;
|
|
48
48
|
started_at: string;
|
|
49
49
|
} | null;
|
|
50
|
+
/** Despedida: esta instancia se esta cerrando y el telefono tiene que
|
|
51
|
+
* sacarla del selector YA, sin esperar el TTL. Con la cadencia ociosa en
|
|
52
|
+
* 300s el TTL son 15 minutos, y una instancia cerrada fantasmeando ese
|
|
53
|
+
* rato hace que el telefono apunte a un desktop que no existe. */
|
|
54
|
+
gone?: boolean;
|
|
50
55
|
}): void;
|
|
51
56
|
/** One Coding-feed item (the echo of what the brain is doing). */
|
|
52
57
|
activity(summary: string, detail?: unknown): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay_publisher.d.ts","sourceRoot":"","sources":["../../src/relay/relay_publisher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAuChE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,SAAS,CAAC;IAChB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;6BACyB;IACzB,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC;IACxB;;mFAE+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,KAAK,CAA8C;IAC3D,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;IACjC,OAAO,CAAC,QAAQ,C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AE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAIrD,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,QAAQ;IAMhB;qBACiB;IACX,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA4B5B,yCAAyC;IACnC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B"}
|
|
@@ -89,6 +89,7 @@ export class RelayPublisher {
|
|
|
89
89
|
user: capUtf8(String(info.turn.user || ''), USER_BUDGET),
|
|
90
90
|
started_at: String(info.turn.started_at || ''),
|
|
91
91
|
} } : {}),
|
|
92
|
+
...(info.gone ? { gone: true } : {}),
|
|
92
93
|
} });
|
|
93
94
|
}
|
|
94
95
|
/** One Coding-feed item (the echo of what the brain is doing). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay_publisher.js","sourceRoot":"","sources":["../../src/relay/relay_publisher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAyB,YAAY,EAAE,MAAM,YAAY,CAAC;AAEjE;;;;;sEAKsE;AACtE,MAAM,UAAU,GAAG,2DAA2D,CAAC;AAC/E;8EAC8E;AAC9E,MAAM,YAAY,GAAG,EAAE,GAAG,IAAI,CAAC;AAC/B,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,CAAC;AAC7B,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC;AACnC,MAAM,gBAAgB,GAAG,CAAC,GAAG,IAAI,CAAC;AAClC,MAAM,aAAa,GAAG,EAAE,GAAG,IAAI,CAAC;AAEhC;oEACoE;AACpE,SAAS,OAAO,CAAC,CAAS,EAAE,QAAgB;IAC1C,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/C,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,MA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I,YAAY,CAAC,eAAe;gBAAE,OAAO,IAAI,CAAC;YACvD,IAAI,CAAC;gBACH,OAAO,CAAC,KAAK,CAAC,kBAAkB,GAAG,CAAC,CAAC,IAAI,GAAG,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;sBACnF,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,eAAe,GAAG,IAAI,CAAC,GAAG,qBAAqB,CAAC,CAAC;YACzF,CAAC;YAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC;YACtB,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QACH,IAAI,CAAC;YACH,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;gBAAE,MAAM,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACvE,CAAC;QAAC,MAAM,CAAC,CAAC,2CAA2C,CAAC,CAAC;gBAC/C,CAAC;YACP,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACtB,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;gBAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,yCAAyC;IACzC,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAAC,CAAC;QAChE,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;CACF"}
|
package/dist/version.d.ts
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Yujin Forge CLI version. Kept in sync with package.json by the npm
|
|
3
3
|
* "version" lifecycle (scripts/sync_version.mjs) so the two never drift.
|
|
4
4
|
*/
|
|
5
|
-
export declare const VERSION = "1.
|
|
5
|
+
export declare const VERSION = "1.16.0";
|
|
6
6
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED