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