auto-coder 0.1.217__py3-none-any.whl → 0.1.219__py3-none-any.whl
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.
Potentially problematic release.
This version of auto-coder might be problematic. Click here for more details.
- {auto_coder-0.1.217.dist-info → auto_coder-0.1.219.dist-info}/METADATA +1 -1
- {auto_coder-0.1.217.dist-info → auto_coder-0.1.219.dist-info}/RECORD +12 -12
- autocoder/auto_coder.py +6 -2
- autocoder/chat_auto_coder.py +12 -1
- autocoder/common/command_completer.py +2 -1
- autocoder/common/mcp_hub.py +15 -2
- autocoder/common/mcp_server.py +61 -29
- autocoder/version.py +1 -1
- {auto_coder-0.1.217.dist-info → auto_coder-0.1.219.dist-info}/LICENSE +0 -0
- {auto_coder-0.1.217.dist-info → auto_coder-0.1.219.dist-info}/WHEEL +0 -0
- {auto_coder-0.1.217.dist-info → auto_coder-0.1.219.dist-info}/entry_points.txt +0 -0
- {auto_coder-0.1.217.dist-info → auto_coder-0.1.219.dist-info}/top_level.txt +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
autocoder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
autocoder/auto_coder.py,sha256=
|
|
2
|
+
autocoder/auto_coder.py,sha256=xWEEptvSMPu0tEtqOo2V-GoCzL1402NveoxjyYrsw_g,41929
|
|
3
3
|
autocoder/auto_coder_lang.py,sha256=Rtupq6N3_HT7JRhDKdgCBcwRaiAnyCOR_Gsp4jUomrI,3229
|
|
4
4
|
autocoder/auto_coder_rag.py,sha256=illKgzP2bv-Tq50ujsofJnOHdI4pzr0ALtfR8NHHWdQ,22351
|
|
5
5
|
autocoder/auto_coder_server.py,sha256=XU9b4SBH7zjPPXaTWWHV4_zJm-XYa6njuLQaplYJH_c,20290
|
|
6
6
|
autocoder/benchmark.py,sha256=Ypomkdzd1T3GE6dRICY3Hj547dZ6_inqJbBJIp5QMco,4423
|
|
7
|
-
autocoder/chat_auto_coder.py,sha256=
|
|
7
|
+
autocoder/chat_auto_coder.py,sha256=NTCWQKBQJluEhay5NGoTl5tdv00Zmu8oFioCjCpJCd8,94294
|
|
8
8
|
autocoder/chat_auto_coder_lang.py,sha256=ReWukXKVvuzVvpbYk5O9kc1ev7XNmAv3DnuQhmpLmnc,8717
|
|
9
9
|
autocoder/command_args.py,sha256=9aYJ-AmPxP1sQh6ciw04FWHjSn31f2W9afXFwo8wgx4,30441
|
|
10
10
|
autocoder/lang.py,sha256=U6AjVV8Rs1uLyjFCZ8sT6WWuNUxMBqkXXIOs4S120uk,14511
|
|
11
|
-
autocoder/version.py,sha256=
|
|
11
|
+
autocoder/version.py,sha256=CiJSNMnvgzsdXFL0TOFxCpTE04WDBfpfA19PCdyUupg,24
|
|
12
12
|
autocoder/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
autocoder/agent/auto_demand_organizer.py,sha256=NWSAEsEk94vT3lGjfo25kKLMwYdPcpy9e-i21txPasQ,6942
|
|
14
14
|
autocoder/agent/auto_filegroup.py,sha256=CW7bqp0FW1GIEMnl-blyAc2UGT7O9Mom0q66ITz1ckM,6635
|
|
@@ -38,7 +38,7 @@ autocoder/common/code_auto_merge_diff.py,sha256=5SI6ggklJ0QDHvsS0cpNXFuIkFRQxp1i
|
|
|
38
38
|
autocoder/common/code_auto_merge_editblock.py,sha256=l6yEiZqXyIlUNIIPXvkHOnLCIInXR78TzSjF-jtJkkg,17035
|
|
39
39
|
autocoder/common/code_auto_merge_strict_diff.py,sha256=ABYOTDUQYA4Bn4BwT1Rw812y49cHW3UH_JSpM9uJ6ig,9399
|
|
40
40
|
autocoder/common/code_modification_ranker.py,sha256=DFlbwgdg8GK47zVcvfZSzkyniEKmTVLTOWejjcVIgaw,5121
|
|
41
|
-
autocoder/common/command_completer.py,sha256=
|
|
41
|
+
autocoder/common/command_completer.py,sha256=10nNnazkzZwya-jScPLlhpCBR2oYsOiVfwofqGvIUEM,9145
|
|
42
42
|
autocoder/common/command_generator.py,sha256=v4LmU7sO-P7jEZIXCWHUC6P-vT7AvBi_x_PTwCqBAE8,1323
|
|
43
43
|
autocoder/common/command_templates.py,sha256=3G-pCNbL6iHbnkG6v1JZpbIK3Mc9d373_RYGmCcDPMY,8548
|
|
44
44
|
autocoder/common/const.py,sha256=eTjhjh4Aj4CUzviJ81jaf3Y5cwqsLATySn2wJxaS6RQ,2911
|
|
@@ -46,8 +46,8 @@ autocoder/common/git_utils.py,sha256=btK45sxvfm4tX3fBRNUPRZoGQuZuOEQrWSAwLy1yoLw
|
|
|
46
46
|
autocoder/common/image_to_page.py,sha256=O0cNO_vHHUP-fP4GXiVojShmNqkPnZXeIyiY1MRLpKg,13936
|
|
47
47
|
autocoder/common/interpreter.py,sha256=62-dIakOunYB4yjmX8SHC0Gdy2h8NtxdgbpdqRZJ5vk,2833
|
|
48
48
|
autocoder/common/llm_rerank.py,sha256=FbvtCzaR661Mt2wn0qsuiEL1Y3puD6jeIJS4zg_e7Bs,3260
|
|
49
|
-
autocoder/common/mcp_hub.py,sha256=
|
|
50
|
-
autocoder/common/mcp_server.py,sha256=
|
|
49
|
+
autocoder/common/mcp_hub.py,sha256=9BqNWjVG8polG-bG8sXIqze-ZzzNJxg2OjfOqgxeM3U,14174
|
|
50
|
+
autocoder/common/mcp_server.py,sha256=tZfjUjBvEp8gaEusD2SaH5Mh0FdbP2MpnyqAWuSgrwo,12652
|
|
51
51
|
autocoder/common/mcp_tools.py,sha256=KsLvRrB6pvmebqd-lDaSH6IBJR0AIxWRE-dtCEG_w9k,12485
|
|
52
52
|
autocoder/common/recall_validation.py,sha256=Avt9Q9dX3kG6Pf2zsdlOHmsjd-OeSj7U1PFBDp_Cve0,1700
|
|
53
53
|
autocoder/common/screenshots.py,sha256=_gA-z1HxGjPShBrtgkdideq58MG6rqFB2qMUJKjrycs,3769
|
|
@@ -122,9 +122,9 @@ autocoder/utils/request_event_queue.py,sha256=r3lo5qGsB1dIjzVQ05dnr0z_9Z3zOkBdP1
|
|
|
122
122
|
autocoder/utils/request_queue.py,sha256=nwp6PMtgTCiuwJI24p8OLNZjUiprC-TsefQrhMI-yPE,3889
|
|
123
123
|
autocoder/utils/rest.py,sha256=HawagAap3wMIDROGhY1730zSZrJR_EycODAA5qOj83c,8807
|
|
124
124
|
autocoder/utils/tests.py,sha256=BqphrwyycGAvs-5mhH8pKtMZdObwhFtJ5MC_ZAOiLq8,1340
|
|
125
|
-
auto_coder-0.1.
|
|
126
|
-
auto_coder-0.1.
|
|
127
|
-
auto_coder-0.1.
|
|
128
|
-
auto_coder-0.1.
|
|
129
|
-
auto_coder-0.1.
|
|
130
|
-
auto_coder-0.1.
|
|
125
|
+
auto_coder-0.1.219.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
126
|
+
auto_coder-0.1.219.dist-info/METADATA,sha256=qsE3dhB3-5DCw0cflbsa5zCFs5DqDnyXhzSDum8RNgU,2615
|
|
127
|
+
auto_coder-0.1.219.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
128
|
+
auto_coder-0.1.219.dist-info/entry_points.txt,sha256=0nzHtHH4pNcM7xq4EBA2toS28Qelrvcbrr59GqD_0Ak,350
|
|
129
|
+
auto_coder-0.1.219.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
|
|
130
|
+
auto_coder-0.1.219.dist-info/RECORD,,
|
autocoder/auto_coder.py
CHANGED
|
@@ -786,7 +786,7 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
786
786
|
pre_conversations.append(
|
|
787
787
|
{
|
|
788
788
|
"role": "user",
|
|
789
|
-
"content": f"下面是一些文档和源码,如果用户的问题和他们相关,请参考他们:\n{file_content}",
|
|
789
|
+
"content": f"下面是一些文档和源码,如果用户的问题和他们相关,请参考他们:\n <files>\n{file_content}</files>",
|
|
790
790
|
},
|
|
791
791
|
)
|
|
792
792
|
pre_conversations.append(
|
|
@@ -813,7 +813,7 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
813
813
|
pre_conversations.append(
|
|
814
814
|
{
|
|
815
815
|
"role": "user",
|
|
816
|
-
"content": f"下面是一些文档和源码,如果用户的问题和他们相关,请参考他们:\n{s}",
|
|
816
|
+
"content": f"下面是一些文档和源码,如果用户的问题和他们相关,请参考他们:\n <files>{s}</files>",
|
|
817
817
|
}
|
|
818
818
|
)
|
|
819
819
|
pre_conversations.append(
|
|
@@ -831,15 +831,19 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
831
831
|
source_codes, pre_conversations, last_conversation
|
|
832
832
|
):
|
|
833
833
|
"""
|
|
834
|
+
<files>
|
|
834
835
|
{% if source_codes %}
|
|
835
836
|
{{ source_codes }}
|
|
836
837
|
{% endif %}
|
|
838
|
+
</files>
|
|
837
839
|
|
|
838
840
|
{% if pre_conversations %}
|
|
839
841
|
下面是我们之间的历史对话,假设我是A,你是B。
|
|
842
|
+
<conversations>
|
|
840
843
|
{% for conv in pre_conversations %}
|
|
841
844
|
{{ "A" if conv.role == "user" else "B" }}: {{ conv.content }}
|
|
842
845
|
{% endfor %}
|
|
846
|
+
</conversations>
|
|
843
847
|
{% endif %}
|
|
844
848
|
|
|
845
849
|
|
autocoder/chat_auto_coder.py
CHANGED
|
@@ -44,9 +44,10 @@ from autocoder.common import git_utils
|
|
|
44
44
|
from autocoder.chat_auto_coder_lang import get_message
|
|
45
45
|
from autocoder.utils import operate_config_api
|
|
46
46
|
from autocoder.agent.auto_guess_query import AutoGuessQuery
|
|
47
|
-
from autocoder.common.mcp_server import get_mcp_server, McpRequest, McpInstallRequest, McpRemoveRequest, McpListRequest, McpListRunningRequest
|
|
47
|
+
from autocoder.common.mcp_server import get_mcp_server, McpRequest, McpInstallRequest, McpRemoveRequest, McpListRequest, McpListRunningRequest, McpRefreshRequest
|
|
48
48
|
import byzerllm
|
|
49
49
|
|
|
50
|
+
|
|
50
51
|
class SymbolItem(BaseModel):
|
|
51
52
|
symbol_name: str
|
|
52
53
|
symbol_type: SymbolType
|
|
@@ -1443,6 +1444,16 @@ def mcp(query: str):
|
|
|
1443
1444
|
print(response.result)
|
|
1444
1445
|
return
|
|
1445
1446
|
|
|
1447
|
+
# Handle refresh command
|
|
1448
|
+
if query.startswith("/refresh"):
|
|
1449
|
+
server_name = query.replace("/refresh", "", 1).strip()
|
|
1450
|
+
response = mcp_server.send_request(McpRefreshRequest(name=server_name or None))
|
|
1451
|
+
if response.error:
|
|
1452
|
+
print(f"Error refreshing MCP servers: {response.error}")
|
|
1453
|
+
else:
|
|
1454
|
+
print("Successfully refreshed MCP servers")
|
|
1455
|
+
return
|
|
1456
|
+
|
|
1446
1457
|
# Handle add command
|
|
1447
1458
|
if query.startswith("/add"):
|
|
1448
1459
|
query = query.replace("/add", "", 1).strip()
|
autocoder/common/mcp_hub.py
CHANGED
|
@@ -240,6 +240,19 @@ class McpHub:
|
|
|
240
240
|
if name in self.connections:
|
|
241
241
|
del self.connections[name]
|
|
242
242
|
|
|
243
|
+
async def refresh_server_connection(self, name: str) -> None:
|
|
244
|
+
"""
|
|
245
|
+
Refresh a server connection
|
|
246
|
+
"""
|
|
247
|
+
try:
|
|
248
|
+
config = self._read_settings()
|
|
249
|
+
await self.delete_connection(name)
|
|
250
|
+
await self.connect_to_server(name, config.get("mcpServers", {}).get(name, {}))
|
|
251
|
+
except Exception as e:
|
|
252
|
+
logger.error(f"Failed to refresh MCP server {name}: {e}")
|
|
253
|
+
raise
|
|
254
|
+
|
|
255
|
+
|
|
243
256
|
async def update_server_connections(self, new_servers: Dict[str, Any]) -> None:
|
|
244
257
|
"""
|
|
245
258
|
Update server connections based on new configuration
|
|
@@ -309,7 +322,7 @@ class McpHub:
|
|
|
309
322
|
for resource in response.resources
|
|
310
323
|
]
|
|
311
324
|
except Exception as e:
|
|
312
|
-
logger.
|
|
325
|
+
logger.warning(f"Failed to fetch resources for {server_name}: {e}")
|
|
313
326
|
return []
|
|
314
327
|
|
|
315
328
|
async def _fetch_resource_templates(
|
|
@@ -346,7 +359,7 @@ class McpHub:
|
|
|
346
359
|
for template in response.resourceTemplates
|
|
347
360
|
]
|
|
348
361
|
except Exception as e:
|
|
349
|
-
logger.
|
|
362
|
+
logger.warning(
|
|
350
363
|
f"Failed to fetch resource templates for {server_name}: {e}")
|
|
351
364
|
return []
|
|
352
365
|
|
autocoder/common/mcp_server.py
CHANGED
|
@@ -14,7 +14,6 @@ from pydantic import BaseModel
|
|
|
14
14
|
import sys
|
|
15
15
|
from loguru import logger
|
|
16
16
|
|
|
17
|
-
|
|
18
17
|
@dataclass
|
|
19
18
|
class McpRequest:
|
|
20
19
|
query: str
|
|
@@ -42,13 +41,24 @@ class McpListRunningRequest:
|
|
|
42
41
|
"""Request to list all running MCP servers"""
|
|
43
42
|
pass
|
|
44
43
|
|
|
45
|
-
|
|
46
44
|
@dataclass
|
|
47
45
|
class McpResponse:
|
|
48
46
|
result: str
|
|
49
47
|
error: Optional[str] = None
|
|
50
48
|
|
|
51
49
|
|
|
50
|
+
@dataclass
|
|
51
|
+
class McpRefreshRequest:
|
|
52
|
+
"""Request to refresh MCP server connections"""
|
|
53
|
+
name: Optional[str] = None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@dataclass
|
|
57
|
+
class McpExternalServer(BaseModel):
|
|
58
|
+
result: str
|
|
59
|
+
error: Optional[str] = None
|
|
60
|
+
|
|
61
|
+
|
|
52
62
|
class McpExternalServer(BaseModel):
|
|
53
63
|
"""Represents an external MCP server configuration"""
|
|
54
64
|
name: str
|
|
@@ -118,7 +128,7 @@ class McpServer:
|
|
|
118
128
|
self._task = self._loop.create_task(self._process_request())
|
|
119
129
|
self._loop.run_forever()
|
|
120
130
|
|
|
121
|
-
async def _install_server(self, request: McpInstallRequest) -> McpResponse:
|
|
131
|
+
async def _install_server(self, request: McpInstallRequest, hub: McpHub) -> McpResponse:
|
|
122
132
|
"""Install an MCP server with module dependency check"""
|
|
123
133
|
name = ""
|
|
124
134
|
config = {}
|
|
@@ -134,7 +144,7 @@ class McpServer:
|
|
|
134
144
|
config = list(raw_config.values())[0]
|
|
135
145
|
name = list(raw_config.keys())[0]
|
|
136
146
|
except json.JSONDecodeError:
|
|
137
|
-
name = server_name_or_config
|
|
147
|
+
name = server_name_or_config.strip()
|
|
138
148
|
if name not in MCP_BUILD_IN_SERVERS:
|
|
139
149
|
# 查找外部server
|
|
140
150
|
external_servers = get_mcp_external_servers()
|
|
@@ -144,7 +154,8 @@ class McpServer:
|
|
|
144
154
|
# Check if module exists
|
|
145
155
|
try:
|
|
146
156
|
import importlib
|
|
147
|
-
importlib.import_module(
|
|
157
|
+
importlib.import_module(
|
|
158
|
+
name.replace("-", "_"))
|
|
148
159
|
except ImportError:
|
|
149
160
|
# Install missing module
|
|
150
161
|
import subprocess
|
|
@@ -152,17 +163,20 @@ class McpServer:
|
|
|
152
163
|
subprocess.run(
|
|
153
164
|
[sys.executable, "-m", "pip", "install", name], check=True)
|
|
154
165
|
except subprocess.CalledProcessError:
|
|
155
|
-
print(
|
|
166
|
+
print(
|
|
167
|
+
f"\n\033[93mFailed to automatically install {name}. Please manually install it using:\n")
|
|
156
168
|
print(f" pip install {name}\n")
|
|
157
|
-
print(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
169
|
+
print(
|
|
170
|
+
f"We have already updated the server configuration in ~/.autocoder/mcp/settings.json.\n")
|
|
171
|
+
print(
|
|
172
|
+
f"After installation, you can restart the auto-coder.chat using the server.\033[0m\n")
|
|
173
|
+
|
|
174
|
+
config = {
|
|
175
|
+
"command": "python",
|
|
176
|
+
"args": [
|
|
177
|
+
"-m", name.replace("-", "_")
|
|
178
|
+
],
|
|
179
|
+
}
|
|
166
180
|
elif s.runtime == "node":
|
|
167
181
|
# Check if package exists
|
|
168
182
|
try:
|
|
@@ -174,24 +188,32 @@ class McpServer:
|
|
|
174
188
|
subprocess.run(
|
|
175
189
|
["npm", "install", "-y", "-g", name], check=True)
|
|
176
190
|
except subprocess.CalledProcessError:
|
|
177
|
-
print(
|
|
191
|
+
print(
|
|
192
|
+
f"\n\033[93mFailed to automatically install {name}. Please manually install it using:\n")
|
|
178
193
|
print(f" npm install -g {name}\n")
|
|
179
|
-
print(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
194
|
+
print(
|
|
195
|
+
f"We have already updated the server configuration in ~/.autocoder/mcp/settings.json.\n")
|
|
196
|
+
print(
|
|
197
|
+
f"After installation, you can restart the auto-coder.chat using the server.\033[0m\n")
|
|
198
|
+
|
|
199
|
+
config = {
|
|
200
|
+
"command": "npx",
|
|
201
|
+
"args": [
|
|
202
|
+
"-y",
|
|
203
|
+
name
|
|
204
|
+
]
|
|
205
|
+
}
|
|
189
206
|
break
|
|
190
207
|
else:
|
|
191
208
|
config = MCP_BUILD_IN_SERVERS[name]
|
|
192
209
|
if not name:
|
|
193
|
-
raise ValueError(
|
|
194
|
-
|
|
210
|
+
raise ValueError(
|
|
211
|
+
"MCP server name is not available in MCP_BUILD_IN_SERVERS or external servers")
|
|
212
|
+
|
|
213
|
+
logger.info(f"Installing MCP server: {name} with config: {config}")
|
|
214
|
+
if not config:
|
|
215
|
+
raise ValueError(f"MCP server {name} config is not available")
|
|
216
|
+
|
|
195
217
|
await hub.add_server_config(name, config)
|
|
196
218
|
return McpResponse(result=f"Successfully installed MCP server: {request.server_name_or_config}")
|
|
197
219
|
except Exception as e:
|
|
@@ -208,7 +230,7 @@ class McpServer:
|
|
|
208
230
|
break
|
|
209
231
|
|
|
210
232
|
if isinstance(request, McpInstallRequest):
|
|
211
|
-
response = await self._install_server(request)
|
|
233
|
+
response = await self._install_server(request, hub)
|
|
212
234
|
await self._response_queue.put(response)
|
|
213
235
|
|
|
214
236
|
elif isinstance(request, McpRemoveRequest):
|
|
@@ -246,6 +268,16 @@ class McpServer:
|
|
|
246
268
|
except Exception as e:
|
|
247
269
|
await self._response_queue.put(McpResponse(result="", error=f"Failed to list running servers: {str(e)}"))
|
|
248
270
|
|
|
271
|
+
elif isinstance(request, McpRefreshRequest):
|
|
272
|
+
try:
|
|
273
|
+
if request.name:
|
|
274
|
+
await hub.refresh_server_connection(request.name)
|
|
275
|
+
else:
|
|
276
|
+
await hub.initialize()
|
|
277
|
+
await self._response_queue.put(McpResponse(result="Successfully refreshed MCP server connections"))
|
|
278
|
+
except Exception as e:
|
|
279
|
+
await self._response_queue.put(McpResponse(result="", error=f"Failed to refresh MCP servers: {str(e)}"))
|
|
280
|
+
|
|
249
281
|
else:
|
|
250
282
|
llm = byzerllm.ByzerLLM.from_default_model(
|
|
251
283
|
model=request.model)
|
autocoder/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.219"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|