@deinossrl/dgp-agent 1.4.49 → 1.4.50

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 +12 -0
  2. package/index.mjs +50 -0
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog - DGP Agent
2
2
 
3
+ ## [1.4.50] - 2026-01-12
4
+
5
+ ### Added
6
+ - Descarga automática de PostgreSQL tools al iniciar el agente por primera vez
7
+ - El agente prepara pg_dump en background sin bloquear el inicio
8
+ - Mejora la experiencia: herramientas listas cuando el usuario las necesita
9
+
10
+ ### Changed
11
+ - Función `prepareToolsInBackground()` se ejecuta al inicio del agente
12
+ - Mensajes informativos discretos durante la preparación
13
+ - Si pg_dump ya existe, solo verifica y continúa
14
+
3
15
  ## [1.4.49] - 2026-01-12
4
16
 
5
17
  ### Fixed
package/index.mjs CHANGED
@@ -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.50",
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": {