diff options
author | A.J. Shulman <Shulman.aj@gmail.com> | 2025-05-21 13:11:52 -0400 |
---|---|---|
committer | A.J. Shulman <Shulman.aj@gmail.com> | 2025-05-21 13:11:52 -0400 |
commit | c3dba47bcda10bbcd72010c177afa8fd301e87e1 (patch) | |
tree | e8fe23915a09d4a9a95afbf971bce8e852fc5619 /src/client/views/nodes/chatbot/tools/FileNamesTool.ts | |
parent | 0e98320d3b237f1927b9f1367494dccd7f66eda9 (diff) |
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
Diffstat (limited to 'src/client/views/nodes/chatbot/tools/FileNamesTool.ts')
-rw-r--r-- | src/client/views/nodes/chatbot/tools/FileNamesTool.ts | 34 |
1 files changed, 34 insertions, 0 deletions
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<FileNamesToolParamsType> = { + 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<FileNamesToolParamsType> { + constructor(private vectorstore: Vectorstore) { + super(fileNamesToolInfo); + } + + async execute(args: ParametersType<FileNamesToolParamsType>): Promise<Observation[]> { + console.log(`Executing file names retrieval`); + + const filepaths = await this.vectorstore.getFileNames(); + + return [ + { + type: 'text', + text: `The file names in the codebase are: ${filepaths}`, + }, + ]; + } +} |