Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(integrations): correct mock API response for empty integration list

Steven Enamakelb9d1b997810c
diff --git a/scripts/mock-api/routes/integrations.mjs b/scripts/mock-api/routes/integrations.mjs
index fae62f67f6..1d1c544e4c 100644
--- a/scripts/mock-api/routes/integrations.mjs
+++ b/scripts/mock-api/routes/integrations.mjs
@@ -622,6 +622,172 @@ export function handleIntegrations(ctx) {
return true;
}
+ // ── Exa (managed) ──────────────────────────────────────────
+ // Mirrors backend `/agent-integrations/exa/*`: search takes
+ // `{objective, searchQueries}`; contents/answer/findSimilar proxy Exa's
+ // own REST bodies. `mockBehavior.exaInsufficientBalance = "1"` answers 402.
+ if (method === "POST" && /^\/agent-integrations\/exa\//.test(url)) {
+ if (mockBehavior.exaInsufficientBalance === "1") {
+ json(res, 402, { success: false, error: "Insufficient balance" });
+ return true;
+ }
+ if (/^\/agent-integrations\/exa\/search\/?$/.test(url)) {
+ const objective =
+ typeof parsedBody?.objective === "string"
+ ? parsedBody.objective.trim()
+ : "";
+ const queries = Array.isArray(parsedBody?.searchQueries)
+ ? parsedBody.searchQueries
+ .map((query) => String(query ?? "").trim())
+ .filter(Boolean)
+ : [];
+ if (!objective || queries.length === 0 || "mode" in (parsedBody ?? {})) {
+ json(res, 400, { success: false, error: "Invalid Exa search request" });
+ return true;
+ }
+ json(res, 200, {
+ success: true,
+ data: {
+ searchId: `exa-search-${queries.length}`,
+ results: queries.map((query, index) => ({
+ url: `https://exa.example.com/${index}`,
+ title: `Exa result for ${query}`,
+ publish_date: "2026-09-01",
+ excerpts: [`Objective: ${objective}; query: ${query}`],
+ })),
+ costUsd: 0.01,
+ },
+ });
+ return true;
+ }
+ if (/^\/agent-integrations\/exa\/contents\/?$/.test(url)) {
+ const urls = Array.isArray(parsedBody?.urls)
+ ? parsedBody.urls
+ : Array.isArray(parsedBody?.ids)
+ ? parsedBody.ids
+ : [];
+ json(res, 200, {
+ success: true,
+ data: {
+ requestId: "exa-contents",
+ results: urls.map((pageUrl) => ({
+ id: String(pageUrl),
+ url: String(pageUrl),
+ title: `Contents of ${pageUrl}`,
+ text: `Mock page text for ${pageUrl}`,
+ })),
+ costDollars: { total: 0.001 },
+ },
+ });
+ return true;
+ }
+ if (/^\/agent-integrations\/exa\/answer\/?$/.test(url)) {
+ const query = String(parsedBody?.query ?? "").trim();
+ json(res, 200, {
+ success: true,
+ data: {
+ requestId: "exa-answer",
+ answer: `Mock Exa answer for ${query}`,
+ citations: [
+ { id: "c0", url: "https://exa.example.com/answer", title: "Exa source" },
+ ],
+ costDollars: { total: 0.005 },
+ },
+ });
+ return true;
+ }
+ if (/^\/agent-integrations\/exa\/findSimilar\/?$/.test(url)) {
+ json(res, 200, {
+ success: true,
+ data: {
+ requestId: "exa-similar",
+ results: [
+ { id: "s0", url: "https://exa.example.com/similar", title: "Similar page" },
+ ],
+ costDollars: { total: 0.005 },
+ },
+ });
+ return true;
+ }
+ }
+
+ // ── Gemini grounded generate-content (managed) ─────────────
+ {
+ const match = url.match(
+ /^\/agent-integrations\/gemini\/models\/([^/?]+)\/generate-content\/?$/,
+ );
+ if (method === "POST" && match) {
+ const model = decodeURIComponent(match[1]);
+ const prompt = String(
+ parsedBody?.contents?.[0]?.parts?.[0]?.text ?? "",
+ ).trim();
+ json(res, 200, {
+ success: true,
+ data: {
+ modelVersion: model,
+ responseId: "gemini-mock",
+ candidates: [
+ {
+ content: {
+ role: "model",
+ parts: [{ text: `Mock grounded answer for ${prompt}` }],
+ },
+ groundingMetadata: {
+ webSearchQueries: [prompt],
+ groundingChunks: [
+ {
+ web: {
+ uri: "https://gemini.example.com/source",
+ title: "Grounding source",
+ },
+ },
+ ],
+ groundingSupports: [
+ {
+ segment: { startIndex: 0, endIndex: 10 },
+ groundingChunkIndices: [0],
+ },
+ ],
+ },
+ },
+ ],
+ usageMetadata: { promptTokenCount: 10, candidatesTokenCount: 20 },
+ costUsd: 0.002,
+ },
+ });
+ return true;
+ }
+ }
+
+ // ── TinyFish (managed) ─────────────────────────────────────
+ if (
+ method === "POST" &&
+ /^\/agent-integrations\/tinyfish\/(search|fetch)\/?$/.test(url)
+ ) {
+ const isFetch = /\/fetch\/?$/.test(url);
+ json(res, 200, {
+ success: true,
+ data: isFetch
+ ? {
+ results: (parsedBody?.urls ?? []).map((pageUrl) => ({
+ url: String(pageUrl),
+ title: `Fetched ${pageUrl}`,
+ text: `Mock fetched text for ${pageUrl}`,
+ })),
+ }
+ : {
+ results: [
+ {
+ url: "https://tinyfish.example.com/0",
+ title: `TinyFish result for ${String(parsedBody?.query ?? "")}`,
+ snippet: "Mock TinyFish snippet",
+ },
+ ],
+ },
+ });
+ return true;
+ }
+
// ── Composio user-scopes ───────────────────────────────────
if (
method === "GET" &&