aboutsummaryrefslogtreecommitdiff
path: root/test_dynamic_tools.js
diff options
context:
space:
mode:
authorA.J. Shulman <Shulman.aj@gmail.com>2025-05-27 14:08:11 -0400
committerA.J. Shulman <Shulman.aj@gmail.com>2025-05-27 14:08:11 -0400
commit656dbe6dc64013215eb312173df398fe4606d788 (patch)
tree05c2d35e5f636091c637779d1c8352c25e9ce7f6 /test_dynamic_tools.js
parentc3dba47bcda10bbcd72010c177afa8fd301e87e1 (diff)
feat: implement dynamic tool creation with deferred webpack rebuild and AI integration
Added runtime tool registry to Agent.ts for dynamic tool lookup Implemented CreateNewTool agent tool for AI-driven code analysis and tool generation Enabled deferred saving to avoid interrupting AI workflows with immediate rebuilds Introduced user-controlled modal for confirming tool installation and page reload Added REST API and secure server-side persistence for dynamic tools Built TypeScript validation, transpilation, and sandboxed execution for safe tool handling UI enhancements: modal with blur, responsive design, clear messaging Ensured compatibility with Webpack using dynamic require() calls Full error handling, code validation, and secure storage on client and server sides
Diffstat (limited to 'test_dynamic_tools.js')
-rw-r--r--test_dynamic_tools.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/test_dynamic_tools.js b/test_dynamic_tools.js
new file mode 100644
index 000000000..b0d6844f3
--- /dev/null
+++ b/test_dynamic_tools.js
@@ -0,0 +1,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 ===');