peers.js
"use strict";
/**
* Peer plugin detection for research-plugin.
*
* If altra/web-search is installed, search_sources and read_source are omitted
* from this plugin's tool registration — the web-search-plugin handles those.
* The session is held at module scope to keep it alive for the plugin lifetime.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.detectWebPeer = detectWebPeer;
exports.webPeerStatus = webPeerStatus;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let _webPeerSession = null;
let _peerStatus = null;
async function detectWebPeer(ctl) {
try {
_webPeerSession = await ctl.client.plugins.pluginTools("altra/web-search");
_peerStatus = Array.isArray(_webPeerSession?.tools) && _webPeerSession.tools.length > 0;
return _peerStatus;
}
catch {
_peerStatus = false;
return false;
}
}
/** Returns null if detection hasn't run yet, true/false after toolsProvider init. */
function webPeerStatus() {
return _peerStatus;
}