@deinossrl/dgp-agent 1.4.33 → 1.4.35

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 (2) hide show
  1. package/index.mjs +21 -4
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -227,11 +227,28 @@ function saveSshKeyLocally(sshPrivateKey) {
227
227
  // Verificar si la key tiene los delimitadores BEGIN/END
228
228
  if (!normalizedKey.includes('-----BEGIN')) {
229
229
  console.log('[!] SSH Key sin delimitadores, agregándolos automáticamente...');
230
- // Agregar header y footer OpenSSH
231
- normalizedKey = `-----BEGIN OPENSSH PRIVATE KEY-----\n${normalizedKey}\n-----END OPENSSH PRIVATE KEY-----`;
230
+ // Agregar header y footer OpenSSH (con salto de línea final)
231
+ normalizedKey = `-----BEGIN OPENSSH PRIVATE KEY-----\n${normalizedKey}\n-----END OPENSSH PRIVATE KEY-----\n`;
232
232
  }
233
233
 
234
- writeFileSync(keyPath, normalizedKey, { mode: 0o600 });
234
+ // Asegurar que siempre termine con salto de línea
235
+ if (!normalizedKey.endsWith('\n')) {
236
+ normalizedKey += '\n';
237
+ }
238
+
239
+ writeFileSync(keyPath, normalizedKey);
240
+
241
+ // Establecer permisos 600 (solo owner puede leer/escribir)
242
+ try {
243
+ chmodSync(keyPath, 0o600);
244
+ } catch (e) {
245
+ // En Windows puede fallar, intentar con comando nativo
246
+ if (process.platform === 'win32') {
247
+ try {
248
+ shellSync(`icacls "${keyPath}" /inheritance:r /grant:r "%USERNAME%:RW"`);
249
+ } catch {}
250
+ }
251
+ }
235
252
 
236
253
  return keyPath;
237
254
  } catch (e) {
@@ -329,7 +346,7 @@ function getPlinkPath() {
329
346
  }
330
347
 
331
348
  // Versión del agente
332
- const AGENT_VERSION = '1.4.33';
349
+ const AGENT_VERSION = '1.4.35';
333
350
  let AGENT_MODE = 'smart'; // Siempre inteligente
334
351
 
335
352
  // Configuración (prioridad: env vars > archivo config > platform config > defaults)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deinossrl/dgp-agent",
3
- "version": "1.4.33",
3
+ "version": "1.4.35",
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": {