@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,43 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import { parseHunks, fixPatch } from "../../src/agents/tools/patch";
|
|
3
|
+
import { applyPatch } from "diff";
|
|
4
|
+
|
|
5
|
+
describe("fixPatch", () => {
|
|
6
|
+
it("should fix patch", async () => {
|
|
7
|
+
const patch = fs.readFileSync(__dirname + "/imports.patch.txt").toString();
|
|
8
|
+
const originalContent = fs
|
|
9
|
+
.readFileSync(__dirname + "/imports.txt")
|
|
10
|
+
.toString();
|
|
11
|
+
const hunks = parseHunks(patch);
|
|
12
|
+
|
|
13
|
+
console.log(hunks);
|
|
14
|
+
expect(hunks.length).toBe(1);
|
|
15
|
+
|
|
16
|
+
expect(hunks[0].newStartLine).toBe(6);
|
|
17
|
+
expect(hunks[0].originalStartLine).toBe(5);
|
|
18
|
+
|
|
19
|
+
const fixedPatch = await fixPatch(originalContent, patch);
|
|
20
|
+
console.log(fixedPatch);
|
|
21
|
+
|
|
22
|
+
const patched = applyPatch(originalContent, fixedPatch);
|
|
23
|
+
console.log("PATCH OUTPUT");
|
|
24
|
+
console.log(patched);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("should patch interface.text", async () => {
|
|
28
|
+
const patch = fs
|
|
29
|
+
.readFileSync(__dirname + "/interface.patch.txt")
|
|
30
|
+
.toString();
|
|
31
|
+
const originalContent = fs
|
|
32
|
+
.readFileSync(__dirname + "/interface.txt")
|
|
33
|
+
.toString();
|
|
34
|
+
|
|
35
|
+
const hunks = parseHunks(patch);
|
|
36
|
+
const fixedPatch = await fixPatch(originalContent, patch);
|
|
37
|
+
console.log(fixedPatch);
|
|
38
|
+
|
|
39
|
+
const patched = applyPatch(originalContent, fixedPatch);
|
|
40
|
+
console.log("PATCH OUTPUT");
|
|
41
|
+
console.log(patched);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { gql, useMutation } from '@apollo/client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Col, Row } from 'react-bootstrap';
|
|
4
|
+
|
|
5
|
+
import InformationTooltip from '~/components/InformationTooltip';
|
|
6
|
+
import Link from '~/components/Link';
|
|
7
|
+
import { NameValueRow, NameValueRowWithBottomBorder } from '~/components/NameValueRow';
|
|
8
|
+
import { BOTTOM_BORDER_CONTAINER_STYLE } from '~/components/NameValueRow/NameValueRowWithBottomBorder';
|
|
9
|
+
import { NotesPopoverWrapper } from '~/components/Notes';
|
|
10
|
+
import { TokenAgreementRowAssetUnion, UpdateTokenAgreement, UpdateTokenAgreementVariables } from '~/generated/schema';
|
|
11
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
--- ./tests/patching/interface.txt
|
|
2
|
+
+++ ./tests/patching/interface.txt
|
|
3
|
+
@@ -3,8 +3,14 @@
|
|
4
|
+
import { Message } from "../clients/types";
|
|
5
|
+
|
|
6
|
+
export interface IAgent {
|
|
7
|
+
+ getModel(): string;
|
|
8
|
+
+ setModel(value: string): void;
|
|
9
|
+
+ getProvider(): string;
|
|
10
|
+
+ setProvider(value: string): void;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
- call: (userInput: string, messages?: Message[]) => Promise<string>;
|
|
14
|
+
+ call: (userInput: string, messages?: Message[]) => Promise<string>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
jest.mock("fs");
|
|
2
|
+
jest.mock("../src/plugins/plugins");
|
|
3
|
+
|
|
4
|
+
import * as fs from "fs";
|
|
5
|
+
import { exec } from "child_process";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
embeddingSearch,
|
|
9
|
+
readFile,
|
|
10
|
+
scanFile,
|
|
11
|
+
modifyFile,
|
|
12
|
+
execCommand,
|
|
13
|
+
writeFile,
|
|
14
|
+
} from "../src/agents/tools";
|
|
15
|
+
import { Plugins } from "../src/plugins/plugins";
|
|
16
|
+
import { patchFile } from "../src/agents/tools/patch";
|
|
17
|
+
|
|
18
|
+
const mockFs = jest.mocked(fs);
|
|
19
|
+
|
|
20
|
+
test("searchFiles should call the embeddings plugin with the correct keyword", async () => {
|
|
21
|
+
const mocked = Plugins as jest.Mocked<typeof Plugins>;
|
|
22
|
+
const keyword = "test";
|
|
23
|
+
const expectedResult = JSON.stringify({ files: ["test1.js", "test2.js"] });
|
|
24
|
+
|
|
25
|
+
// Setting up the plugin to return the expected result
|
|
26
|
+
mocked.call.mockResolvedValue(expectedResult);
|
|
27
|
+
|
|
28
|
+
const result = await embeddingSearch(keyword);
|
|
29
|
+
|
|
30
|
+
// Verifying that the plugin was called with the correct keyword
|
|
31
|
+
expect(Plugins.call).toHaveBeenCalledWith("embeddings", keyword);
|
|
32
|
+
// Verifying that the function returns the expected result
|
|
33
|
+
expect(result).toBe(expectedResult);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test("readFile should return the content of a file", () => {
|
|
37
|
+
const filePath = "test.txt";
|
|
38
|
+
const fileContent = "Hello World";
|
|
39
|
+
|
|
40
|
+
// Mock readFile to return the fileContent
|
|
41
|
+
mockFs.readFileSync.mockReturnValue(fileContent);
|
|
42
|
+
|
|
43
|
+
const result = readFile(filePath);
|
|
44
|
+
|
|
45
|
+
// Verify readFile was called with the correct file path
|
|
46
|
+
expect(fs.readFileSync).toHaveBeenCalledWith(filePath, "utf8");
|
|
47
|
+
// Verify the result matches the fileContent
|
|
48
|
+
expect(result).toBe(JSON.stringify([[1, fileContent]]));
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test("scanFile should return the contents of a specified range of lines from a file", () => {
|
|
52
|
+
const filePath = "test.txt";
|
|
53
|
+
const fileContentLines = ["Line1", "Line2", "Line3", "Line4", "Line5"];
|
|
54
|
+
const startLine = 3;
|
|
55
|
+
const endLine = 3;
|
|
56
|
+
|
|
57
|
+
// Mock fs.readFileSync to return joined fileContentLines
|
|
58
|
+
mockFs.readFileSync.mockReturnValue(fileContentLines.join("\n"));
|
|
59
|
+
|
|
60
|
+
const result = scanFile(filePath, startLine, endLine);
|
|
61
|
+
|
|
62
|
+
// Verify fs.readFileSync was called with the correct file path
|
|
63
|
+
expect(fs.readFileSync).toHaveBeenCalledWith(filePath, "utf8");
|
|
64
|
+
// Verify that the correct range of lines is returned
|
|
65
|
+
expect(result).toBe(
|
|
66
|
+
JSON.stringify([
|
|
67
|
+
[1, "Line1"],
|
|
68
|
+
[2, "Line2"],
|
|
69
|
+
[3, "Line3"],
|
|
70
|
+
[4, "Line4"],
|
|
71
|
+
[5, "Line5"],
|
|
72
|
+
])
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("writeFile should write the full contents to a file", () => {
|
|
77
|
+
const filePath = "testWrite.txt";
|
|
78
|
+
const contentToWrite = "Writing to file";
|
|
79
|
+
|
|
80
|
+
// Mock fs.writeFileSync to not actually write to disk
|
|
81
|
+
mockFs.writeFileSync.mockImplementation(() => {});
|
|
82
|
+
|
|
83
|
+
const result = writeFile(filePath, contentToWrite);
|
|
84
|
+
|
|
85
|
+
// Verify fs.writeFileSync was called with the correct arguments
|
|
86
|
+
expect(fs.writeFileSync).toHaveBeenCalledWith(filePath, contentToWrite);
|
|
87
|
+
// Verify the function returns a success message
|
|
88
|
+
expect(result).toBe(`File ${filePath} written`);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test("applyPatchFile should apply a patch to a file", async () => {
|
|
92
|
+
const filePath = "testPatch.txt";
|
|
93
|
+
const originalContent = "Original content\n";
|
|
94
|
+
const patchedContent = "Patched content\n";
|
|
95
|
+
const patch = "@@ -1,1 +1,1 @@\n-Original content\n+Patched content\n";
|
|
96
|
+
|
|
97
|
+
// Mock fs.readFileSync to return the originalContent
|
|
98
|
+
mockFs.readFileSync.mockReturnValue(originalContent);
|
|
99
|
+
// Mock fs.writeFileSync to not actually write to disk
|
|
100
|
+
mockFs.writeFileSync.mockImplementation(() => {});
|
|
101
|
+
|
|
102
|
+
const result = await patchFile(filePath, patch);
|
|
103
|
+
|
|
104
|
+
// Verify fs.readFileSync was called with the correct file path
|
|
105
|
+
expect(fs.readFileSync).toHaveBeenCalledWith(filePath, "utf8");
|
|
106
|
+
// Verify fs.writeFileSync was called with the corrected content
|
|
107
|
+
expect(fs.writeFileSync).toHaveBeenCalledWith(filePath, patchedContent);
|
|
108
|
+
// Verify the function returns a success message
|
|
109
|
+
expect(result.startsWith("Patch Applied")).toBe(true);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test("execCommand should execute a system command and return its output", async () => {
|
|
113
|
+
const command = 'echo "Hello World"';
|
|
114
|
+
const expectedOutput = "Hello World\n";
|
|
115
|
+
|
|
116
|
+
// Use the execCommand and expect it to return the correct result
|
|
117
|
+
const result = await execCommand(command);
|
|
118
|
+
expect(result).toEqual(expectedOutput);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
test("execCommand should return an error message if the command fails", async () => {
|
|
122
|
+
const command = "exit 1";
|
|
123
|
+
const expectedOutput = "Command failed: exit 1\n";
|
|
124
|
+
|
|
125
|
+
// Use the execCommand and expect it to return the correct result
|
|
126
|
+
const result = await execCommand(command);
|
|
127
|
+
expect(result).toEqual(expectedOutput);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test("it should run a test", () => {
|
|
131
|
+
expect(true).toEqual(true);
|
|
132
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from "events";
|
|
3
|
+
import { GenericClient, Message, Tool, ToolCall } from "../../clients/types";
|
|
4
|
+
import { IAgent } from "../interface";
|
|
5
|
+
import { ToolsService } from "../../services/Tools";
|
|
6
|
+
import { EventService } from "../../services/EventService";
|
|
7
|
+
import { Clients } from "../../clients";
|
|
8
|
+
export { Message, Tool, ToolCall };
|
|
9
|
+
export interface ModelPreference {
|
|
10
|
+
model: string;
|
|
11
|
+
provider: keyof typeof Clients.clients;
|
|
12
|
+
}
|
|
13
|
+
export declare abstract class BaseAgent implements IAgent {
|
|
14
|
+
tools: ToolsService;
|
|
15
|
+
events: EventService;
|
|
16
|
+
abstract name: string;
|
|
17
|
+
abstract description: string;
|
|
18
|
+
private status;
|
|
19
|
+
private lastHealthCheckTime;
|
|
20
|
+
protected provider: string;
|
|
21
|
+
protected modelName: string;
|
|
22
|
+
protected client: null | GenericClient;
|
|
23
|
+
protected modelPreferences: ModelPreference[];
|
|
24
|
+
protected currentModelPreferenceIndex: number;
|
|
25
|
+
protected easyFinalAnswer: boolean;
|
|
26
|
+
protected requiredToolNames: string[];
|
|
27
|
+
protected totalCostUsd: number;
|
|
28
|
+
protected currentThread: number;
|
|
29
|
+
protected threads: Message[][];
|
|
30
|
+
protected pendingUserMessages: Message[];
|
|
31
|
+
protected taskBreakdown: string;
|
|
32
|
+
protected summaries: string[];
|
|
33
|
+
agentEvents: EventEmitter<[never]>;
|
|
34
|
+
eventTypes: {
|
|
35
|
+
newThread: string;
|
|
36
|
+
threadUpdate: string;
|
|
37
|
+
costUpdate: string;
|
|
38
|
+
toolUsed: string;
|
|
39
|
+
done: string;
|
|
40
|
+
pause: string;
|
|
41
|
+
kill: string;
|
|
42
|
+
unpause: string;
|
|
43
|
+
};
|
|
44
|
+
disabledTools: any[];
|
|
45
|
+
constructor(tools?: ToolsService, events?: EventService);
|
|
46
|
+
newTask(): void;
|
|
47
|
+
register(): void;
|
|
48
|
+
setModelPreferences(value: ModelPreference[]): void;
|
|
49
|
+
updatePreferences(value: ModelPreference): void;
|
|
50
|
+
nextModel(): void;
|
|
51
|
+
getModel(): string;
|
|
52
|
+
setModel(value: string): void;
|
|
53
|
+
getProvider(): string;
|
|
54
|
+
setProvider(value: keyof typeof Clients.clients): void;
|
|
55
|
+
getClient(): GenericClient;
|
|
56
|
+
setClient(client: GenericClient): void;
|
|
57
|
+
setEasyFinalAnswer(value: boolean): void;
|
|
58
|
+
getEnabledTools(): Tool[];
|
|
59
|
+
getEnabledToolNames(): string[];
|
|
60
|
+
disableTool(toolName: string): void;
|
|
61
|
+
isToolEnabled(toolName: string): boolean;
|
|
62
|
+
enableTool(toolName: string): void;
|
|
63
|
+
adjustTotalCostUsd(cost: number): void;
|
|
64
|
+
getTotalCostUsd(): number;
|
|
65
|
+
startNewThread(messages: Message[]): void;
|
|
66
|
+
updateCurrentThread(messages: Message[]): void;
|
|
67
|
+
getThreads(): Message[][];
|
|
68
|
+
getSummaries(): string[];
|
|
69
|
+
abstract getInitialMessages(userInput: string): Promise<Message[]>;
|
|
70
|
+
processToolMessages(toolCall: ToolCall): Promise<any[]>;
|
|
71
|
+
logMessages(messages: Message[]): void;
|
|
72
|
+
formatInputContent(userInput: string): string;
|
|
73
|
+
formatAiResponse(response: string): string;
|
|
74
|
+
formatInputMessages(messages: Message[]): Message[];
|
|
75
|
+
formatOutputMessages(messages: Message[]): Message[];
|
|
76
|
+
healthCheck(): Promise<boolean>;
|
|
77
|
+
selectHealthyModel(): Promise<void>;
|
|
78
|
+
setNotHealthy(): void;
|
|
79
|
+
pause(): void;
|
|
80
|
+
unpause(): void;
|
|
81
|
+
unpaused(): Promise<unknown>;
|
|
82
|
+
kill(): Promise<void>;
|
|
83
|
+
call(userInput: string, _messages?: Message[]): any;
|
|
84
|
+
addPendingUserMessage(message: Message): void;
|
|
85
|
+
getMessagesLength(messages: Message[]): number;
|
|
86
|
+
getTaskBreakdown(messages: Message[]): Promise<string>;
|
|
87
|
+
compressMessages(messages: Message[], startIndex: number, endIndex: number): Promise<Message[]>;
|
|
88
|
+
}
|