@nopeek/agent-bridge 0.7.1 → 0.7.2

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/dist/bridge.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { BridgeConfig, Pairing, BrainSpec, BrainBackend } from "./config.js";
2
- export declare const VERSION = "0.7.1";
2
+ export declare const VERSION = "0.7.2";
3
3
  export interface PairRequest {
4
4
  pairingSecret: string;
5
5
  appId: string;
package/dist/bridge.js CHANGED
@@ -17,7 +17,7 @@ import { resolveBrain } from "./brain.js";
17
17
  import { provisionSoul, provisionHermesProfile } from "./backends.js";
18
18
  import { reportCapabilities } from "./capabilities.js";
19
19
  import { isBrainBackend } from "./config.js";
20
- export const VERSION = "0.7.1";
20
+ export const VERSION = "0.7.2";
21
21
  /** How often to re-probe + report brain availability to the server. */
22
22
  const CAPABILITIES_INTERVAL_MS = 5 * 60_000;
23
23
  export class PairError extends Error {
package/dist/control.d.ts CHANGED
@@ -41,6 +41,7 @@ export declare class ControlSocket {
41
41
  private handlers;
42
42
  private ws;
43
43
  private stopped;
44
+ private heartbeat;
44
45
  private delay;
45
46
  /** Log tag — with several sockets running, lines must say whose they are. */
46
47
  private tag;
package/dist/control.js CHANGED
@@ -9,6 +9,7 @@ export class ControlSocket {
9
9
  handlers;
10
10
  ws = null;
11
11
  stopped = false;
12
+ heartbeat = null;
12
13
  delay = 2_000;
13
14
  /** Log tag — with several sockets running, lines must say whose they are. */
14
15
  tag;
@@ -47,6 +48,18 @@ export class ControlSocket {
47
48
  this.ws = ws;
48
49
  ws.onopen = () => {
49
50
  console.log(`${this.tag} socket open, awaiting auth.ok`);
51
+ // Heartbeat: the server closes sockets idle >60s; the SDK pings every
52
+ // 25s and so do we — otherwise the control socket flaps once a minute
53
+ // and adopt/config pushes can land in a reconnect gap.
54
+ this.heartbeat = setInterval(() => {
55
+ try {
56
+ ws.send(JSON.stringify({ type: "ping" }));
57
+ }
58
+ catch {
59
+ /* mid-close */
60
+ }
61
+ }, 25_000);
62
+ this.heartbeat.unref?.();
50
63
  };
51
64
  ws.onmessage = (ev) => {
52
65
  let frame;
@@ -63,6 +76,10 @@ export class ControlSocket {
63
76
  // onclose always follows; log there.
64
77
  };
65
78
  ws.onclose = (ev) => {
79
+ if (this.heartbeat) {
80
+ clearInterval(this.heartbeat);
81
+ this.heartbeat = null;
82
+ }
66
83
  const was = this.connected;
67
84
  this.connected = false;
68
85
  if (this.stopped)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nopeek/agent-bridge",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Run your own agents as E2EE NoPeek bots. Pairs with one-time codes (multiple accounts per computer), runs every bot each account owns, and pipes messages to any command or webhook.",
5
5
  "type": "module",
6
6
  "license": "MIT",