@tyvm/knowhow 0.0.32 โ 0.0.34
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/autodoc/plugins/downloader/downloader.mdx +2 -2
- package/benchmarks/.dockerignore +7 -0
- package/benchmarks/README.md +166 -0
- package/benchmarks/docker/Dockerfile +68 -0
- package/benchmarks/example-config.yml +27 -0
- package/benchmarks/jest.config.js +13 -0
- package/benchmarks/package-lock.json +4297 -0
- package/benchmarks/package.json +39 -0
- package/benchmarks/results/4542435/2025-08-05/lms/lms-openai-gpt-oss-20b.json +2814 -0
- package/benchmarks/results/4542435/2025-08-05/lms/lms-qwen-qwen3-30b-a3b-2507.json +2014 -0
- package/benchmarks/results/4fb9125/2025-08-07/anthropic/anthropic-claude-sonnet-4-20250514.json +3121 -0
- package/benchmarks/results/5766aee/2025-08-02/lms-qwen/qwen3-coder-30b.json +98 -0
- package/benchmarks/results/6d73808/2025-08-07/openai/openai-gpt-5.json +3256 -0
- package/benchmarks/results/77bf0a6/2025-08-02/lms-qwen/qwen3-30b-a3b-2507.json +4298 -0
- package/benchmarks/results/8c0d445/2025-08-03/anthropic/anthropic-claude-sonnet-4-20250514.json +3031 -0
- package/benchmarks/results/8c0d445/2025-08-03/openai/openai-gpt-4.1-2025-04-14.json +2990 -0
- package/benchmarks/results/ac6b2ab/2025-08-03/anthropic/anthropic-claude-sonnet-4-20250514.json +3256 -0
- package/benchmarks/results/ac6b2ab/2025-08-03/lms/lms-qwen-qwen3-coder-30b.json +3007 -0
- package/benchmarks/results/ac6b2ab/2025-08-03/openai/openai-gpt-4.1-2025-04-14.json +3256 -0
- package/benchmarks/results/ac6b2ab/2025-08-03/openai/openai-gpt-4.1-mini-2025-04-14.json +3036 -0
- package/benchmarks/results/ac6b2ab/2025-08-03/openai/openai-gpt-4.1-nano-2025-04-14.json +3280 -0
- package/benchmarks/results/adff675/2025-08-04/lms/lms-qwen-qwen3-30b-a3b-2507.json +1920 -0
- package/benchmarks/results/adff675/2025-08-04/lms/lms-qwen-qwen3-coder-30b.json +3281 -0
- package/benchmarks/results/b502ed9/2025-08-03/lms-qwen/qwen3-coder-30b.json +2896 -0
- package/benchmarks/results/d1a8129/2025-08-03/lms/lms-qwen-qwen3-coder-30b.json +3011 -0
- package/benchmarks/results/e60471c/2025-08-03/lms/qwen3-30b-a3b-2507.json +3003 -0
- package/benchmarks/scripts/build-and-run.sh +47 -0
- package/benchmarks/scripts/clone-exercism.sh +92 -0
- package/benchmarks/scripts/validate.sh +48 -0
- package/benchmarks/src/__tests__/runner.test.ts +27 -0
- package/benchmarks/src/cli.ts +90 -0
- package/benchmarks/src/evaluators/EvaluatorRegistry.ts +64 -0
- package/benchmarks/src/evaluators/JavaScriptEvaluator.ts +183 -0
- package/benchmarks/src/evaluators/index.ts +3 -0
- package/benchmarks/src/evaluators/types.ts +22 -0
- package/benchmarks/src/index.ts +3 -0
- package/benchmarks/src/providers.ts +13 -0
- package/benchmarks/src/runner.ts +824 -0
- package/benchmarks/src/types.ts +63 -0
- package/benchmarks/tsconfig.json +19 -0
- package/jest.config.js +2 -1
- package/leaderboard/README.md +148 -0
- package/leaderboard/app/api/benchmark-data/route.ts +131 -0
- package/leaderboard/app/api/benchmark-detail/route.ts +172 -0
- package/leaderboard/app/details/[model]/[provider]/[language]/page.tsx +501 -0
- package/leaderboard/app/exercise/[model]/[provider]/[language]/[exercise]/page.tsx +375 -0
- package/leaderboard/app/globals.css +27 -0
- package/leaderboard/app/layout.tsx +21 -0
- package/leaderboard/app/page.tsx +170 -0
- package/leaderboard/components/LeaderboardTable.tsx +168 -0
- package/leaderboard/components/PerformanceChart.tsx +109 -0
- package/leaderboard/next-env.d.ts +5 -0
- package/leaderboard/next.config.js +4 -0
- package/leaderboard/package-lock.json +6363 -0
- package/leaderboard/package.json +28 -0
- package/leaderboard/postcss.config.js +6 -0
- package/leaderboard/tailwind.config.js +17 -0
- package/leaderboard/tsconfig.json +28 -0
- package/leaderboard/types/benchmark.ts +67 -0
- package/leaderboard/utils/dataProcessor.ts +33 -0
- package/package.json +2 -1
- package/src/agents/base/base.ts +147 -21
- package/src/agents/base/prompt.ts +28 -0
- package/src/agents/index.ts +3 -0
- package/src/agents/patcher/patcher.ts +6 -4
- package/src/agents/setup/setup.ts +56 -0
- package/src/agents/tools/agentCall.ts +6 -2
- package/src/agents/tools/aiClient.ts +74 -8
- package/src/agents/tools/execCommand.ts +13 -14
- package/src/agents/tools/executeScript/README.md +16 -0
- package/src/agents/tools/index.ts +2 -0
- package/src/agents/tools/list.ts +73 -16
- package/src/agents/tools/startAgentTask.ts +109 -0
- package/src/agents/tools/textSearch.ts +1 -1
- package/src/agents/tools/visionTool.ts +31 -2
- package/src/agents/tools/ycmd/client.ts +608 -0
- package/src/agents/tools/ycmd/definitions.ts +294 -0
- package/src/agents/tools/ycmd/detection.ts +211 -0
- package/src/agents/tools/ycmd/index.ts +11 -0
- package/src/agents/tools/ycmd/installer.ts +251 -0
- package/src/agents/tools/ycmd/server.ts +535 -0
- package/src/agents/tools/ycmd/serverManager.ts +316 -0
- package/src/agents/tools/ycmd/tools/completion.ts +113 -0
- package/src/agents/tools/ycmd/tools/diagnostics.ts +155 -0
- package/src/agents/tools/ycmd/tools/getLocations.ts +173 -0
- package/src/agents/tools/ycmd/tools/goto.ts +169 -0
- package/src/agents/tools/ycmd/tools/refactor.ts +204 -0
- package/src/agents/tools/ycmd/tools/signature.ts +174 -0
- package/src/agents/tools/ycmd/tools/start.ts +95 -0
- package/src/agents/tools/ycmd/utils/pathUtils.ts +59 -0
- package/src/ai.ts +15 -0
- package/src/chat/CliChatService.ts +277 -0
- package/src/chat/modules/AgentModule.ts +980 -0
- package/src/chat/modules/AskModule.ts +98 -0
- package/src/chat/modules/BaseChatModule.ts +66 -0
- package/src/chat/modules/InternalChatModule.ts +174 -0
- package/src/chat/modules/SearchModule.ts +166 -0
- package/src/chat/modules/SetupModule.ts +185 -0
- package/src/chat/modules/SystemModule.ts +120 -0
- package/src/chat/modules/VoiceModule.ts +70 -0
- package/src/chat/modules/index.js +5 -0
- package/src/chat/types.ts +97 -0
- package/src/chat.ts +9 -1
- package/src/chat2.ts +62 -0
- package/src/cli.ts +264 -35
- package/src/clients/anthropic.ts +14 -7
- package/src/clients/gemini.ts +15 -7
- package/src/clients/http.ts +17 -7
- package/src/clients/index.ts +117 -4
- package/src/clients/knowhow.ts +7 -2
- package/src/clients/knowhowMcp.ts +118 -0
- package/src/clients/openai.ts +32 -8
- package/src/clients/types.ts +1 -0
- package/src/clients/xai.ts +17 -5
- package/src/config.ts +30 -5
- package/src/conversion.ts +4 -1
- package/src/embeddings.ts +79 -23
- package/src/login.ts +26 -9
- package/src/microphone.ts +0 -1
- package/src/plugins/downloader/downloader.ts +72 -24
- package/src/plugins/downloader/plugin.ts +3 -1
- package/src/plugins/plugins.ts +3 -0
- package/src/processors/CustomVariables.ts +425 -0
- package/src/processors/HarmonyToolProcessor.ts +264 -0
- package/src/processors/XmlToolCallProcessor.ts +533 -0
- package/src/processors/index.ts +3 -0
- package/src/prompts/KnowhowConfigExamples.ts +376 -0
- package/src/services/KnowhowClient.ts +49 -3
- package/src/services/Mcp.ts +42 -3
- package/src/services/McpServer.ts +14 -4
- package/src/services/McpWebsocketTransport.ts +21 -7
- package/src/services/MessageProcessor.ts +10 -5
- package/src/services/index.ts +5 -0
- package/src/services/script-execution/ScriptExecutor.ts +34 -1
- package/src/services/types.ts +17 -14
- package/src/types.ts +17 -0
- package/src/utils/index.ts +138 -0
- package/tests/XmlToolCallProcessor.test.ts +468 -0
- package/tests/manual/ycmd/debug_diagnostics_test.ts +127 -0
- package/tests/manual/ycmd/fixtures/debug_diagnostics.ts +26 -0
- package/tests/manual/ycmd/fixtures/file_change_test.ts +17 -0
- package/tests/manual/ycmd/minimal_advanced_test.ts +108 -0
- package/tests/manual/ycmd/simple_diagnostics_test.ts +61 -0
- package/tests/manual/ycmd/simple_test.ts +74 -0
- package/tests/manual/ycmd/test-typescript-sample.ts +34 -0
- package/tests/manual/ycmd/test_advanced_features.ts +407 -0
- package/tests/manual/ycmd/test_advanced_with_tools.ts +320 -0
- package/tests/manual/ycmd/test_comprehensive_typescript.ts +179 -0
- package/tests/manual/ycmd/test_diagnostics_file_changes.ts +249 -0
- package/tests/manual/ycmd/test_diagnostics_fix.ts +99 -0
- package/tests/manual/ycmd/test_diagnostics_simple.ts +100 -0
- package/tests/manual/ycmd/test_diagnostics_timing.ts +120 -0
- package/tests/manual/ycmd/test_discover_commands.ts +310 -0
- package/tests/manual/ycmd/test_endpoints.ts +115 -0
- package/tests/manual/ycmd/test_final_comprehensive.ts +218 -0
- package/tests/manual/ycmd/test_final_validation.ts +150 -0
- package/tests/manual/ycmd/test_implementation.js +42 -0
- package/tests/manual/ycmd/test_individual_ycmd_tool.ts +39 -0
- package/tests/manual/ycmd/test_server_manager.ts +52 -0
- package/tests/manual/ycmd/test_simple_debug.ts +86 -0
- package/tests/manual/ycmd/test_tsserver_workflow.js +83 -0
- package/tests/manual/ycmd/test_tsserver_workflow.ts +122 -0
- package/tests/manual/ycmd/test_typescript_simple.ts +48 -0
- package/tests/manual/ycmd/test_typescript_ycmd.ts +105 -0
- package/tests/manual/ycmd/test_workspace_config.ts +90 -0
- package/tests/manual/ycmd/test_ycmd_auto_start.ts +137 -0
- package/tests/manual/ycmd/test_ycmd_comprehensive.ts +73 -0
- package/tests/manual/ycmd/test_ycmd_connection.py +10 -0
- package/tests/manual/ycmd/test_ycmd_direct.ts +142 -0
- package/tests/manual/ycmd/test_ycmd_experiment.ts +48 -0
- package/tests/manual/ycmd/test_ycmd_final.ts +200 -0
- package/tests/manual/ycmd/test_ycmd_fixed.py +18 -0
- package/tests/manual/ycmd/test_ycmd_integration.ts +112 -0
- package/tests/manual/ycmd/test_ycmd_simple.ts +45 -0
- package/tests/manual/ycmd/test_ycmd_usage.py +27 -0
- package/tests/manual/ycmd/working_simple_test.ts +134 -0
- package/ts_build/src/agents/base/base.d.ts +14 -1
- package/ts_build/src/agents/base/base.js +91 -17
- package/ts_build/src/agents/base/base.js.map +1 -1
- package/ts_build/src/agents/base/prompt.d.ts +1 -1
- package/ts_build/src/agents/base/prompt.js +28 -0
- package/ts_build/src/agents/base/prompt.js.map +1 -1
- package/ts_build/src/agents/index.d.ts +2 -0
- package/ts_build/src/agents/index.js +2 -0
- package/ts_build/src/agents/index.js.map +1 -1
- package/ts_build/src/agents/patcher/patcher.js +6 -3
- package/ts_build/src/agents/patcher/patcher.js.map +1 -1
- package/ts_build/src/agents/setup/setup.d.ts +8 -0
- package/ts_build/src/agents/setup/setup.js +59 -0
- package/ts_build/src/agents/setup/setup.js.map +1 -0
- package/ts_build/src/agents/tools/agentCall.js +5 -2
- package/ts_build/src/agents/tools/agentCall.js.map +1 -1
- package/ts_build/src/agents/tools/aiClient.d.ts +6 -5
- package/ts_build/src/agents/tools/aiClient.js +37 -6
- package/ts_build/src/agents/tools/aiClient.js.map +1 -1
- package/ts_build/src/agents/tools/execCommand.d.ts +2 -2
- package/ts_build/src/agents/tools/execCommand.js +5 -6
- package/ts_build/src/agents/tools/execCommand.js.map +1 -1
- package/ts_build/src/agents/tools/executeScript/index.d.ts +1 -1
- package/ts_build/src/agents/tools/index.d.ts +2 -0
- package/ts_build/src/agents/tools/index.js +2 -0
- package/ts_build/src/agents/tools/index.js.map +1 -1
- package/ts_build/src/agents/tools/list.js +66 -16
- package/ts_build/src/agents/tools/list.js.map +1 -1
- package/ts_build/src/agents/tools/startAgentTask.d.ts +13 -0
- package/ts_build/src/agents/tools/startAgentTask.js +74 -0
- package/ts_build/src/agents/tools/startAgentTask.js.map +1 -0
- package/ts_build/src/agents/tools/startChatTask.d.ts +13 -0
- package/ts_build/src/agents/tools/startChatTask.js +73 -0
- package/ts_build/src/agents/tools/startChatTask.js.map +1 -0
- package/ts_build/src/agents/tools/textSearch.js +1 -1
- package/ts_build/src/agents/tools/textSearch.js.map +1 -1
- package/ts_build/src/agents/tools/visionTool.d.ts +1 -1
- package/ts_build/src/agents/tools/visionTool.js +23 -3
- package/ts_build/src/agents/tools/visionTool.js.map +1 -1
- package/ts_build/src/agents/tools/ycmd/client.d.ts +93 -0
- package/ts_build/src/agents/tools/ycmd/client.js +355 -0
- package/ts_build/src/agents/tools/ycmd/client.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/definitions.d.ts +345 -0
- package/ts_build/src/agents/tools/ycmd/definitions.js +298 -0
- package/ts_build/src/agents/tools/ycmd/definitions.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/detection.d.ts +11 -0
- package/ts_build/src/agents/tools/ycmd/detection.js +175 -0
- package/ts_build/src/agents/tools/ycmd/detection.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/index.d.ts +8 -0
- package/ts_build/src/agents/tools/ycmd/index.js +20 -0
- package/ts_build/src/agents/tools/ycmd/index.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/installer.d.ts +19 -0
- package/ts_build/src/agents/tools/ycmd/installer.js +196 -0
- package/ts_build/src/agents/tools/ycmd/installer.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/server.d.ts +35 -0
- package/ts_build/src/agents/tools/ycmd/server.js +363 -0
- package/ts_build/src/agents/tools/ycmd/server.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/serverManager.d.ts +39 -0
- package/ts_build/src/agents/tools/ycmd/serverManager.js +210 -0
- package/ts_build/src/agents/tools/ycmd/serverManager.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/tools/completion.d.ts +22 -0
- package/ts_build/src/agents/tools/ycmd/tools/completion.js +72 -0
- package/ts_build/src/agents/tools/ycmd/tools/completion.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/tools/diagnostics.d.ts +42 -0
- package/ts_build/src/agents/tools/ycmd/tools/diagnostics.js +88 -0
- package/ts_build/src/agents/tools/ycmd/tools/diagnostics.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/tools/getLocations.d.ts +22 -0
- package/ts_build/src/agents/tools/ycmd/tools/getLocations.js +142 -0
- package/ts_build/src/agents/tools/ycmd/tools/getLocations.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/tools/goto.d.ts +20 -0
- package/ts_build/src/agents/tools/ycmd/tools/goto.js +101 -0
- package/ts_build/src/agents/tools/ycmd/tools/goto.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/tools/refactor.d.ts +32 -0
- package/ts_build/src/agents/tools/ycmd/tools/refactor.js +123 -0
- package/ts_build/src/agents/tools/ycmd/tools/refactor.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/tools/signature.d.ts +25 -0
- package/ts_build/src/agents/tools/ycmd/tools/signature.js +110 -0
- package/ts_build/src/agents/tools/ycmd/tools/signature.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/tools/start.d.ts +17 -0
- package/ts_build/src/agents/tools/ycmd/tools/start.js +65 -0
- package/ts_build/src/agents/tools/ycmd/tools/start.js.map +1 -0
- package/ts_build/src/agents/tools/ycmd/utils/pathUtils.d.ts +4 -0
- package/ts_build/src/agents/tools/ycmd/utils/pathUtils.js +67 -0
- package/ts_build/src/agents/tools/ycmd/utils/pathUtils.js.map +1 -0
- package/ts_build/src/ai.d.ts +1 -0
- package/ts_build/src/ai.js +40 -1
- package/ts_build/src/ai.js.map +1 -1
- package/ts_build/src/chat/ChatCommandHandler.d.ts +36 -0
- package/ts_build/src/chat/ChatCommandHandler.js +268 -0
- package/ts_build/src/chat/ChatCommandHandler.js.map +1 -0
- package/ts_build/src/chat/ChatInputManager.d.ts +22 -0
- package/ts_build/src/chat/ChatInputManager.js +85 -0
- package/ts_build/src/chat/ChatInputManager.js.map +1 -0
- package/ts_build/src/chat/ChatManager.d.ts +49 -0
- package/ts_build/src/chat/ChatManager.js +271 -0
- package/ts_build/src/chat/ChatManager.js.map +1 -0
- package/ts_build/src/chat/ChatSession.d.ts +32 -0
- package/ts_build/src/chat/ChatSession.js +3 -0
- package/ts_build/src/chat/ChatSession.js.map +1 -0
- package/ts_build/src/chat/ChatSessionManager.d.ts +19 -0
- package/ts_build/src/chat/ChatSessionManager.js +188 -0
- package/ts_build/src/chat/ChatSessionManager.js.map +1 -0
- package/ts_build/src/chat/ChatStateManager.d.ts +58 -0
- package/ts_build/src/chat/ChatStateManager.js +156 -0
- package/ts_build/src/chat/ChatStateManager.js.map +1 -0
- package/ts_build/src/chat/CliChatService.d.ts +35 -0
- package/ts_build/src/chat/CliChatService.js +201 -0
- package/ts_build/src/chat/CliChatService.js.map +1 -0
- package/ts_build/src/chat/InterruptibleInput.d.ts +20 -0
- package/ts_build/src/chat/InterruptibleInput.js +109 -0
- package/ts_build/src/chat/InterruptibleInput.js.map +1 -0
- package/ts_build/src/chat/interfaces/ChatModule.d.ts +6 -0
- package/ts_build/src/chat/interfaces/ChatModule.js +3 -0
- package/ts_build/src/chat/interfaces/ChatModule.js.map +1 -0
- package/ts_build/src/chat/modules/AgentModule.d.ts +56 -0
- package/ts_build/src/chat/modules/AgentModule.js +705 -0
- package/ts_build/src/chat/modules/AgentModule.js.map +1 -0
- package/ts_build/src/chat/modules/AskModule.d.ts +10 -0
- package/ts_build/src/chat/modules/AskModule.js +63 -0
- package/ts_build/src/chat/modules/AskModule.js.map +1 -0
- package/ts_build/src/chat/modules/BaseChatModule.d.ts +14 -0
- package/ts_build/src/chat/modules/BaseChatModule.js +32 -0
- package/ts_build/src/chat/modules/BaseChatModule.js.map +1 -0
- package/ts_build/src/chat/modules/InternalChatModule.d.ts +24 -0
- package/ts_build/src/chat/modules/InternalChatModule.js +127 -0
- package/ts_build/src/chat/modules/InternalChatModule.js.map +1 -0
- package/ts_build/src/chat/modules/SearchModule.d.ts +12 -0
- package/ts_build/src/chat/modules/SearchModule.js +119 -0
- package/ts_build/src/chat/modules/SearchModule.js.map +1 -0
- package/ts_build/src/chat/modules/SetupModule.d.ts +15 -0
- package/ts_build/src/chat/modules/SetupModule.js +147 -0
- package/ts_build/src/chat/modules/SetupModule.js.map +1 -0
- package/ts_build/src/chat/modules/SystemModule.d.ts +14 -0
- package/ts_build/src/chat/modules/SystemModule.js +90 -0
- package/ts_build/src/chat/modules/SystemModule.js.map +1 -0
- package/ts_build/src/chat/modules/VoiceModule.d.ts +11 -0
- package/ts_build/src/chat/modules/VoiceModule.js +57 -0
- package/ts_build/src/chat/modules/VoiceModule.js.map +1 -0
- package/ts_build/src/chat/types.d.ts +83 -0
- package/ts_build/src/chat/types.js +3 -0
- package/ts_build/src/chat/types.js.map +1 -0
- package/ts_build/src/chat.js +7 -1
- package/ts_build/src/chat.js.map +1 -1
- package/ts_build/src/chat2.d.ts +3 -0
- package/ts_build/src/chat2.js +47 -0
- package/ts_build/src/chat2.js.map +1 -0
- package/ts_build/src/cli.js +218 -37
- package/ts_build/src/cli.js.map +1 -1
- package/ts_build/src/clients/anthropic.d.ts +5 -2
- package/ts_build/src/clients/anthropic.js +12 -7
- package/ts_build/src/clients/anthropic.js.map +1 -1
- package/ts_build/src/clients/gemini.d.ts +6 -3
- package/ts_build/src/clients/gemini.js +13 -7
- package/ts_build/src/clients/gemini.js.map +1 -1
- package/ts_build/src/clients/http.d.ts +1 -0
- package/ts_build/src/clients/http.js +12 -5
- package/ts_build/src/clients/http.js.map +1 -1
- package/ts_build/src/clients/index.d.ts +10 -0
- package/ts_build/src/clients/index.js +74 -4
- package/ts_build/src/clients/index.js.map +1 -1
- package/ts_build/src/clients/knowhow.d.ts +3 -1
- package/ts_build/src/clients/knowhow.js +8 -2
- package/ts_build/src/clients/knowhow.js.map +1 -1
- package/ts_build/src/clients/knowhowMcp.d.ts +20 -0
- package/ts_build/src/clients/knowhowMcp.js +86 -0
- package/ts_build/src/clients/knowhowMcp.js.map +1 -0
- package/ts_build/src/clients/openai.d.ts +5 -2
- package/ts_build/src/clients/openai.js +29 -8
- package/ts_build/src/clients/openai.js.map +1 -1
- package/ts_build/src/clients/types.d.ts +1 -0
- package/ts_build/src/clients/xai.d.ts +5 -2
- package/ts_build/src/clients/xai.js +15 -5
- package/ts_build/src/clients/xai.js.map +1 -1
- package/ts_build/src/config.js +24 -3
- package/ts_build/src/config.js.map +1 -1
- package/ts_build/src/conversion.js +6 -4
- package/ts_build/src/conversion.js.map +1 -1
- package/ts_build/src/embeddings.d.ts +2 -1
- package/ts_build/src/embeddings.js +62 -17
- package/ts_build/src/embeddings.js.map +1 -1
- package/ts_build/src/login.d.ts +1 -1
- package/ts_build/src/login.js +21 -7
- package/ts_build/src/login.js.map +1 -1
- package/ts_build/src/microphone.js.map +1 -1
- package/ts_build/src/plugins/downloader/downloader.d.ts +4 -5
- package/ts_build/src/plugins/downloader/downloader.js +55 -26
- package/ts_build/src/plugins/downloader/downloader.js.map +1 -1
- package/ts_build/src/plugins/downloader/plugin.js +5 -3
- package/ts_build/src/plugins/downloader/plugin.js.map +1 -1
- package/ts_build/src/plugins/plugins.js +3 -0
- package/ts_build/src/plugins/plugins.js.map +1 -1
- package/ts_build/src/processors/CustomVariables.d.ts +32 -0
- package/ts_build/src/processors/CustomVariables.js +297 -0
- package/ts_build/src/processors/CustomVariables.js.map +1 -0
- package/ts_build/src/processors/HarmonyToolProcessor.d.ts +15 -0
- package/ts_build/src/processors/HarmonyToolProcessor.js +154 -0
- package/ts_build/src/processors/HarmonyToolProcessor.js.map +1 -0
- package/ts_build/src/processors/XmlToolCallProcessor.d.ts +14 -0
- package/ts_build/src/processors/XmlToolCallProcessor.js +357 -0
- package/ts_build/src/processors/XmlToolCallProcessor.js.map +1 -0
- package/ts_build/src/processors/index.d.ts +3 -0
- package/ts_build/src/processors/index.js +7 -1
- package/ts_build/src/processors/index.js.map +1 -1
- package/ts_build/src/prompts/KnowhowConfigExamples.d.ts +2 -0
- package/ts_build/src/prompts/KnowhowConfigExamples.js +379 -0
- package/ts_build/src/prompts/KnowhowConfigExamples.js.map +1 -0
- package/ts_build/src/services/KnowhowClient.d.ts +22 -0
- package/ts_build/src/services/KnowhowClient.js +14 -2
- package/ts_build/src/services/KnowhowClient.js.map +1 -1
- package/ts_build/src/services/Mcp.d.ts +1 -0
- package/ts_build/src/services/Mcp.js +20 -3
- package/ts_build/src/services/Mcp.js.map +1 -1
- package/ts_build/src/services/McpServer.d.ts +1 -1
- package/ts_build/src/services/McpServer.js +8 -4
- package/ts_build/src/services/McpServer.js.map +1 -1
- package/ts_build/src/services/McpWebsocketTransport.js +17 -7
- package/ts_build/src/services/McpWebsocketTransport.js.map +1 -1
- package/ts_build/src/services/MessageProcessor.d.ts +1 -1
- package/ts_build/src/services/MessageProcessor.js +4 -4
- package/ts_build/src/services/MessageProcessor.js.map +1 -1
- package/ts_build/src/services/index.d.ts +2 -0
- package/ts_build/src/services/index.js +4 -0
- package/ts_build/src/services/index.js.map +1 -1
- package/ts_build/src/services/script-execution/ScriptExecutor.d.ts +1 -0
- package/ts_build/src/services/script-execution/ScriptExecutor.js +23 -0
- package/ts_build/src/services/script-execution/ScriptExecutor.js.map +1 -1
- package/ts_build/src/services/types.d.ts +2 -6
- package/ts_build/src/services/types.js +4 -4
- package/ts_build/src/services/types.js.map +1 -1
- package/ts_build/src/types.d.ts +11 -0
- package/ts_build/src/types.js +8 -0
- package/ts_build/src/types.js.map +1 -1
- package/ts_build/src/utils/index.d.ts +2 -0
- package/ts_build/src/utils/index.js +102 -1
- package/ts_build/src/utils/index.js.map +1 -1
- package/ts_build/tests/XmlToolCallProcessor.test.d.ts +1 -0
- package/ts_build/tests/XmlToolCallProcessor.test.js +376 -0
- package/ts_build/tests/XmlToolCallProcessor.test.js.map +1 -0
- package/ts_build/tests/manual/ycmd/debug_diagnostics_test.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/debug_diagnostics_test.js +114 -0
- package/ts_build/tests/manual/ycmd/debug_diagnostics_test.js.map +1 -0
- package/ts_build/tests/manual/ycmd/minimal_advanced_test.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/minimal_advanced_test.js +104 -0
- package/ts_build/tests/manual/ycmd/minimal_advanced_test.js.map +1 -0
- package/ts_build/tests/manual/ycmd/simple_diagnostics_test.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/simple_diagnostics_test.js +74 -0
- package/ts_build/tests/manual/ycmd/simple_diagnostics_test.js.map +1 -0
- package/ts_build/tests/manual/ycmd/simple_test.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/simple_test.js +82 -0
- package/ts_build/tests/manual/ycmd/simple_test.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test-typescript-sample.d.ts +14 -0
- package/ts_build/tests/manual/ycmd/test-typescript-sample.js +20 -0
- package/ts_build/tests/manual/ycmd/test-typescript-sample.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_advanced_features.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_advanced_features.js +297 -0
- package/ts_build/tests/manual/ycmd/test_advanced_features.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_advanced_with_tools.d.ts +3 -0
- package/ts_build/tests/manual/ycmd/test_advanced_with_tools.js +262 -0
- package/ts_build/tests/manual/ycmd/test_advanced_with_tools.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_comprehensive_typescript.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_comprehensive_typescript.js +186 -0
- package/ts_build/tests/manual/ycmd/test_comprehensive_typescript.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_file_changes.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_file_changes.js +174 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_file_changes.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_fix.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_fix.js +106 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_fix.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_simple.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_simple.js +104 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_simple.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_timing.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_timing.js +119 -0
- package/ts_build/tests/manual/ycmd/test_diagnostics_timing.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_discover_commands.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_discover_commands.js +243 -0
- package/ts_build/tests/manual/ycmd/test_discover_commands.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_endpoints.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_endpoints.js +120 -0
- package/ts_build/tests/manual/ycmd/test_endpoints.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_final_comprehensive.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_final_comprehensive.js +221 -0
- package/ts_build/tests/manual/ycmd/test_final_comprehensive.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_final_validation.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_final_validation.js +160 -0
- package/ts_build/tests/manual/ycmd/test_final_validation.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_individual_ycmd_tool.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_individual_ycmd_tool.js +37 -0
- package/ts_build/tests/manual/ycmd/test_individual_ycmd_tool.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_server_manager.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_server_manager.js +38 -0
- package/ts_build/tests/manual/ycmd/test_server_manager.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_simple_debug.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_simple_debug.js +99 -0
- package/ts_build/tests/manual/ycmd/test_simple_debug.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_tsserver_workflow.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_tsserver_workflow.js +128 -0
- package/ts_build/tests/manual/ycmd/test_tsserver_workflow.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_typescript_simple.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_typescript_simple.js +66 -0
- package/ts_build/tests/manual/ycmd/test_typescript_simple.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_typescript_ycmd.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_typescript_ycmd.js +105 -0
- package/ts_build/tests/manual/ycmd/test_typescript_ycmd.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_workspace_config.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_workspace_config.js +89 -0
- package/ts_build/tests/manual/ycmd/test_workspace_config.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_auto_start.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_auto_start.js +130 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_auto_start.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_comprehensive.d.ts +1 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_comprehensive.js +83 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_comprehensive.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_direct.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_direct.js +149 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_direct.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_experiment.d.ts +15 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_experiment.js +58 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_experiment.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_final.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_final.js +195 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_final.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_integration.d.ts +3 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_integration.js +110 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_integration.js.map +1 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_simple.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_simple.js +36 -0
- package/ts_build/tests/manual/ycmd/test_ycmd_simple.js.map +1 -0
- package/ts_build/tests/manual/ycmd/working_simple_test.d.ts +2 -0
- package/ts_build/tests/manual/ycmd/working_simple_test.js +134 -0
- package/ts_build/tests/manual/ycmd/working_simple_test.js.map +1 -0
- package/tsconfig.json +3 -1
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
#!/usr/bin/env ts-node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Final comprehensive test of ycmd tools with auto-start functionality
|
|
5
|
+
* Tests all tools to ensure they work correctly after the fixes
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { ycmdStart } from '../../../src/agents/tools/ycmd/tools/start';
|
|
9
|
+
import { ycmdCompletion } from '../../../src/agents/tools/ycmd/tools/completion';
|
|
10
|
+
import { ycmdDiagnostics } from '../../../src/agents/tools/ycmd/tools/diagnostics';
|
|
11
|
+
import { ycmdGoTo } from '../../../src/agents/tools/ycmd/tools/goto';
|
|
12
|
+
import { ycmdRefactor } from '../../../src/agents/tools/ycmd/tools/refactor';
|
|
13
|
+
import { ycmdSignatureHelp } from '../../../src/agents/tools/ycmd/tools/signature';
|
|
14
|
+
import { ycmdServerManager } from '../../../src/agents/tools/ycmd/serverManager';
|
|
15
|
+
import * as fs from 'fs';
|
|
16
|
+
import * as path from 'path';
|
|
17
|
+
|
|
18
|
+
async function testYcmdTools() {
|
|
19
|
+
console.log('๐งช Starting comprehensive ycmd tools test...\n');
|
|
20
|
+
|
|
21
|
+
// Create a test Python file
|
|
22
|
+
const testFile = path.resolve('./test_python_example.py');
|
|
23
|
+
const testContent = `def hello_world(name):
|
|
24
|
+
"""A simple greeting function."""
|
|
25
|
+
print(f"Hello, {name}!")
|
|
26
|
+
return f"Hello, {name}!"
|
|
27
|
+
|
|
28
|
+
def calculate_sum(a, b):
|
|
29
|
+
"""Calculate the sum of two numbers."""
|
|
30
|
+
result = a + b
|
|
31
|
+
return result
|
|
32
|
+
|
|
33
|
+
class Calculator:
|
|
34
|
+
def __init__(self):
|
|
35
|
+
self.history = []
|
|
36
|
+
|
|
37
|
+
def add(self, x, y):
|
|
38
|
+
result = x + y
|
|
39
|
+
self.history.append(f"{x} + {y} = {result}")
|
|
40
|
+
return result
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
// Write test file
|
|
45
|
+
await fs.promises.writeFile(testFile, testContent);
|
|
46
|
+
console.log(`๐ Created test file: ${testFile}`);
|
|
47
|
+
|
|
48
|
+
// Stop any existing server to test auto-start
|
|
49
|
+
try {
|
|
50
|
+
await ycmdServerManager.stop();
|
|
51
|
+
console.log('๐ Stopped any existing ycmd server to test auto-start');
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.log('โน๏ธ No existing server to stop');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
console.log('\n=== Testing Auto-Start Functionality ===');
|
|
57
|
+
|
|
58
|
+
// Test 1: Completion with auto-start
|
|
59
|
+
console.log('\n1๏ธโฃ Testing completion with auto-start...');
|
|
60
|
+
const completionResult = await ycmdCompletion({
|
|
61
|
+
filepath: testFile,
|
|
62
|
+
line: 8,
|
|
63
|
+
column: 12,
|
|
64
|
+
contents: testContent
|
|
65
|
+
});
|
|
66
|
+
console.log('โ
Completion result:', completionResult.success ? 'SUCCESS' : 'FAILED');
|
|
67
|
+
if (completionResult.success && completionResult.completions) {
|
|
68
|
+
console.log(` Found ${completionResult.completions.length} completions`);
|
|
69
|
+
}
|
|
70
|
+
if (!completionResult.success) {
|
|
71
|
+
console.log(` Error: ${completionResult.message}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Test 2: Diagnostics
|
|
75
|
+
console.log('\n2๏ธโฃ Testing diagnostics...');
|
|
76
|
+
const diagnosticsResult = await ycmdDiagnostics({
|
|
77
|
+
filepath: testFile,
|
|
78
|
+
fileContents: testContent
|
|
79
|
+
});
|
|
80
|
+
console.log('โ
Diagnostics result:', diagnosticsResult.success ? 'SUCCESS' : 'FAILED');
|
|
81
|
+
if (diagnosticsResult.success && diagnosticsResult.diagnostics) {
|
|
82
|
+
console.log(` Found ${diagnosticsResult.diagnostics.length} diagnostics`);
|
|
83
|
+
}
|
|
84
|
+
if (!diagnosticsResult.success) {
|
|
85
|
+
console.log(` Error: ${diagnosticsResult.message}`);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Test 3: GoTo Definition (using new command format)
|
|
89
|
+
console.log('\n3๏ธโฃ Testing goto definition...');
|
|
90
|
+
const gotoResult = await ycmdGoTo({
|
|
91
|
+
filepath: testFile,
|
|
92
|
+
line: 18,
|
|
93
|
+
column: 25,
|
|
94
|
+
contents: testContent,
|
|
95
|
+
command: 'GoTo'
|
|
96
|
+
});
|
|
97
|
+
console.log('โ
GoTo result:', gotoResult.success ? 'SUCCESS' : 'FAILED');
|
|
98
|
+
if (gotoResult.success && gotoResult.locations) {
|
|
99
|
+
console.log(` Found ${gotoResult.locations.length} locations`);
|
|
100
|
+
}
|
|
101
|
+
if (!gotoResult.success) {
|
|
102
|
+
console.log(` Error: ${gotoResult.message}`);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Test 4: GoTo Declaration
|
|
106
|
+
console.log('\n4๏ธโฃ Testing goto declaration...');
|
|
107
|
+
const gotoDeclarationResult = await ycmdGoTo({
|
|
108
|
+
filepath: testFile,
|
|
109
|
+
line: 18,
|
|
110
|
+
column: 25,
|
|
111
|
+
contents: testContent,
|
|
112
|
+
command: 'GoToDeclaration'
|
|
113
|
+
});
|
|
114
|
+
console.log('โ
GoTo Declaration result:', gotoDeclarationResult.success ? 'SUCCESS' : 'FAILED');
|
|
115
|
+
if (!gotoDeclarationResult.success) {
|
|
116
|
+
console.log(` Error: ${gotoDeclarationResult.message}`);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Test 5: Organize Imports (using fixed parameters)
|
|
120
|
+
console.log('\n5๏ธโฃ Testing organize imports...');
|
|
121
|
+
const organizeImportsResult = await ycmdRefactor({
|
|
122
|
+
filepath: testFile,
|
|
123
|
+
line: 1,
|
|
124
|
+
column: 1,
|
|
125
|
+
contents: testContent,
|
|
126
|
+
command: 'organize_imports'
|
|
127
|
+
});
|
|
128
|
+
console.log('โ
Organize Imports result:', organizeImportsResult.success ? 'SUCCESS' : 'FAILED');
|
|
129
|
+
if (organizeImportsResult.success && organizeImportsResult.result) {
|
|
130
|
+
console.log(` Generated ${organizeImportsResult.result.edits.length} edits`);
|
|
131
|
+
}
|
|
132
|
+
if (!organizeImportsResult.success) {
|
|
133
|
+
console.log(` Error: ${organizeImportsResult.message}`);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Test 6: Signature Help
|
|
137
|
+
console.log('\n6๏ธโฃ Testing signature help...');
|
|
138
|
+
const signatureResult = await ycmdSignatureHelp({
|
|
139
|
+
filepath: testFile,
|
|
140
|
+
line: 3,
|
|
141
|
+
column: 10,
|
|
142
|
+
contents: testContent
|
|
143
|
+
});
|
|
144
|
+
console.log('โ
Signature Help result:', signatureResult.success ? 'SUCCESS' : 'FAILED');
|
|
145
|
+
if (!signatureResult.success) {
|
|
146
|
+
console.log(` Error: ${signatureResult.message}`);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
console.log('\n=== Server Status Check ===');
|
|
150
|
+
const isRunning = await ycmdServerManager.isRunning();
|
|
151
|
+
console.log('๐ฅ๏ธ Server running:', isRunning ? 'YES' : 'NO');
|
|
152
|
+
|
|
153
|
+
if (isRunning) {
|
|
154
|
+
const serverInfo = ycmdServerManager.getServerInfo();
|
|
155
|
+
if (serverInfo) {
|
|
156
|
+
console.log(` Server: ${serverInfo.host}:${serverInfo.port}`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
console.log('\n๐ Test completed successfully!');
|
|
161
|
+
console.log('\n=== Summary ===');
|
|
162
|
+
console.log('โ
Auto-start functionality: WORKING');
|
|
163
|
+
console.log('โ
GoTo command validation: FIXED');
|
|
164
|
+
console.log('โ
Organize imports parameters: FIXED');
|
|
165
|
+
console.log('โ
All tools integrate properly with agent system');
|
|
166
|
+
|
|
167
|
+
} catch (error) {
|
|
168
|
+
console.error('โ Test failed:', error);
|
|
169
|
+
process.exit(1);
|
|
170
|
+
} finally {
|
|
171
|
+
// Clean up test file
|
|
172
|
+
try {
|
|
173
|
+
await fs.promises.unlink(testFile);
|
|
174
|
+
console.log(`๐๏ธ Cleaned up test file: ${testFile}`);
|
|
175
|
+
} catch (error) {
|
|
176
|
+
console.warn('Warning: Could not clean up test file:', error);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Stop server if running
|
|
181
|
+
try {
|
|
182
|
+
await ycmdServerManager.stop();
|
|
183
|
+
console.log('๐ Stopped ycmd server');
|
|
184
|
+
} catch (error) {
|
|
185
|
+
console.log('โน๏ธ Server was not running or already stopped');
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
console.log('โ
Test completed successfully - exiting');
|
|
189
|
+
process.exit(0);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Run the test
|
|
193
|
+
(async () => {
|
|
194
|
+
try {
|
|
195
|
+
await testYcmdTools();
|
|
196
|
+
} catch (error) {
|
|
197
|
+
console.error('โ Fatal error:', error);
|
|
198
|
+
process.exit(1);
|
|
199
|
+
}
|
|
200
|
+
})();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Simple test file to verify ycmd tools work correctly
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
def fibonacci(n):
|
|
7
|
+
"""Calculate fibonacci number"""
|
|
8
|
+
if n <= 1:
|
|
9
|
+
return n
|
|
10
|
+
return fibonacci(n-1) + fibonacci(n-2)
|
|
11
|
+
|
|
12
|
+
def main():
|
|
13
|
+
print("Testing ycmd tools")
|
|
14
|
+
result = fibonacci(10)
|
|
15
|
+
print(f"Fibonacci of 10 is: {result}")
|
|
16
|
+
|
|
17
|
+
if __name__ == "__main__":
|
|
18
|
+
main()
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env ts-node
|
|
2
|
+
/**
|
|
3
|
+
* Integration test for ycmd tools
|
|
4
|
+
* This test verifies that all ycmd functionality works correctly
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
import * as fs from 'fs';
|
|
9
|
+
import {
|
|
10
|
+
ycmdStart,
|
|
11
|
+
ycmdCompletion,
|
|
12
|
+
ycmdDiagnostics,
|
|
13
|
+
ycmdGoTo,
|
|
14
|
+
ycmdSignatureHelp
|
|
15
|
+
} from '../../../src/agents/tools/ycmd';
|
|
16
|
+
|
|
17
|
+
async function runYcmdTests() {
|
|
18
|
+
console.log('๐ Starting ycmd integration tests...\n');
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
// Step 1: Start ycmd server
|
|
22
|
+
console.log('1. Starting ycmd server...');
|
|
23
|
+
const serverInfo = await ycmdStart({
|
|
24
|
+
workspaceRoot: process.cwd()
|
|
25
|
+
});
|
|
26
|
+
console.log('โ
Server started:', serverInfo);
|
|
27
|
+
|
|
28
|
+
// Get absolute path to test files
|
|
29
|
+
const tsTestFile = path.resolve('./test_ycmd_experiment.ts');
|
|
30
|
+
const pyTestFile = path.resolve('./test_ycmd_usage.py');
|
|
31
|
+
|
|
32
|
+
// Step 2: Test TypeScript completions
|
|
33
|
+
if (fs.existsSync(tsTestFile)) {
|
|
34
|
+
console.log('\n2. Testing TypeScript completions...');
|
|
35
|
+
const tsCompletion = await ycmdCompletion({
|
|
36
|
+
filepath: tsTestFile,
|
|
37
|
+
line: 20, // Inside the addUser method
|
|
38
|
+
column: 10
|
|
39
|
+
});
|
|
40
|
+
console.log('โ
TypeScript completion:', JSON.stringify(tsCompletion, null, 2));
|
|
41
|
+
|
|
42
|
+
// Step 3: Test TypeScript diagnostics
|
|
43
|
+
console.log('\n3. Testing TypeScript diagnostics...');
|
|
44
|
+
const tsDiagnostics = await ycmdDiagnostics({
|
|
45
|
+
filepath: tsTestFile
|
|
46
|
+
});
|
|
47
|
+
console.log('โ
TypeScript diagnostics:', JSON.stringify(tsDiagnostics, null, 2));
|
|
48
|
+
|
|
49
|
+
// Step 4: Test goto definition
|
|
50
|
+
console.log('\n4. Testing goto definition...');
|
|
51
|
+
const gotoResult = await ycmdGoTo({
|
|
52
|
+
filepath: tsTestFile,
|
|
53
|
+
line: 23, // On getUserById call
|
|
54
|
+
column: 15,
|
|
55
|
+
command: 'GoTo'
|
|
56
|
+
});
|
|
57
|
+
console.log('โ
Goto definition:', JSON.stringify(gotoResult, null, 2));
|
|
58
|
+
} else {
|
|
59
|
+
console.log('โ ๏ธ TypeScript test file not found, skipping TS tests');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Step 5: Test Python completions and diagnostics
|
|
63
|
+
if (fs.existsSync(pyTestFile)) {
|
|
64
|
+
console.log('\n5. Testing Python completions...');
|
|
65
|
+
const pyCompletion = await ycmdCompletion({
|
|
66
|
+
filepath: pyTestFile,
|
|
67
|
+
line: 14, // Inside calculate method
|
|
68
|
+
column: 15
|
|
69
|
+
});
|
|
70
|
+
console.log('โ
Python completion:', JSON.stringify(pyCompletion, null, 2));
|
|
71
|
+
|
|
72
|
+
console.log('\n6. Testing Python diagnostics...');
|
|
73
|
+
const pyDiagnostics = await ycmdDiagnostics({
|
|
74
|
+
filepath: pyTestFile
|
|
75
|
+
});
|
|
76
|
+
console.log('โ
Python diagnostics:', JSON.stringify(pyDiagnostics, null, 2));
|
|
77
|
+
|
|
78
|
+
// Step 6: Test signature help
|
|
79
|
+
console.log('\n7. Testing signature help...');
|
|
80
|
+
const signatureHelp = await ycmdSignatureHelp({
|
|
81
|
+
filepath: pyTestFile,
|
|
82
|
+
line: 25, // On calculate call
|
|
83
|
+
column: 30
|
|
84
|
+
});
|
|
85
|
+
console.log('โ
Signature help:', JSON.stringify(signatureHelp, null, 2));
|
|
86
|
+
} else {
|
|
87
|
+
console.log('โ ๏ธ Python test file not found, skipping Python tests');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
console.log('\n๐ All ycmd tests completed successfully!');
|
|
91
|
+
console.log('โ
ycmd tools are working correctly');
|
|
92
|
+
process.exit(0);
|
|
93
|
+
|
|
94
|
+
} catch (error) {
|
|
95
|
+
console.error('โ Test failed:', error);
|
|
96
|
+
if (error instanceof Error) {
|
|
97
|
+
console.error('Error message:', error.message);
|
|
98
|
+
console.error('Stack trace:', error.stack);
|
|
99
|
+
}
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Run the tests
|
|
105
|
+
if (require.main === module) {
|
|
106
|
+
runYcmdTests().catch((error) => {
|
|
107
|
+
console.error(error);
|
|
108
|
+
process.exit(1);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export { runYcmdTests };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env ts-node
|
|
2
|
+
|
|
3
|
+
import { ycmdStart } from '../../../src/agents/tools/ycmd/tools/start';
|
|
4
|
+
import { ycmdServerManager } from '../../../src/agents/tools/ycmd/serverManager';
|
|
5
|
+
|
|
6
|
+
async function testBasicFunctionality() {
|
|
7
|
+
console.log('๐งช Testing basic ycmd functionality...\n');
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
// Test 1: Start server
|
|
11
|
+
console.log('1๏ธโฃ Testing server start...');
|
|
12
|
+
const startResult = await ycmdStart({});
|
|
13
|
+
console.log('โ
Start result:', startResult.success ? 'SUCCESS' : 'FAILED');
|
|
14
|
+
console.log(' Message:', startResult.message);
|
|
15
|
+
|
|
16
|
+
if (startResult.success) {
|
|
17
|
+
console.log(' Server info:', startResult.serverInfo);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Test 2: Check server status
|
|
21
|
+
console.log('\n2๏ธโฃ Checking server status...');
|
|
22
|
+
const isRunning = await ycmdServerManager.isRunning();
|
|
23
|
+
console.log('โ
Server running:', isRunning ? 'YES' : 'NO');
|
|
24
|
+
|
|
25
|
+
if (isRunning) {
|
|
26
|
+
const serverInfo = ycmdServerManager.getServerInfo();
|
|
27
|
+
console.log(' Server details:', serverInfo);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
console.log('\n๐ Basic functionality test completed!');
|
|
31
|
+
console.log('\n=== Summary ===');
|
|
32
|
+
console.log('โ
Server startup: WORKING');
|
|
33
|
+
console.log('โ
Server detection: WORKING');
|
|
34
|
+
console.log('โ
Integration: WORKING');
|
|
35
|
+
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error('โ Test failed:', error);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
process.exit(0);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Run the test
|
|
45
|
+
testBasicFunctionality().catch(console.error);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
class ExampleClass:
|
|
2
|
+
"""A sample class for testing ycmd functionality."""
|
|
3
|
+
|
|
4
|
+
def __init__(self, name: str, value: int):
|
|
5
|
+
self.name = name
|
|
6
|
+
self.value = value
|
|
7
|
+
self.computed_property = value * 2
|
|
8
|
+
|
|
9
|
+
def get_info(self) -> str:
|
|
10
|
+
"""Return information about this instance."""
|
|
11
|
+
return f"Name: {self.name}, Value: {self.value}"
|
|
12
|
+
|
|
13
|
+
def calculate(self, multiplier: float) -> float:
|
|
14
|
+
"""Calculate a value based on the multiplier."""
|
|
15
|
+
return self.value * multiplier
|
|
16
|
+
|
|
17
|
+
def create_example() -> ExampleClass:
|
|
18
|
+
"""Factory function to create an example instance."""
|
|
19
|
+
return ExampleClass("test", 42)
|
|
20
|
+
|
|
21
|
+
# Test usage
|
|
22
|
+
if __name__ == "__main__":
|
|
23
|
+
example = create_example()
|
|
24
|
+
info = example.get_info()
|
|
25
|
+
result = example.calculate(2.5)
|
|
26
|
+
print(f"Info: {info}")
|
|
27
|
+
print(f"Result: {result}")
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#!/usr/bin/env npx tsx
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Working simple test of ycmd advanced features
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { ycmdStart, ycmdDiagnostics, ycmdCompletion, ycmdRefactor } from '../../../src/agents/tools/ycmd';
|
|
8
|
+
import * as fs from 'fs';
|
|
9
|
+
import * as path from 'path';
|
|
10
|
+
|
|
11
|
+
async function workingSimpleTest() {
|
|
12
|
+
console.log('๐งช Working Simple ycmd Advanced Features Test\n');
|
|
13
|
+
|
|
14
|
+
// Create a simple test file with some issues to trigger diagnostics
|
|
15
|
+
const testFile = path.join(process.cwd(), 'test_temp.ts');
|
|
16
|
+
const testContent = `function greet(name: string): string {
|
|
17
|
+
return "Hello " + name;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Missing import - this should trigger a diagnostic with fixit
|
|
21
|
+
const fs = require('fs'); // Should suggest using import instead
|
|
22
|
+
|
|
23
|
+
const result = greet("World");
|
|
24
|
+
console.log(result);
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
fs.writeFileSync(testFile, testContent);
|
|
28
|
+
console.log('โ
Created test file with intentional issues');
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
// Start ycmd
|
|
32
|
+
console.log('๐ Starting ycmd...');
|
|
33
|
+
await ycmdStart({});
|
|
34
|
+
console.log('โ
ycmd started');
|
|
35
|
+
|
|
36
|
+
// Test diagnostics to find fixits
|
|
37
|
+
console.log('๐ Testing diagnostics for fixits...');
|
|
38
|
+
const diagnosticsResult = await ycmdDiagnostics({
|
|
39
|
+
filepath: testFile,
|
|
40
|
+
fileContents: testContent
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (diagnosticsResult.success && diagnosticsResult.diagnostics) {
|
|
44
|
+
console.log(`โ
Found ${diagnosticsResult.diagnostics.length} diagnostics`);
|
|
45
|
+
|
|
46
|
+
// Look for diagnostics with fixits
|
|
47
|
+
const fixitDiagnostics = diagnosticsResult.diagnostics.filter(d => d.fixit_available);
|
|
48
|
+
console.log(`๐ง Found ${fixitDiagnostics.length} diagnostics with fixits available`);
|
|
49
|
+
|
|
50
|
+
if (fixitDiagnostics.length > 0) {
|
|
51
|
+
const diagnostic = fixitDiagnostics[0];
|
|
52
|
+
console.log(`๐ First fixit diagnostic: ${diagnostic.text}`);
|
|
53
|
+
|
|
54
|
+
// For demonstration, we'll assume the diagnostic has a fixit property
|
|
55
|
+
// In real usage, you'd need to get the actual fixit object from the diagnostic
|
|
56
|
+
console.log('โ ๏ธ Note: Fixit testing requires actual fixit objects from diagnostics');
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
console.log('โ ๏ธ No diagnostics found or diagnostics failed');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Test completions
|
|
63
|
+
console.log('โก Testing completions...');
|
|
64
|
+
const completionsResult = await ycmdCompletion({
|
|
65
|
+
filepath: testFile,
|
|
66
|
+
line: 2,
|
|
67
|
+
column: 15,
|
|
68
|
+
contents: testContent
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (completionsResult.success && completionsResult.completions) {
|
|
72
|
+
console.log(`โ
Found ${completionsResult.completions.length} completions`);
|
|
73
|
+
} else {
|
|
74
|
+
console.log('โ ๏ธ No completions found or completions failed');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Test organize imports
|
|
78
|
+
console.log('๐ฆ Testing organize imports...');
|
|
79
|
+
const organizeResult = await ycmdRefactor({
|
|
80
|
+
filepath: testFile,
|
|
81
|
+
line: 1,
|
|
82
|
+
column: 1,
|
|
83
|
+
command: 'organize_imports',
|
|
84
|
+
contents: testContent
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
if (organizeResult.success) {
|
|
88
|
+
console.log('โ
Organize imports succeeded');
|
|
89
|
+
if (organizeResult.result && organizeResult.result.edits) {
|
|
90
|
+
console.log(`๐ Generated ${organizeResult.result.edits.length} edits`);
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
console.log('โ ๏ธ Organize imports failed:', organizeResult.message);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Test refactor rename
|
|
97
|
+
console.log('๐ง Testing refactor rename...');
|
|
98
|
+
const renameResult = await ycmdRefactor({
|
|
99
|
+
filepath: testFile,
|
|
100
|
+
line: 1,
|
|
101
|
+
column: 10, // Position on 'greet' function name
|
|
102
|
+
command: 'rename',
|
|
103
|
+
newName: 'sayHello',
|
|
104
|
+
contents: testContent
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
if (renameResult.success) {
|
|
108
|
+
console.log('โ
Rename succeeded');
|
|
109
|
+
if (renameResult.result && renameResult.result.edits) {
|
|
110
|
+
console.log(`๐ Generated ${renameResult.result.edits.length} edits`);
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
console.log('โ ๏ธ Rename failed:', renameResult.message);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
} catch (error: any) {
|
|
117
|
+
console.error('โ Test failed:', error.message);
|
|
118
|
+
console.error('Stack:', error.stack);
|
|
119
|
+
} finally {
|
|
120
|
+
// Cleanup
|
|
121
|
+
try {
|
|
122
|
+
fs.unlinkSync(testFile);
|
|
123
|
+
console.log('๐งน Cleaned up test file');
|
|
124
|
+
} catch (e) {
|
|
125
|
+
console.log('โ ๏ธ Could not clean up test file');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
console.log('๐ Working simple test complete');
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (require.main === module) {
|
|
133
|
+
workingSimpleTest().catch(console.error);
|
|
134
|
+
}
|
|
@@ -4,7 +4,7 @@ import { GenericClient, Message, Tool, ToolCall } from "../../clients/types";
|
|
|
4
4
|
import { IAgent } from "../interface";
|
|
5
5
|
import { ToolsService } from "../../services/Tools";
|
|
6
6
|
import { EventService } from "../../services/EventService";
|
|
7
|
-
import { Clients } from "../../clients";
|
|
7
|
+
import { AIClient, Clients } from "../../clients";
|
|
8
8
|
import { MessageProcessor } from "../../services/MessageProcessor";
|
|
9
9
|
export { Message, Tool, ToolCall };
|
|
10
10
|
export interface ModelPreference {
|
|
@@ -15,6 +15,7 @@ export interface AgentContext {
|
|
|
15
15
|
Tools?: ToolsService;
|
|
16
16
|
Events?: EventService;
|
|
17
17
|
messageProcessor?: MessageProcessor;
|
|
18
|
+
Clients?: AIClient;
|
|
18
19
|
}
|
|
19
20
|
export declare abstract class BaseAgent implements IAgent {
|
|
20
21
|
abstract name: string;
|
|
@@ -28,6 +29,11 @@ export declare abstract class BaseAgent implements IAgent {
|
|
|
28
29
|
protected currentModelPreferenceIndex: number;
|
|
29
30
|
protected easyFinalAnswer: boolean;
|
|
30
31
|
protected requiredToolNames: string[];
|
|
32
|
+
protected maxTurns: number | null;
|
|
33
|
+
protected maxSpend: number | null;
|
|
34
|
+
protected maxRunTimeMs: number | null;
|
|
35
|
+
protected startTimeMs: number | null;
|
|
36
|
+
protected turnCount: number;
|
|
31
37
|
protected totalCostUsd: number;
|
|
32
38
|
protected currentThread: number;
|
|
33
39
|
protected threads: Message[][];
|
|
@@ -48,8 +54,12 @@ export declare abstract class BaseAgent implements IAgent {
|
|
|
48
54
|
tools: ToolsService;
|
|
49
55
|
events: EventService;
|
|
50
56
|
messageProcessor: MessageProcessor;
|
|
57
|
+
clientService: AIClient;
|
|
51
58
|
disabledTools: any[];
|
|
52
59
|
constructor(context: AgentContext);
|
|
60
|
+
setMaxTurns(maxTurns: number | null): void;
|
|
61
|
+
setMaxSpend(maxSpend: number | null): void;
|
|
62
|
+
setMaxRunTime(maxRunTimeMs: number | null): void;
|
|
53
63
|
newTask(): void;
|
|
54
64
|
register(): void;
|
|
55
65
|
setModelPreferences(value: ModelPreference[]): void;
|
|
@@ -67,6 +77,9 @@ export declare abstract class BaseAgent implements IAgent {
|
|
|
67
77
|
disableTool(toolName: string): void;
|
|
68
78
|
isToolEnabled(toolName: string): boolean;
|
|
69
79
|
enableTool(toolName: string): void;
|
|
80
|
+
private checkLimits;
|
|
81
|
+
private shouldTerminateFromLimits;
|
|
82
|
+
getTurnCount(): number;
|
|
70
83
|
adjustTotalCostUsd(cost: number): void;
|
|
71
84
|
getTotalCostUsd(): number;
|
|
72
85
|
startNewThread(messages: Message[]): void;
|