UNPKG

hataraku

Version:

An autonomous coding agent for building AI-powered development tools. The name "Hataraku" (働く) means "to work" in Japanese.

166 lines 6.66 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ALL_TOOLS = exports.MediaTools = exports.CodeAnalysisTools = exports.SystemTools = exports.FileSystemTools = exports.NetworkTools = exports.searchReplaceV2Tool = exports.showImageTool = exports.playAudioTool = exports.listCodeDefinitionsTool = exports.executeCommandTool = exports.applyDiffTool = exports.insertContentTool = exports.searchAndReplaceTool = exports.searchFilesTool = exports.listFilesTool = exports.writeFileTool = exports.readFileTool = exports.fetchTool = void 0; exports.getToolDocs = getToolDocs; const zod_1 = require("zod"); const fetch_1 = require("./fetch"); Object.defineProperty(exports, "fetchTool", { enumerable: true, get: function () { return fetch_1.fetchTool; } }); const read_file_1 = require("./read-file"); Object.defineProperty(exports, "readFileTool", { enumerable: true, get: function () { return read_file_1.readFileTool; } }); const write_file_1 = require("./write-file"); Object.defineProperty(exports, "writeFileTool", { enumerable: true, get: function () { return write_file_1.writeFileTool; } }); const list_files_1 = require("./list-files"); Object.defineProperty(exports, "listFilesTool", { enumerable: true, get: function () { return list_files_1.listFilesTool; } }); const search_files_1 = require("./search-files"); Object.defineProperty(exports, "searchFilesTool", { enumerable: true, get: function () { return search_files_1.searchFilesTool; } }); const search_and_replace_1 = require("./search-and-replace"); Object.defineProperty(exports, "searchAndReplaceTool", { enumerable: true, get: function () { return search_and_replace_1.searchAndReplaceTool; } }); const insert_content_1 = require("./insert-content"); Object.defineProperty(exports, "insertContentTool", { enumerable: true, get: function () { return insert_content_1.insertContentTool; } }); const apply_diff_1 = require("./apply-diff"); Object.defineProperty(exports, "applyDiffTool", { enumerable: true, get: function () { return apply_diff_1.applyDiffTool; } }); const execute_command_1 = require("./execute-command"); const list_code_definitions_1 = require("./list-code-definitions"); Object.defineProperty(exports, "listCodeDefinitionsTool", { enumerable: true, get: function () { return list_code_definitions_1.listCodeDefinitionsTool; } }); const play_audio_1 = require("./play-audio"); Object.defineProperty(exports, "playAudioTool", { enumerable: true, get: function () { return play_audio_1.playAudioTool; } }); const show_image_1 = require("./show-image"); Object.defineProperty(exports, "showImageTool", { enumerable: true, get: function () { return show_image_1.showImageTool; } }); const search_and_replace_v2_1 = require("./search-and-replace-v2"); Object.defineProperty(exports, "searchReplaceV2Tool", { enumerable: true, get: function () { return search_and_replace_v2_1.searchReplaceV2Tool; } }); // Create the execute command tool with grey output const executeCommandTool = (0, execute_command_1.createExecuteCommandTool)({ outputColor: 'grey' }); exports.executeCommandTool = executeCommandTool; // Tool Sets /** * Collection of network-related tools * * @example * ```typescript * import { NetworkTools } from './core/tools'; * * // Access the fetch tool * const fetchTool = NetworkTools.fetch; * ``` */ exports.NetworkTools = { fetch: fetch_1.fetchTool }; /** * Collection of file system manipulation tools * * @example * ```typescript * import { FileSystemTools } from './core/tools'; * * // Access the read_file tool * const readFileTool = FileSystemTools.read_file; * ``` */ exports.FileSystemTools = { read_file: read_file_1.readFileTool, write_file: write_file_1.writeFileTool, list_files: list_files_1.listFilesTool, search_files: search_files_1.searchFilesTool, search_and_replace: search_and_replace_1.searchAndReplaceTool, insert_content: insert_content_1.insertContentTool, apply_diff: apply_diff_1.applyDiffTool }; /** * Collection of system operation tools * * @example * ```typescript * import { SystemTools } from './core/tools'; * * // Access the execute_command tool * const execTool = SystemTools.execute_command; * ``` */ exports.SystemTools = { execute_command: executeCommandTool }; /** * Collection of code analysis tools * * @example * ```typescript * import { CodeAnalysisTools } from './core/tools'; * * // Access the list_code_definitions tool * const definitionsTool = CodeAnalysisTools.list_code_definitions; * ``` */ exports.CodeAnalysisTools = { list_code_definitions: list_code_definitions_1.listCodeDefinitionsTool }; /** * Collection of media handling tools * * @example * ```typescript * import { MediaTools } from './core/tools'; * * // Access the play_audio tool * const audioTool = MediaTools.play_audio; * ``` */ exports.MediaTools = { play_audio: play_audio_1.playAudioTool, show_image: show_image_1.showImageTool }; /** * Comprehensive collection of all available tools * * @example * ```typescript * import { ALL_TOOLS } from './core/tools'; * * // Access any tool by its key * const fetchTool = ALL_TOOLS.fetch; * const readFileTool = ALL_TOOLS.read_file; * ``` */ exports.ALL_TOOLS = { ...exports.NetworkTools, ...exports.FileSystemTools, ...exports.SystemTools, ...exports.CodeAnalysisTools, ...exports.MediaTools }; /** * Generates documentation for a collection of tools * * @param tools - A record mapping tool names to Tool objects * @returns A formatted string containing documentation for all tools in the collection * @example * ```typescript * const docs = getToolDocs(FileSystemTools); * console.log(docs); * // Output: * // ## read_file * // Parameters: * // - path: (required) The file path to read * // ... * ``` */ function getToolDocs(tools) { return Object.entries(tools) .map(([name, tool]) => { if (tool.parameters instanceof zod_1.z.ZodObject) { const params = tool.parameters.shape; const paramDocs = Object.entries(params) .map(([paramName, schema]) => { const zodSchema = schema; const description = zodSchema.description || paramName; const isRequired = !zodSchema.isOptional(); return `- ${paramName}: (${isRequired ? 'required' : 'optional'}) ${description}`; }) .join('\n'); return `## ${name}\nParameters:\n${paramDocs}`; } return `## ${name}\nParameters: (Schema not available)`; }) .join('\n\n'); } //# sourceMappingURL=index.js.map