open-agents-ai 0.103.45 → 0.103.47

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.js +18 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -13645,16 +13645,15 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
13645
13645
  const existingPid = this.getDaemonPid();
13646
13646
  if (existingPid) {
13647
13647
  const daemonPath2 = join30(this.nexusDir, "nexus-daemon.mjs");
13648
- let needsRestart = false;
13648
+ let needsRestart = true;
13649
13649
  if (existsSync23(daemonPath2)) {
13650
13650
  try {
13651
13651
  const onDisk = readFileSync16(daemonPath2, "utf8");
13652
13652
  const diskHash = createHash("sha256").update(onDisk).digest("hex").slice(0, 16);
13653
- if (diskHash !== currentScriptHash) {
13654
- needsRestart = true;
13653
+ if (diskHash === currentScriptHash) {
13654
+ needsRestart = false;
13655
13655
  }
13656
13656
  } catch {
13657
- needsRestart = true;
13658
13657
  }
13659
13658
  }
13660
13659
  if (needsRestart) {
@@ -28670,6 +28669,7 @@ ${this.formatConnectionInfo()}`);
28670
28669
  margin: this._margin,
28671
28670
  passthrough: this._passthrough || void 0,
28672
28671
  loadbalance: this._loadbalance || void 0,
28672
+ endpointAuth: this._endpointAuth,
28673
28673
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
28674
28674
  });
28675
28675
  }
@@ -28686,9 +28686,10 @@ ${this.formatConnectionInfo()}`);
28686
28686
  }
28687
28687
  /**
28688
28688
  * Check for and reconnect to a surviving P2P expose from a previous session.
28689
- * Verifies the nexus daemon is still running and the peer ID is valid,
28690
- * then resumes metering poll without re-registering capabilities
28691
- * (the daemon keeps them registered across OA restarts).
28689
+ * The daemon survives OA restarts, but we MUST re-verify it on reconnect:
28690
+ * 1. doConnect() checks script hash kills + respawns if daemon code is stale
28691
+ * 2. Re-sends the expose command to clear old capabilities and register fresh ones
28692
+ * This guarantees the correct models are exposed (Chutes vs Ollama) even after OA restart.
28692
28693
  */
28693
28694
  static async checkAndReconnect(stateDir, nexusTool, options) {
28694
28695
  const state = readP2PExposeState(stateDir);
@@ -28706,10 +28707,6 @@ ${this.formatConnectionInfo()}`);
28706
28707
  removeP2PExposeState(stateDir);
28707
28708
  return null;
28708
28709
  }
28709
- if (status.peerId !== state.peerId) {
28710
- removeP2PExposeState(stateDir);
28711
- return null;
28712
- }
28713
28710
  } catch {
28714
28711
  removeP2PExposeState(stateDir);
28715
28712
  return null;
@@ -28722,15 +28719,18 @@ ${this.formatConnectionInfo()}`);
28722
28719
  margin: state.margin,
28723
28720
  passthrough: state.passthrough,
28724
28721
  loadbalance: state.loadbalance,
28722
+ endpointAuth: state.endpointAuth,
28725
28723
  ...options
28726
28724
  }, nexusTool);
28727
- gateway._peerId = state.peerId;
28728
- gateway._stats.status = "active";
28729
- gateway._stats.startedAt = new Date(state.startedAt).getTime();
28730
- gateway.emitStats();
28731
- gateway.startMeteringPoll(nexusDir);
28732
- options.onInfo?.(`P2P expose reconnected: ${state.peerId}`);
28733
- return gateway;
28725
+ try {
28726
+ await gateway.start();
28727
+ options.onInfo?.(`P2P expose reconnected: ${gateway._peerId ?? state.peerId}`);
28728
+ return gateway;
28729
+ } catch (err) {
28730
+ removeP2PExposeState(stateDir);
28731
+ options.onError?.(`P2P expose reconnect failed: ${err instanceof Error ? err.message : String(err)}`);
28732
+ return null;
28733
+ }
28734
28734
  }
28735
28735
  /** Poll the daemon's metering.jsonl and status.json for stats */
28736
28736
  startMeteringPoll(nexusDir) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.103.45",
3
+ "version": "0.103.47",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",