@deinossrl/dgp-agent 1.4.2 → 1.4.4
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 +59 -6
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -95,7 +95,41 @@ function deleteConfigValue(key) {
|
|
|
95
95
|
// Cargar config del archivo
|
|
96
96
|
const fileConfig = loadConfigFile();
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Obtiene configuración global desde la plataforma (Supabase)
|
|
100
|
+
* La config es compartida por todos los agentes
|
|
101
|
+
*/
|
|
102
|
+
async function fetchPlatformConfig() {
|
|
103
|
+
try {
|
|
104
|
+
const url = 'https://asivayhbrqennwiwttds.supabase.co/functions/v1/dgp-agent-config';
|
|
105
|
+
const response = await fetch(url, {
|
|
106
|
+
method: 'POST',
|
|
107
|
+
headers: {
|
|
108
|
+
'Content-Type': 'application/json',
|
|
109
|
+
'apikey': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFzaXZheWhicnFlbm53aXd0dGRzIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjczMDAwOTcsImV4cCI6MjA4Mjg3NjA5N30.s3a7dR-dPkEXI7B2lUTUXU69923hhuX6meheNeo5EKA',
|
|
110
|
+
},
|
|
111
|
+
body: JSON.stringify({}),
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
if (!response.ok) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const data = await response.json();
|
|
119
|
+
if (data.found && data.config) {
|
|
120
|
+
return data.config;
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
} catch (e) {
|
|
124
|
+
// Silently fail - platform config is optional
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Variable para config de la plataforma (se carga async)
|
|
130
|
+
let platformConfig = null;
|
|
131
|
+
|
|
132
|
+
// Configuración (prioridad: env vars > archivo config > platform config > defaults)
|
|
99
133
|
const CONFIG = {
|
|
100
134
|
apiUrl: process.env.DGP_API_URL || fileConfig.apiUrl || 'https://asivayhbrqennwiwttds.supabase.co/functions/v1/dgp-agent-status',
|
|
101
135
|
commandsUrl: process.env.DGP_COMMANDS_URL || fileConfig.commandsUrl || 'https://asivayhbrqennwiwttds.supabase.co/rest/v1/dgp_agent_commands',
|
|
@@ -366,9 +400,26 @@ async function runAIMode() {
|
|
|
366
400
|
console.log(`${colors.cyan}╚═══════════════════════════════════════════════════════╝${colors.reset}`);
|
|
367
401
|
console.log('');
|
|
368
402
|
|
|
403
|
+
// Intentar cargar config global desde la plataforma si no hay API key local
|
|
404
|
+
if (!CONFIG.anthropicApiKey) {
|
|
405
|
+
logInfo('Buscando configuración en la plataforma...');
|
|
406
|
+
platformConfig = await fetchPlatformConfig();
|
|
407
|
+
|
|
408
|
+
if (platformConfig?.anthropic_api_key) {
|
|
409
|
+
CONFIG.anthropicApiKey = platformConfig.anthropic_api_key;
|
|
410
|
+
if (platformConfig.ai_model) {
|
|
411
|
+
CONFIG.aiModel = platformConfig.ai_model;
|
|
412
|
+
}
|
|
413
|
+
logSuccess('Configuración cargada desde la plataforma');
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
369
417
|
if (!CONFIG.anthropicApiKey) {
|
|
370
418
|
logError('ANTHROPIC_API_KEY not set.');
|
|
371
|
-
log('
|
|
419
|
+
log('Opciones para configurar:', 'yellow');
|
|
420
|
+
log(' 1. Web: Configuración > Agente IA en TenMinute IA', 'gray');
|
|
421
|
+
log(' 2. CLI: dgp-agent config set anthropic-api-key sk-ant-...', 'gray');
|
|
422
|
+
log(' 3. ENV: export ANTHROPIC_API_KEY=sk-ant-...', 'gray');
|
|
372
423
|
process.exit(1);
|
|
373
424
|
}
|
|
374
425
|
|
|
@@ -592,7 +643,7 @@ async function reportStatus(status) {
|
|
|
592
643
|
const payload = {
|
|
593
644
|
machine_id: CONFIG.machineId,
|
|
594
645
|
timestamp: new Date().toISOString(),
|
|
595
|
-
agent_version: '1.4.
|
|
646
|
+
agent_version: '1.4.3',
|
|
596
647
|
status,
|
|
597
648
|
};
|
|
598
649
|
|
|
@@ -891,7 +942,7 @@ async function runAgent(deployMode = false) {
|
|
|
891
942
|
console.log('');
|
|
892
943
|
console.log(`${colors.green}╔═══════════════════════════════════════════════════════╗${colors.reset}`);
|
|
893
944
|
console.log(`${colors.green}║ DGP Agent - Despliegue-GPT Local Agent ║${colors.reset}`);
|
|
894
|
-
console.log(`${colors.green}║ @deinossrl/dgp-agent v1.4.
|
|
945
|
+
console.log(`${colors.green}║ @deinossrl/dgp-agent v1.4.4 ║${colors.reset}`);
|
|
895
946
|
console.log(`${colors.green}╚═══════════════════════════════════════════════════════╝${colors.reset}`);
|
|
896
947
|
console.log('');
|
|
897
948
|
|
|
@@ -1007,7 +1058,7 @@ async function showStatus() {
|
|
|
1007
1058
|
function showHelp() {
|
|
1008
1059
|
console.log(`
|
|
1009
1060
|
${colors.bold}${colors.cyan}DGP Agent - Despliegue-GPT Local Agent${colors.reset}
|
|
1010
|
-
${colors.gray}@deinossrl/dgp-agent v1.4.
|
|
1061
|
+
${colors.gray}@deinossrl/dgp-agent v1.4.4${colors.reset}
|
|
1011
1062
|
|
|
1012
1063
|
${colors.bold}DESCRIPCIÓN${colors.reset}
|
|
1013
1064
|
Agente local que reporta el estado de tu repositorio Git
|
|
@@ -1058,6 +1109,8 @@ ${colors.bold}REQUISITOS PARA DEPLOY${colors.reset}
|
|
|
1058
1109
|
- Permisos sudo para reload nginx (vía sudoers sin password)
|
|
1059
1110
|
|
|
1060
1111
|
${colors.bold}CHANGELOG${colors.reset}
|
|
1112
|
+
${colors.cyan}v1.4.4${colors.reset} - Config global (compartida por todos los agentes)
|
|
1113
|
+
${colors.cyan}v1.4.3${colors.reset} - Config desde plataforma web (TenMinute IA)
|
|
1061
1114
|
${colors.cyan}v1.4.2${colors.reset} - Fix: alineación banner, config persistente
|
|
1062
1115
|
${colors.cyan}v1.3.0${colors.reset} - AI Mode: ejecuta tareas con lenguaje natural
|
|
1063
1116
|
${colors.cyan}v1.2.7${colors.reset} - Fix: update via Edge Function (401 fix)
|
|
@@ -1223,7 +1276,7 @@ switch (command) {
|
|
|
1223
1276
|
case 'version':
|
|
1224
1277
|
case '-v':
|
|
1225
1278
|
case '--version':
|
|
1226
|
-
console.log('@deinossrl/dgp-agent v1.4.
|
|
1279
|
+
console.log('@deinossrl/dgp-agent v1.4.4');
|
|
1227
1280
|
break;
|
|
1228
1281
|
case 'ai':
|
|
1229
1282
|
case '--ai':
|