@openape/nest 2.1.0 → 2.1.1

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/dist/index.mjs +14 -4
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -105,9 +105,11 @@ var Pm2Supervisor = class {
105
105
  this.deps.log(`pm2-supervisor: delete ${name}: ${err instanceof Error ? err.message.split("\n")[0] : String(err)}`);
106
106
  }
107
107
  }
108
- /** Best-effort cleanup — called on Nest shutdown. We don't kill
108
+ /**
109
+ * Best-effort cleanup — called on Nest shutdown. We don't kill
109
110
  * the per-agent pm2-daemons; they should keep running so bridges
110
- * stay alive across Nest restarts. No-op for now. */
111
+ * stay alive across Nest restarts. No-op for now.
112
+ */
111
113
  async stopAll() {
112
114
  }
113
115
  async startOrReload(agentName) {
@@ -139,7 +141,8 @@ var Pm2Supervisor = class {
139
141
  this.deps.log(`pm2-supervisor: ${agentName} bridge NOT online \u2014 see /var/log/openape/${agentName}-pm2.log`);
140
142
  }
141
143
  }
142
- /** Run a pm2 subcommand AS the agent — escapes-helper does the
144
+ /**
145
+ * Run a pm2 subcommand AS the agent — escapes-helper does the
143
146
  * setuid switch, then exec's pm2 in the agent's uid.
144
147
  *
145
148
  * cwd: the agent process inherits cwd from the spawning Nest
@@ -661,9 +664,11 @@ var TroopWs = class {
661
664
  const { stdout } = await runWithCapture(this.opts.apesBin, args);
662
665
  const match = stdout.match(/Registered as\s+(\S+@\S+)/);
663
666
  const agentEmail = match?.[1];
667
+ this.opts.log(`troop-ws: spawn-result ${frame.name} ok agent=${agentEmail ?? "?"}`);
664
668
  this.send({ type: "spawn-result", intent_id: frame.intent_id, ok: true, agent_email: agentEmail });
665
669
  } catch (err) {
666
670
  const error = err instanceof Error ? err.message : String(err);
671
+ this.opts.log(`troop-ws: spawn-result ${frame.name} FAIL: ${error}`);
667
672
  this.send({ type: "spawn-result", intent_id: frame.intent_id, ok: false, error });
668
673
  }
669
674
  }
@@ -693,8 +698,13 @@ var TroopWs = class {
693
698
  };
694
699
  function runWithCapture(bin, args) {
695
700
  return new Promise((resolve, reject) => {
696
- execFile3(bin, args, { maxBuffer: 4 * 1024 * 1024 }, (err, stdout, stderr) => {
701
+ execFile3(bin, args, { maxBuffer: 4 * 1024 * 1024, timeout: 12e4 }, (err, stdout, stderr) => {
697
702
  if (err) {
703
+ const isTimeout = err.signal === "SIGTERM";
704
+ if (isTimeout) {
705
+ resolve({ stdout: stdout.toString(), stderr: stderr.toString() });
706
+ return;
707
+ }
698
708
  const msg = stderr.toString() || err.message;
699
709
  reject(new Error(msg.split("\n").filter(Boolean).slice(-3).join(" / ")));
700
710
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openape/nest",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "OpenApe Nest — local control-plane daemon that supervises agent processes on this computer. Talks to troop SP for ownership state, spawns/destroys agents via DDISA always-grants, supervises chat-bridge children (replacing per-agent launchd plists).",
5
5
  "type": "module",
6
6
  "license": "MIT",