1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// Quick test script to verify dynamic tool loading
const fs = require('fs');
const path = require('path');
console.log('=== Testing Dynamic Tool Loading ===');
// Check if the dynamic tools directory exists
const dynamicToolsPath = path.join(__dirname, 'src/client/views/nodes/chatbot/tools/dynamic');
console.log('Dynamic tools directory:', dynamicToolsPath);
console.log('Directory exists:', fs.existsSync(dynamicToolsPath));
if (fs.existsSync(dynamicToolsPath)) {
const files = fs.readdirSync(dynamicToolsPath);
const toolFiles = files.filter(file => file.endsWith('.ts') && !file.startsWith('.'));
console.log('Found tool files:', toolFiles);
for (const toolFile of toolFiles) {
const toolPath = path.join(dynamicToolsPath, toolFile);
const toolName = path.basename(toolFile, '.ts');
console.log(`\nTesting ${toolFile}:`);
console.log(' - Tool name:', toolName);
console.log(' - File size:', fs.statSync(toolPath).size, 'bytes');
// Try to read and check the file content
try {
const content = fs.readFileSync(toolPath, 'utf8');
// Check for required patterns
const hasExport = content.includes(`export class ${toolName}`);
const toolInfoMatch = content.match(/const\s+\w+Info.*?=\s*{[^}]*name\s*:\s*['"]([^'"]+)['"]/s);
const hasExtends = content.includes('extends BaseTool');
console.log(' - Has export class:', hasExport);
console.log(' - Extends BaseTool:', hasExtends);
console.log(' - Tool info name:', toolInfoMatch ? toolInfoMatch[1] : 'NOT FOUND');
} catch (error) {
console.log(' - Error reading file:', error.message);
}
}
}
console.log('\n=== Test Complete ===');
|