@nopeek/agent-bridge 0.7.6 → 0.7.7

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/backends.js CHANGED
@@ -139,19 +139,31 @@ function runClaudeOnce(bin, args, text, cwd, timeoutMs, tag, onDelta) {
139
139
  console.error(`${tag} stderr: ${stderr.slice(0, 1000)}`);
140
140
  resolvePromise({ reply, exitCode });
141
141
  };
142
- const timer = setTimeout(() => {
143
- console.error(`${tag} timed out after ${timeoutMs / 1000}s, killing`);
144
- child.kill("SIGKILL");
145
- finish(null);
146
- }, timeoutMs);
142
+ // IDLE timeout (see the identical fix in the hermes runOnce() above): reset
143
+ // on every byte of output so a genuinely agentic, tool-using turn can run as
144
+ // long as it keeps producing output, and only true silence kills it.
145
+ let timer;
146
+ const armIdleTimer = () => {
147
+ clearTimeout(timer);
148
+ timer = setTimeout(() => {
149
+ console.error(`${tag} idle ${timeoutMs / 1000}s (no output), killing`);
150
+ child.kill("SIGKILL");
151
+ finish(null);
152
+ }, timeoutMs);
153
+ };
154
+ armIdleTimer();
147
155
  child.stdout.on("data", (d) => {
156
+ armIdleTimer();
148
157
  lineBuf += d.toString();
149
158
  const lines = lineBuf.split("\n");
150
159
  lineBuf = lines.pop() ?? "";
151
160
  for (const line of lines)
152
161
  handleLine(line);
153
162
  });
154
- child.stderr.on("data", (d) => (stderr += d.toString()));
163
+ child.stderr.on("data", (d) => {
164
+ armIdleTimer();
165
+ stderr += d.toString();
166
+ });
155
167
  child.on("error", (err) => {
156
168
  clearTimeout(timer);
157
169
  console.error(`${tag} spawn error: ${err.message}`);
@@ -384,20 +396,35 @@ export function hermesBrain(cfg) {
384
396
  noSession = true;
385
397
  resolvePromise({ reply: out.trim(), noSession, sessionId, stderr, timedOut });
386
398
  };
387
- const timer = setTimeout(() => {
388
- console.error(`${tag} timed out after ${cfg.brainTimeoutMs / 1000}s, killing`);
389
- timedOut = true;
390
- child.kill("SIGKILL");
391
- finish();
392
- }, cfg.brainTimeoutMs);
399
+ // IDLE timeout, not a flat wall-clock one: reset on every byte of output
400
+ // (stdout OR stderr either is a sign the process is alive and working,
401
+ // not hung). A genuinely agentic turn (tool use, indexing a fresh repo on
402
+ // a brand-new profile) can legitimately run for minutes while still
403
+ // producing periodic status output — a flat timer kills that productive
404
+ // work indiscriminately. Only true SILENCE this long means hung.
405
+ let timer;
406
+ const armIdleTimer = () => {
407
+ clearTimeout(timer);
408
+ timer = setTimeout(() => {
409
+ console.error(`${tag} idle ${cfg.brainTimeoutMs / 1000}s (no output), killing`);
410
+ timedOut = true;
411
+ child.kill("SIGKILL");
412
+ finish();
413
+ }, cfg.brainTimeoutMs);
414
+ };
415
+ armIdleTimer();
393
416
  child.stdout.on("data", (d) => {
417
+ armIdleTimer();
394
418
  lineBuf += d.toString();
395
419
  const lines = lineBuf.split("\n");
396
420
  lineBuf = lines.pop() ?? "";
397
421
  for (const line of lines)
398
422
  handleLine(line);
399
423
  });
400
- child.stderr.on("data", (d) => (stderr += d.toString()));
424
+ child.stderr.on("data", (d) => {
425
+ armIdleTimer();
426
+ stderr += d.toString();
427
+ });
401
428
  child.on("error", (err) => {
402
429
  clearTimeout(timer);
403
430
  console.error(`${tag} spawn error: ${err.message}`);
@@ -456,7 +483,7 @@ export function hermesBrain(cfg) {
456
483
  // start), which misdirects the user to run a command that isn't the fix.
457
484
  if (run.timedOut) {
458
485
  const secs = Math.round(cfg.brainTimeoutMs / 1000);
459
- return `⚠️ My brain took longer than ${secs}s to respond and I had to give up this can happen on the very first message while a session/provider is warming up. Try messaging me again.`;
486
+ return `⚠️ My brain went quiet for over ${secs}s with no output and I had to give up on that turn a long tool-use step or a very slow provider response can trigger this. Try messaging me again.`;
460
487
  }
461
488
  return "⚠️ My brain isn't reachable right now — Hermes has no authenticated provider on the host. Run 'hermes model' there, then message me again.";
462
489
  }
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.6";
2
+ export declare const VERSION = "0.7.7";
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.6";
20
+ export const VERSION = "0.7.7";
21
21
  /** How often to re-probe + report brain availability to the server. */
22
22
  const CAPABILITIES_INTERVAL_MS = 5 * 60_000;
23
23
  // ---- Reconnect watchdog -----------------------------------------------------
package/dist/config.d.ts CHANGED
@@ -82,9 +82,9 @@ export interface BridgeConfig {
82
82
  export declare const DEFAULT_API_URL = "https://d3qweh72vesa98.cloudfront.net";
83
83
  export declare const DEFAULT_APP_URL = "https://d32w3to73s0pu5.cloudfront.net/messenger/";
84
84
  export declare const DEFAULT_PORT = 8790;
85
- export declare const DEFAULT_BRAIN_TIMEOUT_MS = 180000;
85
+ export declare const DEFAULT_BRAIN_TIMEOUT_MS = 300000;
86
86
  export declare function defaultHomeDir(): string;
87
- export declare const HELP = "nopeek-agent-bridge \u2014 run your agents as E2EE NoPeek bots\n\nUsage:\n nopeek-agent-bridge install Install as a background service (launchd/systemd),\n then finish setup from the NoPeek app:\n Bots -> Connect this computer.\n nopeek-agent-bridge uninstall Remove the background service (keeps data/settings).\n nopeek-agent-bridge status Show the running bridge's status.\n nopeek-agent-bridge [run] Run in the foreground. Unpaired bridges wait to be\n paired from the NoPeek app; --pair still works:\n npx @nopeek/agent-bridge --pair npr_\u2026 --app-id app_\u2026\n\nOptions:\n --pair <code> Pairing code from the NoPeek app (env NOPEEK_PAIRING_CODE)\n --app-id <id> NoPeek app id (env NOPEEK_APP_ID)\n --api-url <url> API base, default https://d3qweh72vesa98.cloudfront.net (env NOPEEK_API_URL)\n --brain-cmd <cmd> Shell brain: message on stdin -> reply on stdout (env BRAIN_CMD)\n --brain-url <url> Webhook brain: POST {text,...} -> {text|reply} (env BRAIN_URL)\n --brain-map <json> Per-bot overrides {\"<handle>\":{\"cmd\":\"\u2026\"}|{\"url\":\"\u2026\"}|\n {\"backend\":\"claude\"|\"hermes\"|\"echo\"}} (env BRAIN_MAP)\n --brain-provision-cmd <cmd> Run once per new bot; stdout becomes its brain command\n (env BRAIN_PROVISION_CMD \u2014 e.g. a script that creates a\n fresh Hermes profile with its own soul + memory)\n --app-url <url> App opened after install (env NOPEEK_APP_URL)\n --no-open install: don't open the app in the browser\n --brain-timeout-ms <ms> Brain timeout, default 180000 (env BRAIN_TIMEOUT_MS)\n --port <port> Local control API port, default 8790 (env NOPEEK_BRIDGE_PORT)\n --data-dir <dir> Device-key store dir (env NOPEEK_BRIDGE_DATA_DIR)\n --home <dir> Bridge home, default ~/.nopeek-bridge (env NOPEEK_BRIDGE_HOME)\n --config <path> Config file, default ./nopeek-bridge.config.json\n -h, --help Show this help\n\nWith no brain configured, bots run in echo mode (\"You said: \u2026\") \u2014 a zero-config smoke test.\nPairing and brains can be managed entirely from the NoPeek app once the service is running.";
87
+ export declare const HELP = "nopeek-agent-bridge \u2014 run your agents as E2EE NoPeek bots\n\nUsage:\n nopeek-agent-bridge install Install as a background service (launchd/systemd),\n then finish setup from the NoPeek app:\n Bots -> Connect this computer.\n nopeek-agent-bridge uninstall Remove the background service (keeps data/settings).\n nopeek-agent-bridge status Show the running bridge's status.\n nopeek-agent-bridge [run] Run in the foreground. Unpaired bridges wait to be\n paired from the NoPeek app; --pair still works:\n npx @nopeek/agent-bridge --pair npr_\u2026 --app-id app_\u2026\n\nOptions:\n --pair <code> Pairing code from the NoPeek app (env NOPEEK_PAIRING_CODE)\n --app-id <id> NoPeek app id (env NOPEEK_APP_ID)\n --api-url <url> API base, default https://d3qweh72vesa98.cloudfront.net (env NOPEEK_API_URL)\n --brain-cmd <cmd> Shell brain: message on stdin -> reply on stdout (env BRAIN_CMD)\n --brain-url <url> Webhook brain: POST {text,...} -> {text|reply} (env BRAIN_URL)\n --brain-map <json> Per-bot overrides {\"<handle>\":{\"cmd\":\"\u2026\"}|{\"url\":\"\u2026\"}|\n {\"backend\":\"claude\"|\"hermes\"|\"echo\"}} (env BRAIN_MAP)\n --brain-provision-cmd <cmd> Run once per new bot; stdout becomes its brain command\n (env BRAIN_PROVISION_CMD \u2014 e.g. a script that creates a\n fresh Hermes profile with its own soul + memory)\n --app-url <url> App opened after install (env NOPEEK_APP_URL)\n --no-open install: don't open the app in the browser\n --brain-timeout-ms <ms> Brain timeout, default 300000 (env BRAIN_TIMEOUT_MS)\n --port <port> Local control API port, default 8790 (env NOPEEK_BRIDGE_PORT)\n --data-dir <dir> Device-key store dir (env NOPEEK_BRIDGE_DATA_DIR)\n --home <dir> Bridge home, default ~/.nopeek-bridge (env NOPEEK_BRIDGE_HOME)\n --config <path> Config file, default ./nopeek-bridge.config.json\n -h, --help Show this help\n\nWith no brain configured, bots run in echo mode (\"You said: \u2026\") \u2014 a zero-config smoke test.\nPairing and brains can be managed entirely from the NoPeek app once the service is running.";
88
88
  /** Load config from argv + env + cwd config file + home settings. Never
89
89
  * requires pairing — an unpaired bridge waits for the app to pair it. */
90
90
  export declare function loadConfig(argv?: string[]): BridgeConfig;
package/dist/config.js CHANGED
@@ -15,7 +15,12 @@ export function isBrainBackend(v) {
15
15
  export const DEFAULT_API_URL = "https://d3qweh72vesa98.cloudfront.net";
16
16
  export const DEFAULT_APP_URL = "https://d32w3to73s0pu5.cloudfront.net/messenger/";
17
17
  export const DEFAULT_PORT = 8790;
18
- export const DEFAULT_BRAIN_TIMEOUT_MS = 180_000;
18
+ // Idle timeout (resets on any child-process output, not a flat wall-clock cap
19
+ // — see backends.ts). 300s of true SILENCE covers a long tool-use step (repo
20
+ // indexing, slow provider call) on a genuinely agentic brain without needing
21
+ // per-deployment tuning, while still killing a truly hung process reasonably
22
+ // fast.
23
+ export const DEFAULT_BRAIN_TIMEOUT_MS = 300_000;
19
24
  export function defaultHomeDir() {
20
25
  return process.env.NOPEEK_BRIDGE_HOME || join(homedir(), ".nopeek-bridge");
21
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nopeek/agent-bridge",
3
- "version": "0.7.6",
3
+ "version": "0.7.7",
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",