-
- {part.state === 'output-available' && isExpanded && (
- <>
- {isServiceError(part.output) ? (
-
- Failed with the following error: {part.output.message}
-
- ) : (
- <>
- {part.output.length === 0 ? (
-
No repositories found
- ) : (
-
- {part.output.map((repoName, index) => (
-
-
- {repoName}
-
- ))}
-
- )}
- >
- )}
-
- >
- )}
-
- )
-}
diff --git a/packages/web/src/features/chat/constants.ts b/packages/web/src/features/chat/constants.ts
index c9da56949..c73da27b6 100644
--- a/packages/web/src/features/chat/constants.ts
+++ b/packages/web/src/features/chat/constants.ts
@@ -14,8 +14,7 @@ export const toolNames = {
readFiles: 'readFiles',
findSymbolReferences: 'findSymbolReferences',
findSymbolDefinitions: 'findSymbolDefinitions',
- searchRepos: 'searchRepos',
- listAllRepos: 'listAllRepos',
+ listRepos: 'listRepos',
} as const;
// These part types are visible in the UI.
@@ -26,6 +25,5 @@ export const uiVisiblePartTypes: SBChatMessagePart['type'][] = [
'tool-readFiles',
'tool-findSymbolDefinitions',
'tool-findSymbolReferences',
- 'tool-searchRepos',
- 'tool-listAllRepos',
+ 'tool-listRepos',
] as const;
\ No newline at end of file
diff --git a/packages/web/src/features/chat/tools.ts b/packages/web/src/features/chat/tools.ts
index c932e932e..dac75f96e 100644
--- a/packages/web/src/features/chat/tools.ts
+++ b/packages/web/src/features/chat/tools.ts
@@ -4,10 +4,12 @@ import { InferToolInput, InferToolOutput, InferUITool, tool, ToolUIPart } from "
import { isServiceError } from "@/lib/utils";
import { FileSourceResponse, getFileSource } from '@/features/git';
import { findSearchBasedSymbolDefinitions, findSearchBasedSymbolReferences } from "../codeNav/api";
-import { addLineNumbers, buildSearchQuery } from "./utils";
+import { addLineNumbers } from "./utils";
import { toolNames } from "./constants";
-import { getRepos } from "@/actions";
-import Fuse from "fuse.js";
+import { listReposQueryParamsSchema } from "@/lib/schemas";
+import { ListReposQueryParams } from "@/lib/types";
+import { listRepos } from "@/app/api/(server)/repos/listReposApi";
+import escapeStringRegexp from "escape-string-regexp";
// @NOTE: When adding a new tool, follow these steps:
// 1. Add the tool to the `toolNames` constant in `constants.ts`.
@@ -113,7 +115,6 @@ export const readFilesTool = tool({
path,
repo: repository,
ref: revision,
- // @todo(mt): handle multi-tenancy.
});
}));
@@ -137,58 +138,89 @@ export type ReadFilesToolInput = InferToolInput