@deinossrl/dgp-agent 1.4.49 → 1.4.51

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/index.mjs +52 -2
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog - DGP Agent
2
2
 
3
+ ## [1.4.51] - 2026-01-12
4
+
5
+ ### Fixed
6
+ - Aumentado delay de 1s a 3s para liberar file handle del ZIP en Windows
7
+ - Resuelve error "El proceso no puede obtener acceso al archivo" al extraer
8
+ - Instalación más robusta en Windows con rutas con espacios
9
+
10
+ ## [1.4.50] - 2026-01-12
11
+
12
+ ### Added
13
+ - Descarga automática de PostgreSQL tools al iniciar el agente por primera vez
14
+ - El agente prepara pg_dump en background sin bloquear el inicio
15
+ - Mejora la experiencia: herramientas listas cuando el usuario las necesita
16
+
17
+ ### Changed
18
+ - Función `prepareToolsInBackground()` se ejecuta al inicio del agente
19
+ - Mensajes informativos discretos durante la preparación
20
+ - Si pg_dump ya existe, solo verifica y continúa
21
+
3
22
  ## [1.4.49] - 2026-01-12
4
23
 
5
24
  ### Fixed
package/index.mjs CHANGED
@@ -1507,7 +1507,7 @@ async function findOrInstallPgDump() {
1507
1507
  file.close();
1508
1508
  logInfo('Descarga completada. Extrayendo...');
1509
1509
 
1510
- // Dar tiempo a Windows para liberar el handle del archivo
1510
+ // Dar tiempo a Windows para liberar el handle del archivo (aumentado a 3 segundos)
1511
1511
  setTimeout(() => {
1512
1512
  // Extraer solo pg_dump.exe y sus DLLs necesarias
1513
1513
  try {
@@ -1545,7 +1545,7 @@ async function findOrInstallPgDump() {
1545
1545
  } catch (extractError) {
1546
1546
  reject(new Error(`Error al extraer: ${extractError.message}`));
1547
1547
  }
1548
- }, 1000); // Esperar 1 segundo para que Windows libere el archivo
1548
+ }, 3000); // Esperar 3 segundos para que Windows libere el archivo
1549
1549
  });
1550
1550
  }).on('error', reject);
1551
1551
  } else {
@@ -2363,6 +2363,52 @@ function printStatus(status) {
2363
2363
  /**
2364
2364
  * Loop principal del agente - SIEMPRE inteligente
2365
2365
  */
2366
+ /**
2367
+ * Prepara herramientas necesarias en background (pg_dump, etc.)
2368
+ * No bloquea el inicio del agente
2369
+ */
2370
+ function prepareToolsInBackground() {
2371
+ // Ejecutar en background sin bloquear
2372
+ (async () => {
2373
+ try {
2374
+ // Verificar si pg_dump ya existe
2375
+ const isWindows = process.platform === 'win32';
2376
+ const executableName = isWindows ? 'pg_dump.exe' : 'pg_dump';
2377
+ const localPgDump = join(BIN_DIR, executableName);
2378
+
2379
+ // Si ya existe, no hacer nada
2380
+ if (existsSync(localPgDump)) {
2381
+ logCommand('✓ pg_dump disponible');
2382
+ return;
2383
+ }
2384
+
2385
+ // Si no existe, verificar si está en PATH
2386
+ try {
2387
+ const checkCmd = isWindows ? 'where pg_dump' : 'which pg_dump';
2388
+ const output = execSync(checkCmd, { encoding: 'utf-8' }).trim();
2389
+ if (output) {
2390
+ logCommand(`✓ pg_dump encontrado en PATH`);
2391
+ return;
2392
+ }
2393
+ } catch (e) {
2394
+ // No está en PATH, continuar con descarga
2395
+ }
2396
+
2397
+ // Descargar pg_dump automáticamente
2398
+ logInfo('⏳ Preparando PostgreSQL tools en background...');
2399
+ logCommand(' Esto puede tomar 2-3 minutos (80 MB)');
2400
+
2401
+ await findOrInstallPgDump();
2402
+
2403
+ logSuccess('✓ PostgreSQL tools listo para usar');
2404
+ } catch (error) {
2405
+ // No fallar el agente si falla la descarga
2406
+ logCommand(`⚠️ No se pudo preparar pg_dump: ${error.message}`);
2407
+ logCommand(' Se descargará automáticamente al crear el primer backup');
2408
+ }
2409
+ })();
2410
+ }
2411
+
2366
2412
  async function runAgent() {
2367
2413
  // Matar agente anterior y guardar PID
2368
2414
  killPreviousAgent();
@@ -2399,6 +2445,10 @@ async function runAgent() {
2399
2445
  logInfo(`Reporta cada ${CONFIG.interval}s | Escucha cada ${CONFIG.commandPollInterval}s`);
2400
2446
 
2401
2447
  console.log('');
2448
+
2449
+ // Preparar herramientas en background (pg_dump, etc.)
2450
+ prepareToolsInBackground();
2451
+
2402
2452
  logInfo('Escuchando comandos de la web...');
2403
2453
  logInfo('Presiona Ctrl+C para detener');
2404
2454
  console.log('');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deinossrl/dgp-agent",
3
- "version": "1.4.49",
3
+ "version": "1.4.51",
4
4
  "description": "Agente local para Despliegue-GPT - Reporta el estado del repositorio Git a la plataforma TenMinute IA",
5
5
  "main": "index.mjs",
6
6
  "bin": {