From 656dbe6dc64013215eb312173df398fe4606d788 Mon Sep 17 00:00:00 2001 From: "A.J. Shulman" Date: Tue, 27 May 2025 14:08:11 -0400 Subject: 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 --- .../chatbot/tools/dynamic/CharacterCountTool.ts | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/client/views/nodes/chatbot/tools/dynamic/CharacterCountTool.ts (limited to 'src/client/views/nodes/chatbot/tools/dynamic') diff --git a/src/client/views/nodes/chatbot/tools/dynamic/CharacterCountTool.ts b/src/client/views/nodes/chatbot/tools/dynamic/CharacterCountTool.ts new file mode 100644 index 000000000..38fed231c --- /dev/null +++ b/src/client/views/nodes/chatbot/tools/dynamic/CharacterCountTool.ts @@ -0,0 +1,33 @@ +import { Observation } from '../../types/types'; +import { ParametersType, ToolInfo } from '../../types/tool_types'; +import { BaseTool } from '../BaseTool'; + +const characterCountParams = [ + { + name: 'text', + type: 'string', + description: 'The text to count characters in', + required: true + } + ] as const; + + type CharacterCountParamsType = typeof characterCountParams; + + const characterCountInfo: ToolInfo = { + name: 'charactercount', + description: 'Counts characters in text, excluding spaces', + citationRules: 'No citation needed.', + parameterRules: characterCountParams + }; + + export class CharacterCountTool extends BaseTool { + constructor() { + super(characterCountInfo); + } + + async execute(args: ParametersType): Promise { + const { text } = args; + const count = text ? text.replace(/\s/g, '').length : 0; + return [{ type: 'text', text: `Character count (excluding spaces): ${count}` }]; + } + } \ No newline at end of file -- cgit v1.2.3-70-g09d2