Sfoglia il codice sorgente

temporarily restrict codesearch and websearch to opencode zen users. need to figure out how to opt out for enterprise users who do not want this

Dax Raad 4 mesi fa
parent
commit
9c237f0bfb
1 ha cambiato i file con 10 aggiunte e 5 eliminazioni
  1. 10 5
      packages/opencode/src/tool/registry.ts

+ 10 - 5
packages/opencode/src/tool/registry.ts

@@ -108,13 +108,18 @@ export namespace ToolRegistry {
     return all().then((x) => x.map((t) => t.id))
   }
 
-  export async function tools(_providerID: string, _modelID: string) {
+  export async function tools(providerID: string, _modelID: string) {
     const tools = await all()
     const result = await Promise.all(
-      tools.map(async (t) => ({
-        id: t.id,
-        ...(await t.init()),
-      })),
+      tools
+        .filter((t) => {
+          if (t.id === "codesearch" || t.id === "websearch") return providerID === "opencode"
+          return true
+        })
+        .map(async (t) => ({
+          id: t.id,
+          ...(await t.init()),
+        })),
     )
     return result
   }