Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Derive ResearchPaperOperation type from the config operation list

Clauded8453ff4a6d1
diff --git a/apps/api/src/config.ts b/apps/api/src/config.ts
index bf004c06d..48494d865 100644
--- a/apps/api/src/config.ts
+++ b/apps/api/src/config.ts
@@ -23,6 +23,8 @@ const RESEARCH_PAPER_OPERATIONS = [
"similar",
] as const;
+export type ResearchPaperOperation = (typeof RESEARCH_PAPER_OPERATIONS)[number];
+
const researchKeylessDisabled = z.preprocess(
value => {
if (typeof value !== "string") return value;
diff --git a/apps/api/src/lib/research-keyless.ts b/apps/api/src/lib/research-keyless.ts
index df28bcdb4..45ca7f6ea 100644
--- a/apps/api/src/lib/research-keyless.ts
+++ b/apps/api/src/lib/research-keyless.ts
@@ -1,7 +1,5 @@
import type { Request } from "express";
-import { config } from "../config";
-
-type ResearchPaperOperation = "search" | "inspect" | "read" | "similar";
+import { config, type ResearchPaperOperation } from "../config";
function researchPaperOperation(req: Request): ResearchPaperOperation | null {
const segments = req.path.toLowerCase().split("/").filter(Boolean);