@tyvm/knowhow 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/launch.json +14 -0
- package/CONFIG.md +336 -0
- package/README.md +49 -0
- package/autodoc/chat.mdx +20 -0
- package/autodoc/cli.mdx +11 -0
- package/autodoc/plugins/asana.mdx +47 -0
- package/autodoc/plugins/downloader/downloader.mdx +38 -0
- package/autodoc/plugins/downloader/plugin.mdx +37 -0
- package/autodoc/plugins/downloader/types.mdx +42 -0
- package/autodoc/plugins/embedding.mdx +41 -0
- package/autodoc/plugins/figma.mdx +45 -0
- package/autodoc/plugins/github.mdx +40 -0
- package/autodoc/plugins/jira.mdx +46 -0
- package/autodoc/plugins/language.mdx +37 -0
- package/autodoc/plugins/linear.mdx +35 -0
- package/autodoc/plugins/notion.mdx +38 -0
- package/autodoc/plugins/plugins.mdx +59 -0
- package/autodoc/plugins/types.mdx +51 -0
- package/autodoc/plugins/vim.mdx +39 -0
- package/autodoc/tools/addInternalTools.mdx +1 -0
- package/autodoc/tools/agentCall.mdx +1 -0
- package/autodoc/tools/asana/definitions.mdx +10 -0
- package/autodoc/tools/asana/index.mdx +12 -0
- package/autodoc/tools/askHuman.mdx +1 -0
- package/autodoc/tools/callPlugin.mdx +1 -0
- package/autodoc/tools/embeddingSearch.mdx +1 -0
- package/autodoc/tools/execCommand.mdx +1 -0
- package/autodoc/tools/fileSearch.mdx +1 -0
- package/autodoc/tools/finalAnswer.mdx +1 -0
- package/autodoc/tools/github/definitions.mdx +6 -0
- package/autodoc/tools/github/index.mdx +8 -0
- package/autodoc/tools/index.mdx +14 -0
- package/autodoc/tools/lintFile.mdx +7 -0
- package/autodoc/tools/list.mdx +16 -0
- package/autodoc/tools/modifyFile.mdx +7 -0
- package/autodoc/tools/patch.mdx +9 -0
- package/autodoc/tools/readBlocks.mdx +1 -0
- package/autodoc/tools/readFile.mdx +1 -0
- package/autodoc/tools/scanFile.mdx +1 -0
- package/autodoc/tools/textSearch.mdx +6 -0
- package/autodoc/tools/types/fileblock.mdx +1 -0
- package/autodoc/tools/visionTool.mdx +1 -0
- package/autodoc/tools/writeFile.mdx +1 -0
- package/jest.config.js +18 -0
- package/package.json +89 -0
- package/src/agents/base/base.ts +619 -0
- package/src/agents/base/prompt.ts +26 -0
- package/src/agents/configurable/ConfigAgent.ts +23 -0
- package/src/agents/developer/developer.ts +69 -0
- package/src/agents/index.ts +8 -0
- package/src/agents/interface.ts +11 -0
- package/src/agents/patcher/codebase.md +27 -0
- package/src/agents/patcher/patcher.ts +110 -0
- package/src/agents/researcher/researcher.ts +109 -0
- package/src/agents/tools/addInternalTools.ts +21 -0
- package/src/agents/tools/agentCall.ts +18 -0
- package/src/agents/tools/aiClient.ts +36 -0
- package/src/agents/tools/asana/definitions.ts +199 -0
- package/src/agents/tools/asana/index.ts +108 -0
- package/src/agents/tools/askHuman.ts +8 -0
- package/src/agents/tools/callPlugin.ts +4 -0
- package/src/agents/tools/embeddingSearch.ts +5 -0
- package/src/agents/tools/execCommand.ts +26 -0
- package/src/agents/tools/fileSearch.ts +33 -0
- package/src/agents/tools/finalAnswer.ts +4 -0
- package/src/agents/tools/github/definitions.ts +89 -0
- package/src/agents/tools/github/index.ts +67 -0
- package/src/agents/tools/googleSearch.ts +242 -0
- package/src/agents/tools/index.ts +24 -0
- package/src/agents/tools/language/definitions.ts +97 -0
- package/src/agents/tools/language/index.ts +19 -0
- package/src/agents/tools/lintFile.ts +17 -0
- package/src/agents/tools/list.ts +514 -0
- package/src/agents/tools/loadWebpage.ts +129 -0
- package/src/agents/tools/modifyFile.ts +53 -0
- package/src/agents/tools/patch.ts +672 -0
- package/src/agents/tools/readBlocks.ts +41 -0
- package/src/agents/tools/readFile.ts +39 -0
- package/src/agents/tools/scanFile.ts +16 -0
- package/src/agents/tools/textSearch.ts +21 -0
- package/src/agents/tools/types/fileblock.ts +5 -0
- package/src/agents/tools/visionTool.ts +5 -0
- package/src/agents/tools/writeFile.ts +46 -0
- package/src/agents/vim/vim.ts +153 -0
- package/src/ai.ts +167 -0
- package/src/chat.ts +412 -0
- package/src/cli.ts +85 -0
- package/src/clients/anthropic.ts +399 -0
- package/src/clients/gemini.ts +486 -0
- package/src/clients/http.ts +107 -0
- package/src/clients/index.ts +183 -0
- package/src/clients/knowhow.ts +33 -0
- package/src/clients/openai.ts +253 -0
- package/src/clients/types.ts +91 -0
- package/src/clients/xai.ts +132 -0
- package/src/config.ts +211 -0
- package/src/conversion.ts +140 -0
- package/src/dataset/diffs/README.md +12 -0
- package/src/dataset/diffs/debug-errors.ts +29 -0
- package/src/dataset/diffs/debug.ts +64 -0
- package/src/dataset/diffs/generate.ts +71 -0
- package/src/dataset/diffs/jsonl.ts +54 -0
- package/src/dataset/diffs/test.ts +193 -0
- package/src/embeddings.ts +411 -0
- package/src/hashes.ts +67 -0
- package/src/index.ts +376 -0
- package/src/login.ts +78 -0
- package/src/microphone.ts +136 -0
- package/src/modules/index.ts +37 -0
- package/src/modules/types.ts +48 -0
- package/src/plugins/asana.ts +134 -0
- package/src/plugins/downloader/downloader.ts +204 -0
- package/src/plugins/downloader/plugin.ts +85 -0
- package/src/plugins/downloader/types.ts +85 -0
- package/src/plugins/embedding.ts +42 -0
- package/src/plugins/figma.ts +137 -0
- package/src/plugins/github.ts +153 -0
- package/src/plugins/jira.ts +104 -0
- package/src/plugins/language.ts +100 -0
- package/src/plugins/linear.ts +219 -0
- package/src/plugins/notion.ts +170 -0
- package/src/plugins/plugins.ts +56 -0
- package/src/plugins/types.ts +5 -0
- package/src/plugins/url.ts +63 -0
- package/src/plugins/vim.ts +73 -0
- package/src/prompts/BasicCodeDocumenter.ts +1 -0
- package/src/prompts/BasicProjectDocumenter.ts +1 -0
- package/src/prompts/EmbeddingSeachHelper.ts +1 -0
- package/src/prompts/index.ts +9 -0
- package/src/server/index.ts +14 -0
- package/src/services/AgentService.ts +98 -0
- package/src/services/EmbeddingService.ts +410 -0
- package/src/services/EventService.ts +20 -0
- package/src/services/GitHub.ts +60 -0
- package/src/services/KnowhowClient.ts +113 -0
- package/src/services/Mcp.ts +270 -0
- package/src/services/McpServer.ts +119 -0
- package/src/services/McpWebsocketTransport.ts +64 -0
- package/src/services/S3.ts +126 -0
- package/src/services/Tools.ts +65 -0
- package/src/services/flags.ts +52 -0
- package/src/services/index.ts +8 -0
- package/src/types.ts +225 -0
- package/src/utils/index.ts +108 -0
- package/src/worker.ts +80 -0
- package/tests/integration/figma.test.ts +70 -0
- package/tests/integration/fileblocks/readwrite.test.ts +95 -0
- package/tests/integration/patching/input.txt +145 -0
- package/tests/integration/patching/output.txt +145 -0
- package/tests/integration/patching/patch.txt +15 -0
- package/tests/integration/patching/unseen.txt +80 -0
- package/tests/integration/patching.test.ts +136 -0
- package/tests/languagePlugin.test.ts +74 -0
- package/tests/patching/corrupted.test.ts +78 -0
- package/tests/patching/imports.patch.txt +11 -0
- package/tests/patching/imports.test.ts +43 -0
- package/tests/patching/imports.txt +11 -0
- package/tests/patching/interface.patch.txt +15 -0
- package/tests/patching/interface.txt +7 -0
- package/tests/test.spec.ts +132 -0
- package/ts_build/src/agents/base/base.d.ts +88 -0
- package/ts_build/src/agents/base/base.js +464 -0
- package/ts_build/src/agents/base/base.js.map +1 -0
- package/ts_build/src/agents/base/prompt.d.ts +1 -0
- package/ts_build/src/agents/base/prompt.js +30 -0
- package/ts_build/src/agents/base/prompt.js.map +1 -0
- package/ts_build/src/agents/configurable/ConfigAgent.d.ts +10 -0
- package/ts_build/src/agents/configurable/ConfigAgent.js +25 -0
- package/ts_build/src/agents/configurable/ConfigAgent.js.map +1 -0
- package/ts_build/src/agents/configurable/OpenAIAgent.d.ts +0 -0
- package/ts_build/src/agents/configurable/OpenAIAgent.js +1 -0
- package/ts_build/src/agents/configurable/OpenAIAgent.js.map +1 -0
- package/ts_build/src/agents/developer/developer.d.ts +9 -0
- package/ts_build/src/agents/developer/developer.js +69 -0
- package/ts_build/src/agents/developer/developer.js.map +1 -0
- package/ts_build/src/agents/index.d.ts +7 -0
- package/ts_build/src/agents/index.js +38 -0
- package/ts_build/src/agents/index.js.map +1 -0
- package/ts_build/src/agents/interface.d.ts +10 -0
- package/ts_build/src/agents/interface.js +3 -0
- package/ts_build/src/agents/interface.js.map +1 -0
- package/ts_build/src/agents/patcher/patcher.d.ts +9 -0
- package/ts_build/src/agents/patcher/patcher.js +106 -0
- package/ts_build/src/agents/patcher/patcher.js.map +1 -0
- package/ts_build/src/agents/researcher/researcher.d.ts +9 -0
- package/ts_build/src/agents/researcher/researcher.js +107 -0
- package/ts_build/src/agents/researcher/researcher.js.map +1 -0
- package/ts_build/src/agents/tools/addInternalTools.d.ts +5 -0
- package/ts_build/src/agents/tools/addInternalTools.js +18 -0
- package/ts_build/src/agents/tools/addInternalTools.js.map +1 -0
- package/ts_build/src/agents/tools/agentCall.d.ts +1 -0
- package/ts_build/src/agents/tools/agentCall.js +21 -0
- package/ts_build/src/agents/tools/agentCall.js.map +1 -0
- package/ts_build/src/agents/tools/aiClient.d.ts +6 -0
- package/ts_build/src/agents/tools/aiClient.js +25 -0
- package/ts_build/src/agents/tools/aiClient.js.map +1 -0
- package/ts_build/src/agents/tools/asana/definitions.d.ts +202 -0
- package/ts_build/src/agents/tools/asana/definitions.js +197 -0
- package/ts_build/src/agents/tools/asana/definitions.js.map +1 -0
- package/ts_build/src/agents/tools/asana/index.d.ts +8 -0
- package/ts_build/src/agents/tools/asana/index.js +98 -0
- package/ts_build/src/agents/tools/asana/index.js.map +1 -0
- package/ts_build/src/agents/tools/askHuman.d.ts +1 -0
- package/ts_build/src/agents/tools/askHuman.js +15 -0
- package/ts_build/src/agents/tools/askHuman.js.map +1 -0
- package/ts_build/src/agents/tools/callPlugin.d.ts +1 -0
- package/ts_build/src/agents/tools/callPlugin.js +9 -0
- package/ts_build/src/agents/tools/callPlugin.js.map +1 -0
- package/ts_build/src/agents/tools/client.d.ts +5 -0
- package/ts_build/src/agents/tools/client.js +21 -0
- package/ts_build/src/agents/tools/client.js.map +1 -0
- package/ts_build/src/agents/tools/embeddingSearch.d.ts +1 -0
- package/ts_build/src/agents/tools/embeddingSearch.js +9 -0
- package/ts_build/src/agents/tools/embeddingSearch.js.map +1 -0
- package/ts_build/src/agents/tools/execCommand.d.ts +1 -0
- package/ts_build/src/agents/tools/execCommand.js +25 -0
- package/ts_build/src/agents/tools/execCommand.js.map +1 -0
- package/ts_build/src/agents/tools/fileSearch.d.ts +1 -0
- package/ts_build/src/agents/tools/fileSearch.js +31 -0
- package/ts_build/src/agents/tools/fileSearch.js.map +1 -0
- package/ts_build/src/agents/tools/finalAnswer.d.ts +1 -0
- package/ts_build/src/agents/tools/finalAnswer.js +8 -0
- package/ts_build/src/agents/tools/finalAnswer.js.map +1 -0
- package/ts_build/src/agents/tools/github/definitions.d.ts +47 -0
- package/ts_build/src/agents/tools/github/definitions.js +86 -0
- package/ts_build/src/agents/tools/github/definitions.js.map +1 -0
- package/ts_build/src/agents/tools/github/index.d.ts +789 -0
- package/ts_build/src/agents/tools/github/index.js +56 -0
- package/ts_build/src/agents/tools/github/index.js.map +1 -0
- package/ts_build/src/agents/tools/googleSearch.d.ts +93 -0
- package/ts_build/src/agents/tools/googleSearch.js +117 -0
- package/ts_build/src/agents/tools/googleSearch.js.map +1 -0
- package/ts_build/src/agents/tools/googleSearchTypes.d.ts +74 -0
- package/ts_build/src/agents/tools/googleSearchTypes.js +3 -0
- package/ts_build/src/agents/tools/googleSearchTypes.js.map +1 -0
- package/ts_build/src/agents/tools/index.d.ts +24 -0
- package/ts_build/src/agents/tools/index.js +41 -0
- package/ts_build/src/agents/tools/index.js.map +1 -0
- package/ts_build/src/agents/tools/language/definitions.d.ts +89 -0
- package/ts_build/src/agents/tools/language/definitions.js +95 -0
- package/ts_build/src/agents/tools/language/definitions.js.map +1 -0
- package/ts_build/src/agents/tools/language/index.d.ts +4 -0
- package/ts_build/src/agents/tools/language/index.js +22 -0
- package/ts_build/src/agents/tools/language/index.js.map +1 -0
- package/ts_build/src/agents/tools/lintFile.d.ts +1 -0
- package/ts_build/src/agents/tools/lintFile.js +22 -0
- package/ts_build/src/agents/tools/lintFile.js.map +1 -0
- package/ts_build/src/agents/tools/list.d.ts +2 -0
- package/ts_build/src/agents/tools/list.js +505 -0
- package/ts_build/src/agents/tools/list.js.map +1 -0
- package/ts_build/src/agents/tools/loadWebpage.d.ts +8 -0
- package/ts_build/src/agents/tools/loadWebpage.js +97 -0
- package/ts_build/src/agents/tools/loadWebpage.js.map +1 -0
- package/ts_build/src/agents/tools/modifyFile.d.ts +2 -0
- package/ts_build/src/agents/tools/modifyFile.js +74 -0
- package/ts_build/src/agents/tools/modifyFile.js.map +1 -0
- package/ts_build/src/agents/tools/patch.d.ts +21 -0
- package/ts_build/src/agents/tools/patch.js +443 -0
- package/ts_build/src/agents/tools/patch.js.map +1 -0
- package/ts_build/src/agents/tools/readBlocks.d.ts +2 -0
- package/ts_build/src/agents/tools/readBlocks.js +59 -0
- package/ts_build/src/agents/tools/readBlocks.js.map +1 -0
- package/ts_build/src/agents/tools/readFile.d.ts +1 -0
- package/ts_build/src/agents/tools/readFile.js +46 -0
- package/ts_build/src/agents/tools/readFile.js.map +1 -0
- package/ts_build/src/agents/tools/scanFile.d.ts +1 -0
- package/ts_build/src/agents/tools/scanFile.js +36 -0
- package/ts_build/src/agents/tools/scanFile.js.map +1 -0
- package/ts_build/src/agents/tools/textSearch.d.ts +1 -0
- package/ts_build/src/agents/tools/textSearch.js +22 -0
- package/ts_build/src/agents/tools/textSearch.js.map +1 -0
- package/ts_build/src/agents/tools/types/fileblock.d.ts +5 -0
- package/ts_build/src/agents/tools/types/fileblock.js +3 -0
- package/ts_build/src/agents/tools/types/fileblock.js.map +1 -0
- package/ts_build/src/agents/tools/visionTool.d.ts +1 -0
- package/ts_build/src/agents/tools/visionTool.js +9 -0
- package/ts_build/src/agents/tools/visionTool.js.map +1 -0
- package/ts_build/src/agents/tools/writeFile.d.ts +2 -0
- package/ts_build/src/agents/tools/writeFile.js +61 -0
- package/ts_build/src/agents/tools/writeFile.js.map +1 -0
- package/ts_build/src/agents/vim/vim.d.ts +14 -0
- package/ts_build/src/agents/vim/vim.js +171 -0
- package/ts_build/src/agents/vim/vim.js.map +1 -0
- package/ts_build/src/ai.d.ts +10 -0
- package/ts_build/src/ai.js +102 -0
- package/ts_build/src/ai.js.map +1 -0
- package/ts_build/src/chat.d.ts +13 -0
- package/ts_build/src/chat.js +319 -0
- package/ts_build/src/chat.js.map +1 -0
- package/ts_build/src/cli.d.ts +2 -0
- package/ts_build/src/cli.js +98 -0
- package/ts_build/src/cli.js.map +1 -0
- package/ts_build/src/clients/anthropic.d.ts +31 -0
- package/ts_build/src/clients/anthropic.js +344 -0
- package/ts_build/src/clients/anthropic.js.map +1 -0
- package/ts_build/src/clients/gemini.d.ts +20 -0
- package/ts_build/src/clients/gemini.js +347 -0
- package/ts_build/src/clients/gemini.js.map +1 -0
- package/ts_build/src/clients/http.d.ts +12 -0
- package/ts_build/src/clients/http.js +91 -0
- package/ts_build/src/clients/http.js.map +1 -0
- package/ts_build/src/clients/index.d.ts +47 -0
- package/ts_build/src/clients/index.js +143 -0
- package/ts_build/src/clients/index.js.map +1 -0
- package/ts_build/src/clients/knowhow.d.ts +10 -0
- package/ts_build/src/clients/knowhow.js +24 -0
- package/ts_build/src/clients/knowhow.js.map +1 -0
- package/ts_build/src/clients/openai.d.ts +20 -0
- package/ts_build/src/clients/openai.js +221 -0
- package/ts_build/src/clients/openai.js.map +1 -0
- package/ts_build/src/clients/types.d.ts +89 -0
- package/ts_build/src/clients/types.js +3 -0
- package/ts_build/src/clients/types.js.map +1 -0
- package/ts_build/src/clients/xai.d.ts +22 -0
- package/ts_build/src/clients/xai.js +108 -0
- package/ts_build/src/clients/xai.js.map +1 -0
- package/ts_build/src/config.d.ts +9 -0
- package/ts_build/src/config.js +216 -0
- package/ts_build/src/config.js.map +1 -0
- package/ts_build/src/conversion.d.ts +7 -0
- package/ts_build/src/conversion.js +114 -0
- package/ts_build/src/conversion.js.map +1 -0
- package/ts_build/src/dataset/diffs/debug-errors.d.ts +1 -0
- package/ts_build/src/dataset/diffs/debug-errors.js +28 -0
- package/ts_build/src/dataset/diffs/debug-errors.js.map +1 -0
- package/ts_build/src/dataset/diffs/debug.d.ts +1 -0
- package/ts_build/src/dataset/diffs/debug.js +50 -0
- package/ts_build/src/dataset/diffs/debug.js.map +1 -0
- package/ts_build/src/dataset/diffs/generate.d.ts +1 -0
- package/ts_build/src/dataset/diffs/generate.js +70 -0
- package/ts_build/src/dataset/diffs/generate.js.map +1 -0
- package/ts_build/src/dataset/diffs/jsonl.d.ts +1 -0
- package/ts_build/src/dataset/diffs/jsonl.js +47 -0
- package/ts_build/src/dataset/diffs/jsonl.js.map +1 -0
- package/ts_build/src/dataset/diffs/test.d.ts +1 -0
- package/ts_build/src/dataset/diffs/test.js +114 -0
- package/ts_build/src/dataset/diffs/test.js.map +1 -0
- package/ts_build/src/embeddings.d.ts +19 -0
- package/ts_build/src/embeddings.js +322 -0
- package/ts_build/src/embeddings.js.map +1 -0
- package/ts_build/src/hashes.d.ts +6 -0
- package/ts_build/src/hashes.js +78 -0
- package/ts_build/src/hashes.js.map +1 -0
- package/ts_build/src/index.d.ts +14 -0
- package/ts_build/src/index.js +258 -0
- package/ts_build/src/index.js.map +1 -0
- package/ts_build/src/login.d.ts +2 -0
- package/ts_build/src/login.js +63 -0
- package/ts_build/src/login.js.map +1 -0
- package/ts_build/src/microphone.d.ts +9 -0
- package/ts_build/src/microphone.js +131 -0
- package/ts_build/src/microphone.js.map +1 -0
- package/ts_build/src/modules/index.d.ts +3 -0
- package/ts_build/src/modules/index.js +34 -0
- package/ts_build/src/modules/index.js.map +1 -0
- package/ts_build/src/modules/types.d.ts +37 -0
- package/ts_build/src/modules/types.js +3 -0
- package/ts_build/src/modules/types.js.map +1 -0
- package/ts_build/src/plugins/asana.d.ts +16 -0
- package/ts_build/src/plugins/asana.js +114 -0
- package/ts_build/src/plugins/asana.js.map +1 -0
- package/ts_build/src/plugins/downloader/downloader.d.ts +12 -0
- package/ts_build/src/plugins/downloader/downloader.js +174 -0
- package/ts_build/src/plugins/downloader/downloader.js.map +1 -0
- package/ts_build/src/plugins/downloader/index.d.ts +3 -0
- package/ts_build/src/plugins/downloader/index.js +41 -0
- package/ts_build/src/plugins/downloader/index.js.map +1 -0
- package/ts_build/src/plugins/downloader/plugin.d.ts +8 -0
- package/ts_build/src/plugins/downloader/plugin.js +83 -0
- package/ts_build/src/plugins/downloader/plugin.js.map +1 -0
- package/ts_build/src/plugins/downloader/types.d.ts +82 -0
- package/ts_build/src/plugins/downloader/types.js +79 -0
- package/ts_build/src/plugins/downloader/types.js.map +1 -0
- package/ts_build/src/plugins/embedding.d.ts +5 -0
- package/ts_build/src/plugins/embedding.js +28 -0
- package/ts_build/src/plugins/embedding.js.map +1 -0
- package/ts_build/src/plugins/figma.d.ts +20 -0
- package/ts_build/src/plugins/figma.js +94 -0
- package/ts_build/src/plugins/figma.js.map +1 -0
- package/ts_build/src/plugins/github.d.ts +1223 -0
- package/ts_build/src/plugins/github.js +115 -0
- package/ts_build/src/plugins/github.js.map +1 -0
- package/ts_build/src/plugins/jira.d.ts +15 -0
- package/ts_build/src/plugins/jira.js +94 -0
- package/ts_build/src/plugins/jira.js.map +1 -0
- package/ts_build/src/plugins/language.d.ts +8 -0
- package/ts_build/src/plugins/language.js +69 -0
- package/ts_build/src/plugins/language.js.map +1 -0
- package/ts_build/src/plugins/linear.d.ts +23 -0
- package/ts_build/src/plugins/linear.js +184 -0
- package/ts_build/src/plugins/linear.js.map +1 -0
- package/ts_build/src/plugins/notion.d.ts +32 -0
- package/ts_build/src/plugins/notion.js +131 -0
- package/ts_build/src/plugins/notion.js.map +1 -0
- package/ts_build/src/plugins/plugins.d.ts +11 -0
- package/ts_build/src/plugins/plugins.js +51 -0
- package/ts_build/src/plugins/plugins.js.map +1 -0
- package/ts_build/src/plugins/types.d.ts +5 -0
- package/ts_build/src/plugins/types.js +3 -0
- package/ts_build/src/plugins/types.js.map +1 -0
- package/ts_build/src/plugins/url.d.ts +8 -0
- package/ts_build/src/plugins/url.js +50 -0
- package/ts_build/src/plugins/url.js.map +1 -0
- package/ts_build/src/plugins/vim.d.ts +11 -0
- package/ts_build/src/plugins/vim.js +63 -0
- package/ts_build/src/plugins/vim.js.map +1 -0
- package/ts_build/src/prompts/BasicCodeDocumenter.d.ts +2 -0
- package/ts_build/src/prompts/BasicCodeDocumenter.js +4 -0
- package/ts_build/src/prompts/BasicCodeDocumenter.js.map +1 -0
- package/ts_build/src/prompts/BasicProjectDocumenter.d.ts +2 -0
- package/ts_build/src/prompts/BasicProjectDocumenter.js +4 -0
- package/ts_build/src/prompts/BasicProjectDocumenter.js.map +1 -0
- package/ts_build/src/prompts/EmbeddingSeachHelper.d.ts +2 -0
- package/ts_build/src/prompts/EmbeddingSeachHelper.js +4 -0
- package/ts_build/src/prompts/EmbeddingSeachHelper.js.map +1 -0
- package/ts_build/src/prompts/index.d.ts +13 -0
- package/ts_build/src/prompts/index.js +15 -0
- package/ts_build/src/prompts/index.js.map +1 -0
- package/ts_build/src/server/index.d.ts +1 -0
- package/ts_build/src/server/index.js +17 -0
- package/ts_build/src/server/index.js.map +1 -0
- package/ts_build/src/services/AgentService.d.ts +14 -0
- package/ts_build/src/services/AgentService.js +87 -0
- package/ts_build/src/services/AgentService.js.map +1 -0
- package/ts_build/src/services/EmbeddingService.d.ts +39 -0
- package/ts_build/src/services/EmbeddingService.js +307 -0
- package/ts_build/src/services/EmbeddingService.js.map +1 -0
- package/ts_build/src/services/EventService.d.ts +9 -0
- package/ts_build/src/services/EventService.js +20 -0
- package/ts_build/src/services/EventService.js.map +1 -0
- package/ts_build/src/services/GitHub.d.ts +11 -0
- package/ts_build/src/services/GitHub.js +52 -0
- package/ts_build/src/services/GitHub.js.map +1 -0
- package/ts_build/src/services/KnowhowClient.d.ts +18 -0
- package/ts_build/src/services/KnowhowClient.js +85 -0
- package/ts_build/src/services/KnowhowClient.js.map +1 -0
- package/ts_build/src/services/Mcp.d.ts +377 -0
- package/ts_build/src/services/Mcp.js +221 -0
- package/ts_build/src/services/Mcp.js.map +1 -0
- package/ts_build/src/services/McpServer.d.ts +19 -0
- package/ts_build/src/services/McpServer.js +104 -0
- package/ts_build/src/services/McpServer.js.map +1 -0
- package/ts_build/src/services/McpWebsocketTransport.d.ts +13 -0
- package/ts_build/src/services/McpWebsocketTransport.js +59 -0
- package/ts_build/src/services/McpWebsocketTransport.js.map +1 -0
- package/ts_build/src/services/S3.d.ts +9 -0
- package/ts_build/src/services/S3.js +116 -0
- package/ts_build/src/services/S3.js.map +1 -0
- package/ts_build/src/services/Tools.d.ts +19 -0
- package/ts_build/src/services/Tools.js +51 -0
- package/ts_build/src/services/Tools.js.map +1 -0
- package/ts_build/src/services/flags.d.ts +13 -0
- package/ts_build/src/services/flags.js +48 -0
- package/ts_build/src/services/flags.js.map +1 -0
- package/ts_build/src/services/index.d.ts +8 -0
- package/ts_build/src/services/index.js +38 -0
- package/ts_build/src/services/index.js.map +1 -0
- package/ts_build/src/terminal.d.ts +1 -0
- package/ts_build/src/terminal.js +35 -0
- package/ts_build/src/terminal.js.map +1 -0
- package/ts_build/src/types.d.ts +181 -0
- package/ts_build/src/types.js +94 -0
- package/ts_build/src/types.js.map +1 -0
- package/ts_build/src/utils/index.d.ts +24 -0
- package/ts_build/src/utils/index.js +116 -0
- package/ts_build/src/utils/index.js.map +1 -0
- package/ts_build/src/worker.d.ts +1 -0
- package/ts_build/src/worker.js +68 -0
- package/ts_build/src/worker.js.map +1 -0
- package/ts_build/tests/integration/figma.test.d.ts +1 -0
- package/ts_build/tests/integration/figma.test.js +47 -0
- package/ts_build/tests/integration/figma.test.js.map +1 -0
- package/ts_build/tests/integration/fileblocks/readwrite.test.d.ts +1 -0
- package/ts_build/tests/integration/fileblocks/readwrite.test.js +95 -0
- package/ts_build/tests/integration/fileblocks/readwrite.test.js.map +1 -0
- package/ts_build/tests/integration/patching.test.d.ts +1 -0
- package/ts_build/tests/integration/patching.test.js +117 -0
- package/ts_build/tests/integration/patching.test.js.map +1 -0
- package/ts_build/tests/languagePlugin.test.d.ts +1 -0
- package/ts_build/tests/languagePlugin.test.js +78 -0
- package/ts_build/tests/languagePlugin.test.js.map +1 -0
- package/ts_build/tests/patching/corrupted.test.d.ts +1 -0
- package/ts_build/tests/patching/corrupted.test.js +53 -0
- package/ts_build/tests/patching/corrupted.test.js.map +1 -0
- package/ts_build/tests/patching/imports.test.d.ts +1 -0
- package/ts_build/tests/patching/imports.test.js +61 -0
- package/ts_build/tests/patching/imports.test.js.map +1 -0
- package/ts_build/tests/test.spec.d.ts +1 -0
- package/ts_build/tests/test.spec.js +101 -0
- package/ts_build/tests/test.spec.js.map +1 -0
- package/tsconfig.json +31 -0
- package/tslint.json +11 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lintFile = void 0;
|
|
4
|
+
const config_1 = require("../../config");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
async function lintFile(filePath) {
|
|
7
|
+
const config = await (0, config_1.getConfig)();
|
|
8
|
+
const extension = filePath.split(".").pop();
|
|
9
|
+
let lintResult = "";
|
|
10
|
+
if (config.lintCommands && config.lintCommands[extension]) {
|
|
11
|
+
let lintCommand = config.lintCommands[extension];
|
|
12
|
+
if (lintCommand.includes("$1")) {
|
|
13
|
+
lintCommand = lintCommand.replace("$1", filePath);
|
|
14
|
+
}
|
|
15
|
+
lintResult = await (0, _1.execCommand)(`${lintCommand}`);
|
|
16
|
+
console.log("Lint Result:", lintResult);
|
|
17
|
+
return lintResult;
|
|
18
|
+
}
|
|
19
|
+
return "";
|
|
20
|
+
}
|
|
21
|
+
exports.lintFile = lintFile;
|
|
22
|
+
//# sourceMappingURL=lintFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lintFile.js","sourceRoot":"","sources":["../../../../src/agents/tools/lintFile.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AACzC,wBAAgC;AACzB,KAAK,UAAU,QAAQ,CAAC,QAAgB;IAC7C,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,GAAE,CAAC;IACjC,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IAC5C,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE;QACzD,IAAI,WAAW,GAAG,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QACjD,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAC9B,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;SACnD;QACD,UAAU,GAAG,MAAM,IAAA,cAAW,EAAC,GAAG,WAAW,EAAE,CAAC,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QACxC,OAAO,UAAU,CAAC;KACnB;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAdD,4BAcC"}
|
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.includedTools = void 0;
|
|
27
|
+
const plugins_1 = require("../../plugins/plugins");
|
|
28
|
+
const pluginNames = plugins_1.Plugins.listPlugins().join(", ");
|
|
29
|
+
const github = __importStar(require("./github/definitions"));
|
|
30
|
+
const asana = __importStar(require("./asana/definitions"));
|
|
31
|
+
const language = __importStar(require("./language/definitions"));
|
|
32
|
+
const googleSearch_1 = require("./googleSearch");
|
|
33
|
+
exports.includedTools = [
|
|
34
|
+
{
|
|
35
|
+
type: "function",
|
|
36
|
+
function: {
|
|
37
|
+
name: "embeddingSearch",
|
|
38
|
+
description: "Fuzzy search with cosine similarity for files related to the user's goal. Uses embeddings. Use textSearch for exact matches. Use fileSearch for file paths.",
|
|
39
|
+
parameters: {
|
|
40
|
+
type: "object",
|
|
41
|
+
positional: true,
|
|
42
|
+
properties: {
|
|
43
|
+
keyword: {
|
|
44
|
+
type: "string",
|
|
45
|
+
description: "The code, keyword or phrase to search for via embedding search",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
required: ["keyword"],
|
|
49
|
+
},
|
|
50
|
+
returns: {
|
|
51
|
+
type: "string",
|
|
52
|
+
description: "A string containing a JSON of all the matched files",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: "function",
|
|
58
|
+
function: {
|
|
59
|
+
name: "execCommand",
|
|
60
|
+
description: "Execute a command in the system's command line interface. Use this to run tests and things in the terminal",
|
|
61
|
+
parameters: {
|
|
62
|
+
type: "object",
|
|
63
|
+
positional: true,
|
|
64
|
+
properties: {
|
|
65
|
+
command: {
|
|
66
|
+
type: "string",
|
|
67
|
+
description: "The command to execute",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
required: ["command"],
|
|
71
|
+
},
|
|
72
|
+
returns: {
|
|
73
|
+
type: "object",
|
|
74
|
+
properties: {
|
|
75
|
+
stdout: {
|
|
76
|
+
type: "string",
|
|
77
|
+
description: "The standard output of the executed command",
|
|
78
|
+
},
|
|
79
|
+
stderr: {
|
|
80
|
+
type: "string",
|
|
81
|
+
description: "The standard error output of the executed command",
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
description: "The result of the command execution, including any output and errors",
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: "function",
|
|
90
|
+
function: {
|
|
91
|
+
name: "finalAnswer",
|
|
92
|
+
description: "Finalize the AI's task and return the answer to the user. You are required to call this at the end to send the response to the user",
|
|
93
|
+
parameters: {
|
|
94
|
+
type: "object",
|
|
95
|
+
positional: true,
|
|
96
|
+
properties: {
|
|
97
|
+
answer: {
|
|
98
|
+
type: "string",
|
|
99
|
+
description: "The AI's answer to be displayed to the user as the full explanation of the task and what was done",
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
required: ["answer"],
|
|
103
|
+
},
|
|
104
|
+
returns: {
|
|
105
|
+
type: "string",
|
|
106
|
+
description: "The final answer string that will be displayed to the user",
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: "function",
|
|
112
|
+
function: {
|
|
113
|
+
name: "callPlugin",
|
|
114
|
+
description: `Call a specified plugin with given input. Plugins provide additional context from supported URLs or words. This is a read-only operation. Currently available plugins: ${pluginNames}`,
|
|
115
|
+
parameters: {
|
|
116
|
+
type: "object",
|
|
117
|
+
positional: true,
|
|
118
|
+
properties: {
|
|
119
|
+
pluginName: {
|
|
120
|
+
type: "string",
|
|
121
|
+
description: "The name of the plugin to be called",
|
|
122
|
+
},
|
|
123
|
+
userInput: {
|
|
124
|
+
type: "string",
|
|
125
|
+
description: "The input to pass to the plugin",
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
required: ["pluginName", "userInput"],
|
|
129
|
+
},
|
|
130
|
+
returns: {
|
|
131
|
+
type: "string",
|
|
132
|
+
description: "The result of the plugin call",
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
type: "function",
|
|
138
|
+
function: {
|
|
139
|
+
name: "visionTool",
|
|
140
|
+
description: "Ask the vision API a question about an image url",
|
|
141
|
+
parameters: {
|
|
142
|
+
type: "object",
|
|
143
|
+
positional: true,
|
|
144
|
+
properties: {
|
|
145
|
+
imageUrl: {
|
|
146
|
+
type: "string",
|
|
147
|
+
description: "The url of the image to load",
|
|
148
|
+
},
|
|
149
|
+
question: {
|
|
150
|
+
type: "string",
|
|
151
|
+
description: "The prompt related to the image",
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
required: ["imageUrl", "question"],
|
|
155
|
+
},
|
|
156
|
+
returns: {
|
|
157
|
+
type: "string",
|
|
158
|
+
description: "The results of the vision API call as an answer to the prompt question",
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
type: "function",
|
|
164
|
+
function: {
|
|
165
|
+
name: "readFile",
|
|
166
|
+
description: "Read the contents of a file and return them as an array of blocks",
|
|
167
|
+
parameters: {
|
|
168
|
+
type: "object",
|
|
169
|
+
positional: true,
|
|
170
|
+
properties: {
|
|
171
|
+
filePath: {
|
|
172
|
+
type: "string",
|
|
173
|
+
description: "The path to the file to be read",
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
required: ["filePath"],
|
|
177
|
+
},
|
|
178
|
+
returns: {
|
|
179
|
+
type: "string",
|
|
180
|
+
description: "The file contents in diff format",
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
type: "function",
|
|
186
|
+
function: {
|
|
187
|
+
name: "readBlocks",
|
|
188
|
+
description: "Read specific blocks from a file based on block numbers. Blocks are numbered blocks of text, containing a few lines of content",
|
|
189
|
+
parameters: {
|
|
190
|
+
type: "object",
|
|
191
|
+
positional: true,
|
|
192
|
+
properties: {
|
|
193
|
+
filePath: {
|
|
194
|
+
type: "string",
|
|
195
|
+
description: "The path to the file from which blocks are to be read",
|
|
196
|
+
},
|
|
197
|
+
blockNumbers: {
|
|
198
|
+
type: "array",
|
|
199
|
+
items: {
|
|
200
|
+
type: "number",
|
|
201
|
+
},
|
|
202
|
+
description: "An array of block numbers to be read from the file",
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
required: ["filePath", "blockNumbers"],
|
|
206
|
+
},
|
|
207
|
+
returns: {
|
|
208
|
+
type: "array",
|
|
209
|
+
description: "An array of file blocks corresponding to the specified block numbers",
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
type: "function",
|
|
215
|
+
function: {
|
|
216
|
+
name: "patchFile",
|
|
217
|
+
description: "Modify file with patch. Can also create new files. Use GNU diffutils syntax with - in front of removals and + in front of additions. Always check your work after applying a patch to ensure the patch did what you expected. Think step by step while constructing the patch, of which lines your will add and remove. Make sure that your patch is maintaining proper syntax. Do not modify lines unrelated to the goal. Patches should contain 3 to 6 lines of context before and after changes. No omissions of lines for removals are allowed. Use multiple small patches over one large patch that affects multiple places in the file.",
|
|
218
|
+
parameters: {
|
|
219
|
+
type: "object",
|
|
220
|
+
positional: true,
|
|
221
|
+
properties: {
|
|
222
|
+
filePath: {
|
|
223
|
+
type: "string",
|
|
224
|
+
description: "The path to the file to be patched",
|
|
225
|
+
},
|
|
226
|
+
patch: {
|
|
227
|
+
type: "string",
|
|
228
|
+
description: "The patch to apply in unified diff format",
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
required: ["filePath", "patch"],
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
type: "function",
|
|
237
|
+
function: {
|
|
238
|
+
name: "lintFile",
|
|
239
|
+
description: "Lint a file based on the file extension using predefined linting commands from the configuration.",
|
|
240
|
+
parameters: {
|
|
241
|
+
type: "object",
|
|
242
|
+
positional: true,
|
|
243
|
+
properties: {
|
|
244
|
+
filePath: {
|
|
245
|
+
type: "string",
|
|
246
|
+
description: "The path to the file to be linted.",
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
required: ["filePath"],
|
|
250
|
+
},
|
|
251
|
+
returns: {
|
|
252
|
+
type: "string",
|
|
253
|
+
description: "The result of the linting process or an empty string if no lint command is configured for the file extension.",
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
type: "function",
|
|
259
|
+
function: {
|
|
260
|
+
name: "textSearch",
|
|
261
|
+
description: "Exact Search. Search for exact matches of text across files. Use embeddingSearch for fuzzy search. Use fileSearch for file paths",
|
|
262
|
+
parameters: {
|
|
263
|
+
type: "object",
|
|
264
|
+
positional: true,
|
|
265
|
+
properties: {
|
|
266
|
+
searchTerm: {
|
|
267
|
+
type: "string",
|
|
268
|
+
description: "The text string to search for across files",
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
required: ["searchTerm"],
|
|
272
|
+
},
|
|
273
|
+
returns: {
|
|
274
|
+
type: "string",
|
|
275
|
+
description: "The result of the text search, including any matches",
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
type: "function",
|
|
281
|
+
function: {
|
|
282
|
+
name: "fileSearch",
|
|
283
|
+
description: "Search for files where the filepath includes a searchTerm",
|
|
284
|
+
parameters: {
|
|
285
|
+
type: "object",
|
|
286
|
+
positional: true,
|
|
287
|
+
properties: {
|
|
288
|
+
searchTerm: {
|
|
289
|
+
type: "string",
|
|
290
|
+
description: "a string to search for in file paths",
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
required: ["searchTerm"],
|
|
294
|
+
},
|
|
295
|
+
returns: {
|
|
296
|
+
type: "string",
|
|
297
|
+
description: "The result of the file search, including any matches",
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
type: "function",
|
|
303
|
+
function: {
|
|
304
|
+
name: "askHuman",
|
|
305
|
+
description: "Ask a human a question and get a response.",
|
|
306
|
+
parameters: {
|
|
307
|
+
type: "object",
|
|
308
|
+
positional: true,
|
|
309
|
+
properties: {
|
|
310
|
+
question: {
|
|
311
|
+
type: "string",
|
|
312
|
+
description: "The question to ask the human. Can be in markdown",
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
required: ["question"],
|
|
316
|
+
},
|
|
317
|
+
returns: {
|
|
318
|
+
type: "string",
|
|
319
|
+
description: "The response from the human.",
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
type: "function",
|
|
325
|
+
function: {
|
|
326
|
+
name: "writeFileChunk",
|
|
327
|
+
description: "Update or create files by writing in smaller chunks. Suitable for larger files, this tool allows incremental writing by calling it multiple times.",
|
|
328
|
+
parameters: {
|
|
329
|
+
type: "object",
|
|
330
|
+
positional: true,
|
|
331
|
+
properties: {
|
|
332
|
+
filePath: {
|
|
333
|
+
type: "string",
|
|
334
|
+
description: "The path to the file where the content will be written",
|
|
335
|
+
},
|
|
336
|
+
content: {
|
|
337
|
+
type: "string",
|
|
338
|
+
description: "The chunk of content to write to the file",
|
|
339
|
+
},
|
|
340
|
+
isContinuing: {
|
|
341
|
+
type: "boolean",
|
|
342
|
+
description: "Flag indicating whether to append the content to an existing file (`true`) or start a new file (`false`)",
|
|
343
|
+
},
|
|
344
|
+
isDone: {
|
|
345
|
+
type: "boolean",
|
|
346
|
+
description: "Flag indicating whether this is the final chunk of content",
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
required: ["filePath", "content", "isContinuing", "isDone"],
|
|
350
|
+
},
|
|
351
|
+
returns: {
|
|
352
|
+
type: "string",
|
|
353
|
+
description: "A message indicating the status of the file writing process",
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
type: "function",
|
|
359
|
+
function: {
|
|
360
|
+
name: "createAiCompletion",
|
|
361
|
+
description: "Create a completion using the knowhow ai client",
|
|
362
|
+
parameters: {
|
|
363
|
+
type: "object",
|
|
364
|
+
positional: true,
|
|
365
|
+
properties: {
|
|
366
|
+
provider: {
|
|
367
|
+
type: "string",
|
|
368
|
+
description: "The AI provider to use (e.g., 'openai', 'anthropic'). Use listAllModels to figure out which provider to use if you don't know",
|
|
369
|
+
},
|
|
370
|
+
options: {
|
|
371
|
+
type: "object",
|
|
372
|
+
description: "The completion options",
|
|
373
|
+
properties: {
|
|
374
|
+
model: { type: "string", description: "The model to use" },
|
|
375
|
+
messages: {
|
|
376
|
+
type: "array",
|
|
377
|
+
description: "The messages for the completion",
|
|
378
|
+
items: {
|
|
379
|
+
type: "object",
|
|
380
|
+
properties: {
|
|
381
|
+
role: { type: "string" },
|
|
382
|
+
content: { type: "string" },
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
max_tokens: {
|
|
387
|
+
type: "number",
|
|
388
|
+
description: "Maximum number of tokens to generate",
|
|
389
|
+
},
|
|
390
|
+
},
|
|
391
|
+
required: ["model", "messages"],
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
required: ["provider"],
|
|
395
|
+
},
|
|
396
|
+
returns: {
|
|
397
|
+
type: "object",
|
|
398
|
+
description: "The completion response from the AI provider",
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
type: "function",
|
|
404
|
+
function: {
|
|
405
|
+
name: "listAllModels",
|
|
406
|
+
description: "List all available models using the knowhow ai client",
|
|
407
|
+
parameters: {
|
|
408
|
+
type: "object",
|
|
409
|
+
properties: {},
|
|
410
|
+
required: [],
|
|
411
|
+
},
|
|
412
|
+
returns: {
|
|
413
|
+
type: "object",
|
|
414
|
+
description: "A dictionary of all available models for each provider",
|
|
415
|
+
},
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
type: "function",
|
|
420
|
+
function: {
|
|
421
|
+
name: "listAllProviders",
|
|
422
|
+
description: "List all available providers using the knowhow ai client",
|
|
423
|
+
parameters: {
|
|
424
|
+
type: "object",
|
|
425
|
+
properties: {},
|
|
426
|
+
required: [],
|
|
427
|
+
},
|
|
428
|
+
returns: {
|
|
429
|
+
type: "array",
|
|
430
|
+
description: "An array of all available providers",
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
type: "function",
|
|
436
|
+
function: {
|
|
437
|
+
name: "createEmbedding",
|
|
438
|
+
description: "Create an embedding using the knowhow ai client",
|
|
439
|
+
parameters: {
|
|
440
|
+
type: "object",
|
|
441
|
+
positional: true,
|
|
442
|
+
properties: {
|
|
443
|
+
provider: {
|
|
444
|
+
type: "string",
|
|
445
|
+
description: "The AI provider to use (e.g., 'openai', 'anthropic'). Use listAllModels to figure out which provider to use if you don't know",
|
|
446
|
+
},
|
|
447
|
+
options: {
|
|
448
|
+
type: "object",
|
|
449
|
+
description: "The embedding options",
|
|
450
|
+
properties: {
|
|
451
|
+
input: { type: "string", description: "The text to embed" },
|
|
452
|
+
model: { type: "string", description: "The model to use (optional)" },
|
|
453
|
+
},
|
|
454
|
+
required: ["input"],
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
required: ["provider", "options"],
|
|
458
|
+
},
|
|
459
|
+
returns: {
|
|
460
|
+
type: "object",
|
|
461
|
+
description: "The embedding response from the AI provider",
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
},
|
|
465
|
+
googleSearch_1.googleSearchDefinition,
|
|
466
|
+
{
|
|
467
|
+
type: "function",
|
|
468
|
+
function: {
|
|
469
|
+
name: "loadWebpage",
|
|
470
|
+
description: "Load a webpage using a stealth browser to avoid bot detection. Can return either text content with console logs or a screenshot.",
|
|
471
|
+
parameters: {
|
|
472
|
+
type: "object",
|
|
473
|
+
positional: true,
|
|
474
|
+
properties: {
|
|
475
|
+
url: {
|
|
476
|
+
type: "string",
|
|
477
|
+
description: "The URL of the webpage to load",
|
|
478
|
+
},
|
|
479
|
+
mode: {
|
|
480
|
+
type: "string",
|
|
481
|
+
description: "The mode for content extraction: 'text' for text content with console logs, 'screenshot' for a base64 encoded screenshot",
|
|
482
|
+
enum: ["text", "screenshot"],
|
|
483
|
+
},
|
|
484
|
+
waitForSelector: {
|
|
485
|
+
type: "string",
|
|
486
|
+
description: "Optional CSS selector to wait for before extracting content",
|
|
487
|
+
},
|
|
488
|
+
timeout: {
|
|
489
|
+
type: "number",
|
|
490
|
+
description: "Timeout in milliseconds for page loading (default: 30000)",
|
|
491
|
+
},
|
|
492
|
+
},
|
|
493
|
+
required: ["url"],
|
|
494
|
+
},
|
|
495
|
+
returns: {
|
|
496
|
+
type: "string",
|
|
497
|
+
description: "The webpage content as text with console logs, or a base64 encoded screenshot",
|
|
498
|
+
},
|
|
499
|
+
},
|
|
500
|
+
},
|
|
501
|
+
...asana.definitions,
|
|
502
|
+
...github.definitions,
|
|
503
|
+
...language.definitions,
|
|
504
|
+
];
|
|
505
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/agents/tools/list.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,mDAAgD;AAEhD,MAAM,WAAW,GAAG,i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E,0HAA0H;wBACvI,IAAI,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC;qBAC7B;oBACD,eAAe,EAAE;wBACf,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,6DAA6D;qBAC3E;oBACD,OAAO,EAAE;wBACP,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,2DAA2D;qBACzE;iBACF;gBACD,QAAQ,EAAE,CAAC,KAAK,CAAC;aAClB;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+EAA+E;aAC7F;SACF;KACF;IACD,GAAG,KAAK,CAAC,WAAW;IACpB,GAAG,MAAM,CAAC,WAAW;IACrB,GAAG,QAAQ,CAAC,WAAW;CACd,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface LoadWebpageOptions {
|
|
2
|
+
url: string;
|
|
3
|
+
mode?: "text" | "screenshot";
|
|
4
|
+
waitForSelector?: string;
|
|
5
|
+
timeout?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function loadWebpage(url: string, mode?: "text" | "screenshot", waitForSelector?: string, timeout?: number): Promise<string>;
|
|
8
|
+
export default loadWebpage;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.loadWebpage = void 0;
|
|
7
|
+
const playwright_extra_1 = require("playwright-extra");
|
|
8
|
+
const puppeteer_extra_plugin_stealth_1 = __importDefault(require("puppeteer-extra-plugin-stealth"));
|
|
9
|
+
async function loadWebpage(url, mode = "text", waitForSelector, timeout = 30000) {
|
|
10
|
+
let browser;
|
|
11
|
+
let page;
|
|
12
|
+
try {
|
|
13
|
+
console.log(`Loading webpage: ${url} in ${mode} mode`);
|
|
14
|
+
playwright_extra_1.chromium.use((0, puppeteer_extra_plugin_stealth_1.default)());
|
|
15
|
+
browser = await playwright_extra_1.chromium.launch({
|
|
16
|
+
headless: true,
|
|
17
|
+
args: [
|
|
18
|
+
"--disable-setuid-sandbox",
|
|
19
|
+
"--disable-dev-shm-usage",
|
|
20
|
+
"--disable-accelerated-2d-canvas",
|
|
21
|
+
"--no-first-run",
|
|
22
|
+
"--no-zygote",
|
|
23
|
+
"--disable-gpu",
|
|
24
|
+
"--disable-blink-features=AutomationControlled",
|
|
25
|
+
process.env.DISABLE_CHROME_SANDBOX === "true" ? "--no-sandbox" : "",
|
|
26
|
+
],
|
|
27
|
+
});
|
|
28
|
+
const context = await browser.newContext({
|
|
29
|
+
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
|
30
|
+
viewport: { width: 1366, height: 768 },
|
|
31
|
+
extraHTTPHeaders: {
|
|
32
|
+
"Accept-Language": "en-US,en;q=0.9",
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
page = await context.newPage();
|
|
36
|
+
const consoleLogs = [];
|
|
37
|
+
if (mode === "text") {
|
|
38
|
+
page.on("console", (msg) => {
|
|
39
|
+
consoleLogs.push(`[${msg.type()}] ${msg.text()}`);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
await page.goto(url, {
|
|
43
|
+
waitUntil: "networkidle",
|
|
44
|
+
timeout,
|
|
45
|
+
});
|
|
46
|
+
if (waitForSelector) {
|
|
47
|
+
await page.waitForSelector(waitForSelector, { timeout });
|
|
48
|
+
}
|
|
49
|
+
let result;
|
|
50
|
+
if (mode === "screenshot") {
|
|
51
|
+
const screenshot = await page.screenshot({
|
|
52
|
+
fullPage: true,
|
|
53
|
+
type: "png",
|
|
54
|
+
});
|
|
55
|
+
const base64Screenshot = screenshot.toString("base64");
|
|
56
|
+
result = `data:image/png;base64,${base64Screenshot}`;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const textContent = await page.evaluate(() => {
|
|
60
|
+
const scripts = document.querySelectorAll("script, style");
|
|
61
|
+
scripts.forEach((el) => el.remove());
|
|
62
|
+
return document.body?.innerText || document.body?.textContent || "";
|
|
63
|
+
});
|
|
64
|
+
const title = await page.title();
|
|
65
|
+
result = `# ${title}\n\n## Page Content:\n${textContent}`;
|
|
66
|
+
if (consoleLogs.length > 0) {
|
|
67
|
+
result += `\n\n## Console Logs:\n${consoleLogs.join("\n")}`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
console.error("Error loading webpage:", error);
|
|
74
|
+
return `Error loading webpage: ${error instanceof Error ? error.message : String(error)}`;
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
if (page) {
|
|
78
|
+
try {
|
|
79
|
+
await page.close();
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
console.warn("Error closing page:", e);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (browser) {
|
|
86
|
+
try {
|
|
87
|
+
await browser.close();
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
console.warn("Error closing browser:", e);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.loadWebpage = loadWebpage;
|
|
96
|
+
exports.default = loadWebpage;
|
|
97
|
+
//# sourceMappingURL=loadWebpage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadWebpage.js","sourceRoot":"","sources":["../../../../src/agents/tools/loadWebpage.ts"],"names":[],"mappings":";;;;;;AAAA,uDAA4C;AAC5C,oGAAqD;AAS9C,KAAK,UAAU,WAAW,CAC/B,GAAW,EACX,OAA8B,MAAM,EACpC,eAAwB,EACxB,UAAkB,KAAK;IAEvB,IAAI,OAAO,CAAC;IACZ,IAAI,IAAI,CAAC;IAET,IAAI;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