@dotrino/remote-agent 0.16.0 → 0.17.0
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/package.json +3 -3
- package/src/agent.js +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotrino/remote-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Middleware compartido del ecosistema Dotrino para apps de agente remoto cifrado punto a punto (handshake E2E, emparejamiento SAS con vault, revocación, descubrimiento). Lo consumen dotrino-terminal (PTY) y dotrino-ia (chat con IA).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
],
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@dotrino/identity": ">=0.92.0",
|
|
50
|
-
"@dotrino/proxy-client": ">=0.
|
|
50
|
+
"@dotrino/proxy-client": ">=0.30.0",
|
|
51
51
|
"@dotrino/vault": ">=0.64.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@dotrino/identity": "0.105.0",
|
|
55
|
-
"@dotrino/proxy-client": "0.
|
|
55
|
+
"@dotrino/proxy-client": "0.30.0",
|
|
56
56
|
"@dotrino/vault": "0.75.0"
|
|
57
57
|
}
|
|
58
58
|
}
|
package/src/agent.js
CHANGED
|
@@ -77,6 +77,7 @@ class AgentSession {
|
|
|
77
77
|
* @param {()=>void} [opts.onRevoked] se llamó al auto-borrarse por revocación.
|
|
78
78
|
* @param {()=>void} [opts.onReady] agente listo y escuchando.
|
|
79
79
|
* @param {boolean} [opts.quiet] sin logs.
|
|
80
|
+
* @param {number} [opts.netLogMs] cada cuánto van al log las estadísticas de red (5 min).
|
|
80
81
|
* @param {object} [opts.client] transporte ya conectado (SOLO pruebas).
|
|
81
82
|
*
|
|
82
83
|
* Devuelve además el **`client`** (el `WebSocketProxyClient` ya conectado e
|
|
@@ -394,8 +395,18 @@ export async function startRemoteAgent (opts = {}) {
|
|
|
394
395
|
s._ingest(p.env).catch(() => send(from, { type: ERROR, error: 'sobre inválido' }))
|
|
395
396
|
}
|
|
396
397
|
|
|
398
|
+
// POR DÓNDE VA EL TRÁFICO, AL LOG. Un agente no tiene topbar: sin esto, saber si una
|
|
399
|
+
// sesión subió a WebRTC o sigue dando la vuelta por el proxio pedía una prueba aparte.
|
|
400
|
+
// Lo escribe el pilar (`logStats`), que lee los clientes del proceso; aquí solo se enciende.
|
|
401
|
+
let net = null
|
|
402
|
+
if (!opts.quiet) {
|
|
403
|
+
const { logStats } = await import('@dotrino/proxy-client')
|
|
404
|
+
net = logStats({ label: 'remote-agent', everyMs: opts.netLogMs })
|
|
405
|
+
}
|
|
406
|
+
|
|
397
407
|
const stop = () => {
|
|
398
408
|
clearInterval(revTimer); clearInterval(sweeper)
|
|
409
|
+
if (net) net.stop().catch(() => {})
|
|
399
410
|
for (const s of sessions.values()) s.close()
|
|
400
411
|
try { client.close() } catch {}
|
|
401
412
|
}
|