open-agents-ai 0.103.47 → 0.103.48

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 +24 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -28691,7 +28691,7 @@ ${this.formatConnectionInfo()}`);
28691
28691
  * 2. Re-sends the expose command to clear old capabilities and register fresh ones
28692
28692
  * This guarantees the correct models are exposed (Chutes vs Ollama) even after OA restart.
28693
28693
  */
28694
- static async checkAndReconnect(stateDir, nexusTool, options) {
28694
+ static async checkAndReconnect(stateDir, nexusTool, options, currentConfig) {
28695
28695
  const state = readP2PExposeState(stateDir);
28696
28696
  if (!state)
28697
28697
  return null;
@@ -28711,15 +28711,30 @@ ${this.formatConnectionInfo()}`);
28711
28711
  removeP2PExposeState(stateDir);
28712
28712
  return null;
28713
28713
  }
28714
+ let effectiveState = { ...state };
28715
+ if (currentConfig) {
28716
+ const currentUrl = currentConfig.backendUrl;
28717
+ const isCurrentLocal = currentUrl.includes("127.0.0.1") || currentUrl.includes("localhost");
28718
+ const isCurrentPeer = currentUrl.startsWith("peer://");
28719
+ if (state.passthrough) {
28720
+ const normalizedUrl = currentUrl.replace(/\/+$/, "").replace(/\/chat\/completions$/, "").replace(/\/completions$/, "").replace(/\/models(\/.*)?$/, "").replace(/\/v1$/, "").replace(/\/+$/, "");
28721
+ effectiveState.targetUrl = normalizedUrl;
28722
+ effectiveState.endpointAuth = currentConfig.apiKey;
28723
+ } else if (!isCurrentLocal && !isCurrentPeer && state.kind === "ollama") {
28724
+ removeP2PExposeState(stateDir);
28725
+ options.onInfo?.("P2P expose skipped: endpoint changed (use /expose forward for remote backends)");
28726
+ return null;
28727
+ }
28728
+ }
28714
28729
  const gateway = new _ExposeP2PGateway({
28715
- kind: state.kind,
28716
- targetUrl: state.targetUrl,
28717
- authKey: state.authKey,
28730
+ kind: effectiveState.kind,
28731
+ targetUrl: effectiveState.targetUrl,
28732
+ authKey: effectiveState.authKey,
28718
28733
  stateDir,
28719
- margin: state.margin,
28720
- passthrough: state.passthrough,
28721
- loadbalance: state.loadbalance,
28722
- endpointAuth: state.endpointAuth,
28734
+ margin: effectiveState.margin,
28735
+ passthrough: effectiveState.passthrough,
28736
+ loadbalance: effectiveState.loadbalance,
28737
+ endpointAuth: effectiveState.endpointAuth,
28723
28738
  ...options
28724
28739
  }, nexusTool);
28725
28740
  try {
@@ -46424,7 +46439,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
46424
46439
  const reconnectedP2P = await ExposeP2PGateway.checkAndReconnect(oaDir, new NexusTool(repoRoot), {
46425
46440
  onInfo: (msg) => writeContent(() => renderInfo(msg)),
46426
46441
  onError: (msg) => writeContent(() => renderWarning(msg))
46427
- });
46442
+ }, { backendUrl: currentConfig.backendUrl, apiKey: currentConfig.apiKey });
46428
46443
  if (reconnectedP2P) {
46429
46444
  p2pGateway = reconnectedP2P;
46430
46445
  reconnectedP2P.on("stats", (stats) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.103.47",
3
+ "version": "0.103.48",
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",