Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,8 @@ bin("droid-patch", "CLI tool to patch droid binary with various modifications")

// If websearch is enabled, regenerate wrapper files
// Support both new 'websearch' field and old 'proxy' field for backward compatibility
const hasWebsearch = meta.patches.websearch || !!meta.patches.proxy;
const hasWebsearch =
meta.patches.websearch || !!meta.patches.websearchProxy || !!meta.patches.proxy;
if (hasWebsearch) {
// Determine forward target: apiBase > proxy (legacy) > default
const forwardTarget =
Expand All @@ -1319,6 +1320,7 @@ bin("droid-patch", "CLI tool to patch droid binary with various modifications")
meta.name,
forwardTarget,
meta.patches.standalone || false,
meta.patches.websearchProxy || false,
);
execTargetPath = wrapperScript;
if (verbose) {
Expand Down
7 changes: 6 additions & 1 deletion src/websearch-external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ const fs = require('fs');
const DEBUG = process.env.DROID_SEARCH_DEBUG === '1';
const PORT = parseInt(process.env.SEARCH_PROXY_PORT || '0');
const FACTORY_API = 'https://api.factory.ai';
const SEARCH_ROUTE_ALIASES = new Set(['/api/tools/web-search', '/api/tools/exa/search']);

function log() { if (DEBUG) console.error.apply(console, ['[websearch]'].concat(Array.from(arguments))); }

function isSearchRequest(url, method) {
return method === 'POST' && SEARCH_ROUTE_ALIASES.has(url.pathname);
}

// === External Search Providers ===

async function searchSmitheryExa(query, numResults) {
Expand Down Expand Up @@ -192,7 +197,7 @@ const server = http.createServer(async (req, res) => {
return;
}

if (url.pathname === '/api/tools/exa/search' && req.method === 'POST') {
if (isSearchRequest(url, req.method)) {
let body = '';
req.on('data', function(c) { body += c; });
req.on('end', async function() {
Expand Down
Loading