From c3dba47bcda10bbcd72010c177afa8fd301e87e1 Mon Sep 17 00:00:00 2001 From: "A.J. Shulman" Date: Wed, 21 May 2025 13:11:52 -0400 Subject: feat: add codebase exploration tools for agent assistance Add three new agent tools to improve navigation and understanding of the codebase: FileContentTool: retrieves complete content of specified files (max 3) FileNamesTool: lists all available files in the codebase CodebaseSummarySearchTool: performs semantic search across file summaries --- .../views/nodes/chatbot/tools/FileNamesTool.ts | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/client/views/nodes/chatbot/tools/FileNamesTool.ts (limited to 'src/client/views/nodes/chatbot/tools/FileNamesTool.ts') diff --git a/src/client/views/nodes/chatbot/tools/FileNamesTool.ts b/src/client/views/nodes/chatbot/tools/FileNamesTool.ts new file mode 100644 index 000000000..b69874afa --- /dev/null +++ b/src/client/views/nodes/chatbot/tools/FileNamesTool.ts @@ -0,0 +1,34 @@ +import { Observation } from '../types/types'; +import { ParametersType, ToolInfo } from '../types/tool_types'; +import { Vectorstore } from '../vectorstore/Vectorstore'; +import { BaseTool } from './BaseTool'; + +const fileNamesToolParams = [] as const; + +type FileNamesToolParamsType = typeof fileNamesToolParams; + +const fileNamesToolInfo: ToolInfo = { + name: 'fileNames', + description: 'Retrieves the names of all files in the Dash codebase to help understand the codebase structure.', + citationRules: `No citation needed.`, + parameterRules: fileNamesToolParams, +}; + +export class FileNamesTool extends BaseTool { + constructor(private vectorstore: Vectorstore) { + super(fileNamesToolInfo); + } + + async execute(args: ParametersType): Promise { + console.log(`Executing file names retrieval`); + + const filepaths = await this.vectorstore.getFileNames(); + + return [ + { + type: 'text', + text: `The file names in the codebase are: ${filepaths}`, + }, + ]; + } +} -- cgit v1.2.3-70-g09d2