ghosty-acp 0.0.3 → 0.0.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.
Files changed (2) hide show
  1. package/bridge.mjs +6 -1
  2. package/package.json +1 -1
package/bridge.mjs CHANGED
@@ -48,8 +48,11 @@ const ws = new WebSocket(target);
48
48
  // sueltan en orden al abrir.
49
49
  let cola = [];
50
50
 
51
+ let abierto = false;
52
+
51
53
  ws.onopen = () => {
52
54
  clearTimeout(avisoLento);
55
+ abierto = true;
53
56
  diag("listo");
54
57
  for (const linea of cola) ws.send(linea + "\n");
55
58
  cola = [];
@@ -66,7 +69,9 @@ ws.onclose = (e) => {
66
69
  clearTimeout(avisoLento);
67
70
  // 1006 sin motivo es lo que se ve cuando el servidor rechaza el upgrade: casi siempre
68
71
  // el token. Decirlo aquí evita el rato de mirar el editor pensando que es cosa suya.
69
- if (e.code === 1006 && !e.reason) {
72
+ // Sólo es un rechazo si nunca llegó a abrir: un 1006 tras «listo» es la caja o la red
73
+ // cortando una conexión que sí autenticó, y mandar a revisar el token ahí despista.
74
+ if (e.code === 1006 && !e.reason && !abierto) {
70
75
  diag(token ? "rechazado (1006): revisa el token de este agente" : "rechazado (1006): falta GHOSTY_ACP_TOKEN");
71
76
  } else {
72
77
  diag(`conexión cerrada (${e.code}${e.reason ? `: ${e.reason}` : ""})`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ghosty-acp",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Conecta tu editor a un agente ACP remoto. Puente entre entrada/salida estándar y WebSocket, sin dependencias.",
5
5
  "type": "module",
6
6
  "bin": { "ghosty-acp": "bridge.mjs" },