@dotrino/remote-agent 0.3.2 → 0.4.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/README.md +4 -0
- package/package.json +2 -2
- package/src/agent.js +8 -1
package/README.md
CHANGED
|
@@ -62,6 +62,10 @@ const ra = await startRemoteAgent({
|
|
|
62
62
|
onRevoked () { console.log('me revocaron') }
|
|
63
63
|
})
|
|
64
64
|
// ra.machine, ra.machineId, ra.master, ra.close()
|
|
65
|
+
// ra.client → el WebSocketProxyClient ya conectado e identificado bajo esta
|
|
66
|
+
// máquina. Si tu agente necesita algo más del transporte (anunciarse en un
|
|
67
|
+
// canal, por ejemplo), REUSA este: abrir una segunda conexión sería un segundo
|
|
68
|
+
// `identify`, una segunda identidad de transporte y una segunda cola.
|
|
65
69
|
```
|
|
66
70
|
|
|
67
71
|
Enrolar la máquina (una vez, con el QR del vault):
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotrino/remote-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@dotrino/identity": "0.53.0",
|
|
27
|
-
"@dotrino/proxy-client": "0.10.
|
|
27
|
+
"@dotrino/proxy-client": "0.10.1",
|
|
28
28
|
"ws": "8.21.0"
|
|
29
29
|
},
|
|
30
30
|
"engines": {
|
package/src/agent.js
CHANGED
|
@@ -74,6 +74,13 @@ class AgentSession {
|
|
|
74
74
|
* @param {()=>void} [opts.onReady] agente listo y escuchando.
|
|
75
75
|
* @param {boolean} [opts.quiet] sin logs.
|
|
76
76
|
* @param {object} [opts.client] transporte ya conectado (SOLO pruebas).
|
|
77
|
+
*
|
|
78
|
+
* Devuelve además el **`client`** (el `WebSocketProxyClient` ya conectado e
|
|
79
|
+
* identificado bajo la pubkey de esta máquina). Se expone a propósito: un agente
|
|
80
|
+
* que necesite algo más del transporte —anunciarse en un canal, por ejemplo— debe
|
|
81
|
+
* reusar ESTA conexión y no abrir otra. Dos conexiones del mismo aparato al proxy
|
|
82
|
+
* son dos identidades de transporte, dos `identify` y dos colas: exactamente el
|
|
83
|
+
* lío que este middleware existe para evitar.
|
|
77
84
|
*/
|
|
78
85
|
export async function startRemoteAgent (opts = {}) {
|
|
79
86
|
const dir = opts.dir || dataDir()
|
|
@@ -279,7 +286,7 @@ export async function startRemoteAgent (opts = {}) {
|
|
|
279
286
|
}
|
|
280
287
|
if (opts.onReady) { try { opts.onReady({ machine: myPub, machineId: myId, master }) } catch (_) {} }
|
|
281
288
|
|
|
282
|
-
return { machine: myPub, machineId: myId, master, close: stop }
|
|
289
|
+
return { machine: myPub, machineId: myId, master, client, close: stop }
|
|
283
290
|
}
|
|
284
291
|
|
|
285
292
|
export default { startRemoteAgent }
|