@deinossrl/dgp-agent 1.4.7 → 1.4.9
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/index.mjs +38 -18
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -203,7 +203,7 @@ async function fetchPlatformConfig() {
|
|
|
203
203
|
let platformConfig = null;
|
|
204
204
|
|
|
205
205
|
// Versión y modo del agente
|
|
206
|
-
const AGENT_VERSION = '1.4.
|
|
206
|
+
const AGENT_VERSION = '1.4.9';
|
|
207
207
|
let AGENT_MODE = 'status'; // 'status' | 'deploy' | 'ai'
|
|
208
208
|
|
|
209
209
|
// Configuración (prioridad: env vars > archivo config > platform config > defaults)
|
|
@@ -233,6 +233,27 @@ const colors = {
|
|
|
233
233
|
bold: '\x1b[1m',
|
|
234
234
|
};
|
|
235
235
|
|
|
236
|
+
/**
|
|
237
|
+
* Genera un banner con padding automático
|
|
238
|
+
*/
|
|
239
|
+
function printBanner(lines, color = 'cyan') {
|
|
240
|
+
const maxLen = Math.max(...lines.map(l => l.length));
|
|
241
|
+
const width = maxLen + 10; // padding de 5 a cada lado
|
|
242
|
+
const c = colors[color];
|
|
243
|
+
const r = colors.reset;
|
|
244
|
+
|
|
245
|
+
console.log('');
|
|
246
|
+
console.log(`${c}╔${'═'.repeat(width)}╗${r}`);
|
|
247
|
+
for (const line of lines) {
|
|
248
|
+
const padding = width - line.length - 2;
|
|
249
|
+
const leftPad = Math.floor(padding / 2);
|
|
250
|
+
const rightPad = padding - leftPad;
|
|
251
|
+
console.log(`${c}║${' '.repeat(leftPad + 1)}${line}${' '.repeat(rightPad + 1)}║${r}`);
|
|
252
|
+
}
|
|
253
|
+
console.log(`${c}╚${'═'.repeat(width)}╝${r}`);
|
|
254
|
+
console.log('');
|
|
255
|
+
}
|
|
256
|
+
|
|
236
257
|
function log(message, color = 'reset') {
|
|
237
258
|
const timestamp = new Date().toLocaleTimeString();
|
|
238
259
|
console.log(`${colors.gray}[${timestamp}]${colors.reset} ${colors[color]}${message}${colors.reset}`);
|
|
@@ -475,12 +496,10 @@ async function runAIMode() {
|
|
|
475
496
|
savePid();
|
|
476
497
|
AGENT_MODE = 'ai';
|
|
477
498
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
console.log(`${colors.cyan}╚═══════════════════════════════════════════════════════╝${colors.reset}`);
|
|
483
|
-
console.log('');
|
|
499
|
+
printBanner([
|
|
500
|
+
`DGP Agent - AI Mode v${AGENT_VERSION} 🤖`,
|
|
501
|
+
'Powered by Claude'
|
|
502
|
+
], 'cyan');
|
|
484
503
|
|
|
485
504
|
// Intentar cargar config global desde la plataforma si no hay API key local
|
|
486
505
|
if (!CONFIG.anthropicApiKey) {
|
|
@@ -597,17 +616,18 @@ async function runAIMode() {
|
|
|
597
616
|
setInterval(pollAITasks, CONFIG.commandPollInterval * 1000);
|
|
598
617
|
|
|
599
618
|
// También reportar status periódicamente
|
|
600
|
-
const
|
|
619
|
+
const doReportStatus = async () => {
|
|
601
620
|
try {
|
|
602
621
|
const status = getRepoStatus();
|
|
603
|
-
await
|
|
622
|
+
await reportStatus(status);
|
|
604
623
|
} catch (e) {
|
|
605
|
-
//
|
|
624
|
+
// Log error para debug
|
|
625
|
+
console.error(`${colors.red}[Error reportando status]${colors.reset}`, e.message);
|
|
606
626
|
}
|
|
607
627
|
};
|
|
608
628
|
|
|
609
|
-
await
|
|
610
|
-
setInterval(
|
|
629
|
+
await doReportStatus();
|
|
630
|
+
setInterval(doReportStatus, CONFIG.interval * 1000);
|
|
611
631
|
}
|
|
612
632
|
|
|
613
633
|
// ============================================
|
|
@@ -1081,12 +1101,10 @@ async function runAgent(deployMode = false) {
|
|
|
1081
1101
|
savePid();
|
|
1082
1102
|
AGENT_MODE = deployMode ? 'deploy' : 'status';
|
|
1083
1103
|
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
console.log(`${colors.green}╚═══════════════════════════════════════════════════════╝${colors.reset}`);
|
|
1089
|
-
console.log('');
|
|
1104
|
+
printBanner([
|
|
1105
|
+
'DGP Agent - Despliegue-GPT Local Agent',
|
|
1106
|
+
`@deinossrl/dgp-agent v${AGENT_VERSION}`
|
|
1107
|
+
], 'green');
|
|
1090
1108
|
|
|
1091
1109
|
if (!isGitRepo()) {
|
|
1092
1110
|
logError('Not a git repository. Run this command from inside a git repo.');
|
|
@@ -1251,6 +1269,8 @@ ${colors.bold}REQUISITOS PARA DEPLOY${colors.reset}
|
|
|
1251
1269
|
- Permisos sudo para reload nginx (vía sudoers sin password)
|
|
1252
1270
|
|
|
1253
1271
|
${colors.bold}CHANGELOG${colors.reset}
|
|
1272
|
+
${colors.cyan}v1.4.9${colors.reset} - Fix: AI Mode no reportaba status a la plataforma
|
|
1273
|
+
${colors.cyan}v1.4.8${colors.reset} - Banner dinámico con padding automático
|
|
1254
1274
|
${colors.cyan}v1.4.7${colors.reset} - Modo AI visible en web, auto-kill agente anterior
|
|
1255
1275
|
${colors.cyan}v1.4.6${colors.reset} - Fix: versión en banner AI Mode
|
|
1256
1276
|
${colors.cyan}v1.4.5${colors.reset} - Modo escucha: recibe tareas AI desde la web
|