auto-coder 0.1.362__py3-none-any.whl → 0.1.363__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.362.dist-info → auto_coder-0.1.363.dist-info}/METADATA +1 -1
- {auto_coder-0.1.362.dist-info → auto_coder-0.1.363.dist-info}/RECORD +46 -18
- autocoder/agent/base_agentic/__init__.py +0 -0
- autocoder/agent/base_agentic/agent_hub.py +169 -0
- autocoder/agent/base_agentic/agentic_lang.py +112 -0
- autocoder/agent/base_agentic/agentic_tool_display.py +180 -0
- autocoder/agent/base_agentic/base_agent.py +1582 -0
- autocoder/agent/base_agentic/default_tools.py +683 -0
- autocoder/agent/base_agentic/test_base_agent.py +82 -0
- autocoder/agent/base_agentic/tool_registry.py +425 -0
- autocoder/agent/base_agentic/tools/__init__.py +12 -0
- autocoder/agent/base_agentic/tools/ask_followup_question_tool_resolver.py +72 -0
- autocoder/agent/base_agentic/tools/attempt_completion_tool_resolver.py +37 -0
- autocoder/agent/base_agentic/tools/base_tool_resolver.py +35 -0
- autocoder/agent/base_agentic/tools/example_tool_resolver.py +46 -0
- autocoder/agent/base_agentic/tools/execute_command_tool_resolver.py +72 -0
- autocoder/agent/base_agentic/tools/list_files_tool_resolver.py +110 -0
- autocoder/agent/base_agentic/tools/plan_mode_respond_tool_resolver.py +35 -0
- autocoder/agent/base_agentic/tools/read_file_tool_resolver.py +54 -0
- autocoder/agent/base_agentic/tools/replace_in_file_tool_resolver.py +156 -0
- autocoder/agent/base_agentic/tools/search_files_tool_resolver.py +134 -0
- autocoder/agent/base_agentic/tools/talk_to_group_tool_resolver.py +96 -0
- autocoder/agent/base_agentic/tools/talk_to_tool_resolver.py +79 -0
- autocoder/agent/base_agentic/tools/use_mcp_tool_resolver.py +44 -0
- autocoder/agent/base_agentic/tools/write_to_file_tool_resolver.py +58 -0
- autocoder/agent/base_agentic/types.py +189 -0
- autocoder/agent/base_agentic/utils.py +100 -0
- autocoder/auto_coder_runner.py +4 -4
- autocoder/chat/conf_command.py +11 -10
- autocoder/common/rulefiles/autocoderrules_utils.py +24 -0
- autocoder/common/save_formatted_log.py +1 -1
- autocoder/common/v2/agent/agentic_edit.py +21 -19
- autocoder/common/v2/agent/agentic_edit_tools/replace_in_file_tool_resolver.py +73 -1
- autocoder/common/v2/agent/agentic_edit_tools/write_to_file_tool_resolver.py +132 -4
- autocoder/common/v2/agent/agentic_edit_types.py +1 -2
- autocoder/common/v2/agent/agentic_tool_display.py +2 -3
- autocoder/rag/long_context_rag.py +424 -397
- autocoder/rag/test_doc_filter.py +393 -0
- autocoder/rag/test_long_context_rag.py +473 -0
- autocoder/rag/test_token_limiter.py +342 -0
- autocoder/shadows/shadow_manager.py +1 -3
- autocoder/version.py +1 -1
- {auto_coder-0.1.362.dist-info → auto_coder-0.1.363.dist-info}/LICENSE +0 -0
- {auto_coder-0.1.362.dist-info → auto_coder-0.1.363.dist-info}/WHEEL +0 -0
- {auto_coder-0.1.362.dist-info → auto_coder-0.1.363.dist-info}/entry_points.txt +0 -0
- {auto_coder-0.1.362.dist-info → auto_coder-0.1.363.dist-info}/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ autocoder/auto_coder_lang.py,sha256=Rtupq6N3_HT7JRhDKdgCBcwRaiAnyCOR_Gsp4jUomrI,
|
|
|
4
4
|
autocoder/auto_coder_rag.py,sha256=ru5o86IaKylyVRlVORmnrdf3Q1To2eWi2KLdT9FMW0k,37580
|
|
5
5
|
autocoder/auto_coder_rag_client_mcp.py,sha256=QRxUbjc6A8UmDMQ8lXgZkjgqtq3lgKYeatJbDY6rSo0,6270
|
|
6
6
|
autocoder/auto_coder_rag_mcp.py,sha256=-RrjNwFaS2e5v8XDIrKR-zlUNUE8UBaeOtojffBrvJo,8521
|
|
7
|
-
autocoder/auto_coder_runner.py,sha256=
|
|
7
|
+
autocoder/auto_coder_runner.py,sha256=SIPsF-hJiGXHYfdApQCEDZc1nn-rf09AC4s1vhSwRsw,112199
|
|
8
8
|
autocoder/auto_coder_server.py,sha256=bLORGEclcVdbBVfM140JCI8WtdrU0jbgqdJIVVupiEU,20578
|
|
9
9
|
autocoder/benchmark.py,sha256=Ypomkdzd1T3GE6dRICY3Hj547dZ6_inqJbBJIp5QMco,4423
|
|
10
10
|
autocoder/chat_auto_coder.py,sha256=iHy8Kt1so1ZLOPpb5GTfi4BurDe3T1hOPqOw-XIBDpQ,26851
|
|
@@ -14,7 +14,7 @@ autocoder/command_parser.py,sha256=fx1g9E6GaM273lGTcJqaFQ-hoksS_Ik2glBMnVltPCE,1
|
|
|
14
14
|
autocoder/lang.py,sha256=PFtATuOhHRnfpqHQkXr6p4C893JvpsgwTMif3l-GEi0,14321
|
|
15
15
|
autocoder/models.py,sha256=Gu50IATQtZtgEir1PpCfwgH6o4ygw6XqqbQRj3lx5dU,13798
|
|
16
16
|
autocoder/run_context.py,sha256=IUfSO6_gp2Wt1blFWAmOpN0b0nDrTTk4LmtCYUBIoro,1643
|
|
17
|
-
autocoder/version.py,sha256=
|
|
17
|
+
autocoder/version.py,sha256=cvMXneYVMewK3wsnehdnyGje5vmWAtTL725STXOPjiE,23
|
|
18
18
|
autocoder/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
19
|
autocoder/agent/agentic_edit.py,sha256=XsfePZ-t6M-uBSdG1VLZXk1goqXk2HPeJ_A8IYyBuWQ,58896
|
|
20
20
|
autocoder/agent/agentic_edit_types.py,sha256=oFcDd_cxJ2yH9Ed1uTpD3BipudgoIEWDMPb5pAkq4gI,3288
|
|
@@ -43,8 +43,33 @@ autocoder/agent/agentic_edit_tools/replace_in_file_tool_resolver.py,sha256=A2ODU
|
|
|
43
43
|
autocoder/agent/agentic_edit_tools/search_files_tool_resolver.py,sha256=Xx0nqrgBUP7MZuigdy_hjO89v1CgQEDE75O9la3VJbE,3754
|
|
44
44
|
autocoder/agent/agentic_edit_tools/use_mcp_tool_resolver.py,sha256=5WWH8-lEZO29dLOby9GNjkr-JH5rW8UT-7JZ1LuUtM8,2531
|
|
45
45
|
autocoder/agent/agentic_edit_tools/write_to_file_tool_resolver.py,sha256=HPX1g7Nh7H8I3P2MNmIK4HXLh8IZYaedQgRZAeGxNdc,5135
|
|
46
|
+
autocoder/agent/base_agentic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
47
|
+
autocoder/agent/base_agentic/agent_hub.py,sha256=3Al9rCKu-SRgAs1kvnMe4VIIErTIw85QTkhfFu5omO8,5605
|
|
48
|
+
autocoder/agent/base_agentic/agentic_lang.py,sha256=UCq1NY9USaYJakTWc-3cv_MeHxAb6se1PI4lsSwGrPM,3657
|
|
49
|
+
autocoder/agent/base_agentic/agentic_tool_display.py,sha256=UnAq8ovvpu88KLk19Ff0TW-Dq-k7YiRwZiIJgcYPwiY,6989
|
|
50
|
+
autocoder/agent/base_agentic/base_agent.py,sha256=cirGi77mw7OawO4Q1pGcqkhhNukKDS01-zzhnae_1yU,85580
|
|
51
|
+
autocoder/agent/base_agentic/default_tools.py,sha256=ggtJjysejfDWD6JoG4vBDFrnXFFPRm7JsVVG6XcKer8,33060
|
|
52
|
+
autocoder/agent/base_agentic/test_base_agent.py,sha256=jok9f-DoEagzZRWjk-Zpy3gKw2ztZrsNzEc0XlvE7HU,2804
|
|
53
|
+
autocoder/agent/base_agentic/tool_registry.py,sha256=YFnUXJ78y7g3pm3yGgrhZ-0mx-C1ctdcA0r_ljGiE6o,14292
|
|
54
|
+
autocoder/agent/base_agentic/types.py,sha256=y9BvgN1a38EWB3cIGYTgxPYsrHql09HyqdFmL7e76jQ,4159
|
|
55
|
+
autocoder/agent/base_agentic/utils.py,sha256=-AtaXBEp1dd9WnKrlkqiu8Ur5UfOvHko_fb32alCnN0,3264
|
|
56
|
+
autocoder/agent/base_agentic/tools/__init__.py,sha256=aBb5nA8dZAun6-4-7MTdJ74dGNQdA6RBrS73uom3ue0,332
|
|
57
|
+
autocoder/agent/base_agentic/tools/ask_followup_question_tool_resolver.py,sha256=_OL07TZ_bCGikX-DVv3HSrHT4jvZ7NYXd27J3pLWkIY,3081
|
|
58
|
+
autocoder/agent/base_agentic/tools/attempt_completion_tool_resolver.py,sha256=9a_qPihfm45Q22kmxmFwYrZrtNsgtEyBePL8D4SXfes,1487
|
|
59
|
+
autocoder/agent/base_agentic/tools/base_tool_resolver.py,sha256=Y0PmRPhBLLdZpr2DNV0W5goGfAqylM5m1bHxa3T6vAY,1009
|
|
60
|
+
autocoder/agent/base_agentic/tools/example_tool_resolver.py,sha256=8WBIqEH_76S0iBHBM3RhLkk14UpJ28lRAw6dNUT-0no,1388
|
|
61
|
+
autocoder/agent/base_agentic/tools/execute_command_tool_resolver.py,sha256=XZ9nkSejmLcwrjG187Q7fIEPdVMljQFDYWuUqcP6Yig,3735
|
|
62
|
+
autocoder/agent/base_agentic/tools/list_files_tool_resolver.py,sha256=rIKcJ0xVI6Exdmqb2LhUQFL6_GNQFuYazqQSJR0Sf2g,5468
|
|
63
|
+
autocoder/agent/base_agentic/tools/plan_mode_respond_tool_resolver.py,sha256=hiLdMRknR_Aljd7Ic2bOWZKs11aFHdhkRTKTlP3IIgw,1461
|
|
64
|
+
autocoder/agent/base_agentic/tools/read_file_tool_resolver.py,sha256=4GV8_hyVlO97MgI2pdUrxur3MFNJutlBT8r9OYfQjps,2857
|
|
65
|
+
autocoder/agent/base_agentic/tools/replace_in_file_tool_resolver.py,sha256=yvVwQNxTeG-jIWVbhLqpoDqjKzDWoSuWiIge13-7HnI,8015
|
|
66
|
+
autocoder/agent/base_agentic/tools/search_files_tool_resolver.py,sha256=s14ojQWxpWL0d4fzKan95Dya3t3S0oMy9CWrX6qa-ZM,6848
|
|
67
|
+
autocoder/agent/base_agentic/tools/talk_to_group_tool_resolver.py,sha256=t6y39KqCA3Jd865Xive7sO9dL-4OW10p7vRQr6-HLFE,3427
|
|
68
|
+
autocoder/agent/base_agentic/tools/talk_to_tool_resolver.py,sha256=8ERHMoFJTkZx02TFrsPWvpOQOr9HPJcxD7hBE5lXxpc,2668
|
|
69
|
+
autocoder/agent/base_agentic/tools/use_mcp_tool_resolver.py,sha256=Ph63zm6973nxRdRINV3ME0rhDWqtaEveHqLjEEMN02I,1554
|
|
70
|
+
autocoder/agent/base_agentic/tools/write_to_file_tool_resolver.py,sha256=aVXrKaUshne1iBxOimjU31mW9SXOZ1aHjqJjdZC31AM,2994
|
|
46
71
|
autocoder/chat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
47
|
-
autocoder/chat/conf_command.py,sha256=
|
|
72
|
+
autocoder/chat/conf_command.py,sha256=sqsZEjFXUCaCydXbqLU_ockpwQ7efQCicEd-hjD29ts,11353
|
|
48
73
|
autocoder/chat/models_command.py,sha256=yISjvqNbKHVapGcXMcsIwRFfPruJ5ruSqR_e8TqhaPw,20105
|
|
49
74
|
autocoder/chat/rules_command.py,sha256=V9-Om7N7c_6siudtZMWuALxe2GNMkgqorWAP4P_Wl4k,17396
|
|
50
75
|
autocoder/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -104,7 +129,7 @@ autocoder/common/printer.py,sha256=T4XTAcQp5w1ZWYx5NAUXlIGd-9500Vl0JaG1JJXMdkg,2
|
|
|
104
129
|
autocoder/common/recall_validation.py,sha256=Avt9Q9dX3kG6Pf2zsdlOHmsjd-OeSj7U1PFBDp_Cve0,1700
|
|
105
130
|
autocoder/common/result_manager.py,sha256=tvWtqSDhP7yKGtmB9s1pJAuRnB7nDgjM6eVrXF9n4e0,4169
|
|
106
131
|
autocoder/common/run_cmd.py,sha256=2VrJpeqooasUoc-WKVrvFfesmRR55kOpPmmYgpQrKVc,8283
|
|
107
|
-
autocoder/common/save_formatted_log.py,sha256=
|
|
132
|
+
autocoder/common/save_formatted_log.py,sha256=_echHX_sCA4oBrUasrmdITGCaP7DbLIhz2yeUYQhDpg,1771
|
|
108
133
|
autocoder/common/screenshots.py,sha256=_gA-z1HxGjPShBrtgkdideq58MG6rqFB2qMUJKjrycs,3769
|
|
109
134
|
autocoder/common/search.py,sha256=245iPFgWhMldoUK3CqCP89ltaxZiNPK73evoG6Fp1h8,16518
|
|
110
135
|
autocoder/common/search_replace.py,sha256=GphFkc57Hb673CAwmbiocqTbw8vrV7TrZxtOhD0332g,22147
|
|
@@ -133,7 +158,7 @@ autocoder/common/mcp_servers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
|
|
|
133
158
|
autocoder/common/mcp_servers/mcp_server_gpt4o_mini_search.py,sha256=TApShxgoozLluobXHOK1-oAE1zm0-9jdRoPLQB1qwMI,5688
|
|
134
159
|
autocoder/common/mcp_servers/mcp_server_perplexity.py,sha256=CIC26UkfH1lYoVCjfyY5xGGYVx8h0oz0Uj1c7YJ3OPw,5560
|
|
135
160
|
autocoder/common/rulefiles/__init__.py,sha256=babSbPdFaXk1NvdHtH2zrJLb_tWd7d2ELIyS8NApY_Y,221
|
|
136
|
-
autocoder/common/rulefiles/autocoderrules_utils.py,sha256=
|
|
161
|
+
autocoder/common/rulefiles/autocoderrules_utils.py,sha256=9AzimGtpmIGtqKZxDGHXMvHnVQb2axByExbFLk5RNgk,17592
|
|
137
162
|
autocoder/common/v2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
138
163
|
autocoder/common/v2/code_agentic_editblock_manager.py,sha256=pAh918YMgmLenXmNKXlmDPgKyVJjOuk69901VEEQHm4,34980
|
|
139
164
|
autocoder/common/v2/code_auto_generate.py,sha256=PAySLU8ZnpdF8GelwSCiEbzv7sBbn-Vhakinf4i6udE,11646
|
|
@@ -149,10 +174,10 @@ autocoder/common/v2/code_editblock_manager.py,sha256=DMwJw-FAM6VyaBQV3p4xespHpgZ
|
|
|
149
174
|
autocoder/common/v2/code_manager.py,sha256=C403bS-f6urixwitlKHcml-J03hci-UyNwHJOqBiY6Q,9182
|
|
150
175
|
autocoder/common/v2/code_strict_diff_manager.py,sha256=Bys7tFAq4G03R1zUZuxrszBTvP4QB96jIw2y5BDLyRM,9424
|
|
151
176
|
autocoder/common/v2/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
152
|
-
autocoder/common/v2/agent/agentic_edit.py,sha256=
|
|
177
|
+
autocoder/common/v2/agent/agentic_edit.py,sha256=6nLqFwvM79bFmuCcCUO-9i3ZwrDVa-oeyHu-Yc2DbLc,99626
|
|
153
178
|
autocoder/common/v2/agent/agentic_edit_conversation.py,sha256=pFgWPWHKhZ4J9EcFmIdiGsrSolTZuYcH1qkgKdD8nwk,7726
|
|
154
|
-
autocoder/common/v2/agent/agentic_edit_types.py,sha256=
|
|
155
|
-
autocoder/common/v2/agent/agentic_tool_display.py,sha256
|
|
179
|
+
autocoder/common/v2/agent/agentic_edit_types.py,sha256=ftFTXz-KF96GZvhnYRAxiiYOWfotwU_d9Lb8la2I47U,4779
|
|
180
|
+
autocoder/common/v2/agent/agentic_tool_display.py,sha256=-a-JTQLc4q03E_rdIILKMI0B6DHN-5gcGlrqq-mBYK4,7239
|
|
156
181
|
autocoder/common/v2/agent/ignore_utils.py,sha256=gnUchRzKMLbUm_jvnKL-r-K9MWKPtt-6iiuzijY7Es0,1717
|
|
157
182
|
autocoder/common/v2/agent/agentic_edit_tools/__init__.py,sha256=RbPZZcZg_VnGssL577GxSyFrYrxQ_LopJ4G_-mY3z_Q,1337
|
|
158
183
|
autocoder/common/v2/agent/agentic_edit_tools/ask_followup_question_tool_resolver.py,sha256=bwtf4m9N82TCP3piK5UglJk1FVFFm7ZX59XerA2qxko,3131
|
|
@@ -164,11 +189,11 @@ autocoder/common/v2/agent/agentic_edit_tools/list_files_tool_resolver.py,sha256=
|
|
|
164
189
|
autocoder/common/v2/agent/agentic_edit_tools/list_package_info_tool_resolver.py,sha256=dIdV12VuczHpHuHgx2B1j_3BZYc9PL0jfHCuBk9ryk8,2005
|
|
165
190
|
autocoder/common/v2/agent/agentic_edit_tools/plan_mode_respond_tool_resolver.py,sha256=lGT4_QYJK6Fa9f6HVSGo0cSsGK7qCsDYgJGUowNxPzk,1499
|
|
166
191
|
autocoder/common/v2/agent/agentic_edit_tools/read_file_tool_resolver.py,sha256=FWyJ9eJvSvF3DHGRDtSqmLUadEN9fdX7hWv5X3V_Y-U,2907
|
|
167
|
-
autocoder/common/v2/agent/agentic_edit_tools/replace_in_file_tool_resolver.py,sha256=
|
|
192
|
+
autocoder/common/v2/agent/agentic_edit_tools/replace_in_file_tool_resolver.py,sha256=Fe_zmKMQAahsYNU4_6BfsW4RHo_9KoIeltPfH7aX4LU,11027
|
|
168
193
|
autocoder/common/v2/agent/agentic_edit_tools/search_files_tool_resolver.py,sha256=ACvygitMVOroQ8I-07v9fIvX9Xm9bO1HrIW--Xv9qKw,6894
|
|
169
194
|
autocoder/common/v2/agent/agentic_edit_tools/test_search_files_tool_resolver.py,sha256=9eBo3WLkrr77iNotwIwVmH1ZL3UY0JQgLpdAIc9wTTM,6127
|
|
170
195
|
autocoder/common/v2/agent/agentic_edit_tools/use_mcp_tool_resolver.py,sha256=wM2Xy4bcnD0TSLEmcM8rvvyyWenN5_KQnJMO6hJ8lTE,1716
|
|
171
|
-
autocoder/common/v2/agent/agentic_edit_tools/write_to_file_tool_resolver.py,sha256=
|
|
196
|
+
autocoder/common/v2/agent/agentic_edit_tools/write_to_file_tool_resolver.py,sha256=UDUlpVWVRmEMuPHF1v8lkT56Ey22FywnM4l6fUPESU0,9156
|
|
172
197
|
autocoder/compilers/__init__.py,sha256=C0HOms70QA747XD0uZEMmGtRFcIPenohyqECNStv0Bw,1647
|
|
173
198
|
autocoder/compilers/base_compiler.py,sha256=dsTzMO4H_RoqWfE-SntIk2B52hWuvSlWVLtkdCbHgGs,3244
|
|
174
199
|
autocoder/compilers/compiler_config_api.py,sha256=QRSwWm_EX7jSeZ3dtQqM9HI__x5aZ7U0c3fHIW_2N48,13839
|
|
@@ -243,7 +268,7 @@ autocoder/rag/doc_filter.py,sha256=UduVO2mlrngwJICrefjDJTYfdmQ4GcRXrfWDQ7xXksk,1
|
|
|
243
268
|
autocoder/rag/document_retriever.py,sha256=rFwbAuHTvEFJq16HQNlmRLyJp2ddn2RNFslw_ncU7NI,8847
|
|
244
269
|
autocoder/rag/lang.py,sha256=HvcMeu6jReEJOGxyLMn4rwBoD-myFwmykS3VLceBJLs,3364
|
|
245
270
|
autocoder/rag/llm_wrapper.py,sha256=Ht5GF5yJtrztoliujsZzx_ooWZmHkd5xLZKcGEiicZw,4303
|
|
246
|
-
autocoder/rag/long_context_rag.py,sha256=
|
|
271
|
+
autocoder/rag/long_context_rag.py,sha256=zLo4SmdZ50Ex8egdXqwVx4Jp5cR1k4UMf49Z-_NbXL0,43550
|
|
247
272
|
autocoder/rag/qa_conversation_strategy.py,sha256=4CiMK88apKbJ2YM4HHq1KGpr5jUkTh0_m_aCyt-JYgc,10568
|
|
248
273
|
autocoder/rag/rag_config.py,sha256=8LwFcTd8OJWWwi1_WY4IzjqgtT6RyE2j4PjxS5cCTDE,802
|
|
249
274
|
autocoder/rag/rag_entry.py,sha256=6TKtErZ0Us9XSV6HgRKXA6yR3SiZGPHpynOKSaR1wgE,2463
|
|
@@ -252,6 +277,9 @@ autocoder/rag/relevant_utils.py,sha256=25wRiX-CrBsratASLGHsZE3ux7VjwaQoDNtl74UlV
|
|
|
252
277
|
autocoder/rag/searchable.py,sha256=miO2U-3J9JDYFOEv85vs9JExDQ0goLIeI20Ob2rNqU4,2067
|
|
253
278
|
autocoder/rag/simple_directory_reader.py,sha256=LkKreCkNdEOoL4fNhc3_hDoyyWTQUte4uqextISRz4U,24485
|
|
254
279
|
autocoder/rag/simple_rag.py,sha256=I902EUqOK1WM0Y2WFd7RzDJYofElvTZNLVCBtX5A9rc,14885
|
|
280
|
+
autocoder/rag/test_doc_filter.py,sha256=eE6IiMknCHDMVbdyOBQQVTKiyAnX1tAm7qFyfxmXSN0,15301
|
|
281
|
+
autocoder/rag/test_long_context_rag.py,sha256=hn50GKhXyRrlJ1mP9RI4bnObR6pZb2yDmJRcZmVSzVU,18365
|
|
282
|
+
autocoder/rag/test_token_limiter.py,sha256=rJmLUqPalkznL7PskKabuqu5dC6Yj-kWa498TaVMjAY,13744
|
|
255
283
|
autocoder/rag/token_checker.py,sha256=jc76x6KWmvVxds6W8juZfQGaoErudc2HenG3sNQfSLs,2819
|
|
256
284
|
autocoder/rag/token_counter.py,sha256=C-Lwc4oIjJpZDEqp9WLHGOe6hb4yhrdJpMtkrtp_1qc,2125
|
|
257
285
|
autocoder/rag/token_limiter.py,sha256=3VgJF4may3ESyATmBIiOe05oc3VsidJcJTJ5EhoSvH8,18854
|
|
@@ -283,7 +311,7 @@ autocoder/rag/stream_event/types.py,sha256=rtLwOE8rShmi1dJdxyBpAV5ZjLBGG9vptMiSz
|
|
|
283
311
|
autocoder/regex_project/__init__.py,sha256=EBZeCL5ORyD_9_5u_UuG4s7XtpXOu0y1sWDmxWFtufE,6781
|
|
284
312
|
autocoder/regexproject/__init__.py,sha256=QMXphSxjuv_LDIx0L_0jnnvCzMfmrOl0VMTVmXabeL0,8976
|
|
285
313
|
autocoder/shadows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
286
|
-
autocoder/shadows/shadow_manager.py,sha256=
|
|
314
|
+
autocoder/shadows/shadow_manager.py,sha256=atY6d9Si4twe3pqQ56SjMje5W1VxamPSZs_WzQtAQvM,19165
|
|
287
315
|
autocoder/suffixproject/__init__.py,sha256=Rew-M9W4pgO9cvw9UCdrc6QVCPdBhVcIpPBnJxrLJ3M,10374
|
|
288
316
|
autocoder/tsproject/__init__.py,sha256=e_TWVyXQQxYKsXqdQZuFVqNCQLdtBVNJRTs0fgLXVdA,11055
|
|
289
317
|
autocoder/utils/__init__.py,sha256=W47ac6IOZhNR1rdbho9fvhHnPI_N1i4oMcZOwxLelbU,1123
|
|
@@ -310,9 +338,9 @@ autocoder/utils/types.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
310
338
|
autocoder/utils/auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
311
339
|
autocoder/utils/auto_coder_utils/chat_stream_out.py,sha256=t902pKxQ5xM7zgIHiAOsTPLwxhE6VuvXAqPy751S7fg,14096
|
|
312
340
|
autocoder/utils/chat_auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
313
|
-
auto_coder-0.1.
|
|
314
|
-
auto_coder-0.1.
|
|
315
|
-
auto_coder-0.1.
|
|
316
|
-
auto_coder-0.1.
|
|
317
|
-
auto_coder-0.1.
|
|
318
|
-
auto_coder-0.1.
|
|
341
|
+
auto_coder-0.1.363.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
342
|
+
auto_coder-0.1.363.dist-info/METADATA,sha256=KehY_HMpGLKM6rmOq3jp4fJwGpmz8D_OhZjswgqhuYg,2775
|
|
343
|
+
auto_coder-0.1.363.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
344
|
+
auto_coder-0.1.363.dist-info/entry_points.txt,sha256=0nzHtHH4pNcM7xq4EBA2toS28Qelrvcbrr59GqD_0Ak,350
|
|
345
|
+
auto_coder-0.1.363.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
|
|
346
|
+
auto_coder-0.1.363.dist-info/RECORD,,
|
|
File without changes
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
import byzerllm
|
|
3
|
+
from typing import List, Dict, Optional, Literal, Any, Union
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
from loguru import logger
|
|
6
|
+
import threading
|
|
7
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
8
|
+
import os
|
|
9
|
+
from datetime import datetime
|
|
10
|
+
from .types import Message, ReplyDecision
|
|
11
|
+
from .utils import GroupUtils,GroupMemberResponse
|
|
12
|
+
|
|
13
|
+
if typing.TYPE_CHECKING:
|
|
14
|
+
from .base_agent import BaseAgent
|
|
15
|
+
|
|
16
|
+
class AgentHub:
|
|
17
|
+
"""管理所有Agent实例的全局中心"""
|
|
18
|
+
_instance = None
|
|
19
|
+
agents: Dict[str, 'BaseAgent'] = {}
|
|
20
|
+
|
|
21
|
+
def __new__(cls):
|
|
22
|
+
if cls._instance is None:
|
|
23
|
+
cls._instance = super().__new__(cls)
|
|
24
|
+
return cls._instance
|
|
25
|
+
|
|
26
|
+
@classmethod
|
|
27
|
+
def register_agent(cls, agent: 'BaseAgent'):
|
|
28
|
+
"""注册一个新的Agent"""
|
|
29
|
+
if agent.name in cls.agents:
|
|
30
|
+
raise ValueError(f"Agent with name {agent.name} already exists")
|
|
31
|
+
cls.agents[agent.name] = agent
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def get_agent(cls, name: str) -> Optional['BaseAgent']:
|
|
35
|
+
"""根据名称获取Agent"""
|
|
36
|
+
return cls.agents.get(name)
|
|
37
|
+
|
|
38
|
+
@classmethod
|
|
39
|
+
def list_agents(cls) -> List[str]:
|
|
40
|
+
"""获取所有Agent名称"""
|
|
41
|
+
return list(cls.agents.keys())
|
|
42
|
+
|
|
43
|
+
@classmethod
|
|
44
|
+
def get_all_groups(cls) -> List['Group']:
|
|
45
|
+
"""获取所有群组实例"""
|
|
46
|
+
return list(GroupHub.groups.values())
|
|
47
|
+
|
|
48
|
+
class GroupHub:
|
|
49
|
+
"""管理所有Group实例的全局中心"""
|
|
50
|
+
_instance = None
|
|
51
|
+
groups: Dict[str, 'Group'] = {}
|
|
52
|
+
_groups_lock = threading.RLock()
|
|
53
|
+
|
|
54
|
+
def __new__(cls):
|
|
55
|
+
if cls._instance is None:
|
|
56
|
+
cls._instance = super().__new__(cls)
|
|
57
|
+
return cls._instance
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def register_group(cls, group: 'Group'):
|
|
61
|
+
"""注册一个新的Group"""
|
|
62
|
+
with cls._groups_lock:
|
|
63
|
+
if group.name in cls.groups:
|
|
64
|
+
raise ValueError(f"Group with name {group.name} already exists")
|
|
65
|
+
cls.groups[group.name] = group
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def get_group(cls, name: str) -> Optional['Group']:
|
|
69
|
+
"""根据名称获取Group"""
|
|
70
|
+
with cls._groups_lock:
|
|
71
|
+
return cls.groups.get(name)
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def list_groups(cls) -> List[str]:
|
|
75
|
+
"""获取所有Group名称"""
|
|
76
|
+
with cls._groups_lock:
|
|
77
|
+
return list(cls.groups.keys())
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class Group:
|
|
82
|
+
# 类级线程池(所有 Group 实例共享)
|
|
83
|
+
_executor = ThreadPoolExecutor(max_workers=min(32, (os.cpu_count() or 1) * 4 + 4))
|
|
84
|
+
|
|
85
|
+
def __init__(self, name: str):
|
|
86
|
+
self.name = name
|
|
87
|
+
self.members: List[Agent] = []
|
|
88
|
+
self.history: List[Message] = []
|
|
89
|
+
# 成员列表和消息历史的读写锁
|
|
90
|
+
self._members_lock = threading.RLock()
|
|
91
|
+
self._history_lock = threading.RLock()
|
|
92
|
+
# 自动注册到GroupHub
|
|
93
|
+
GroupHub.register_group(self)
|
|
94
|
+
|
|
95
|
+
def add_member(self, agent: 'Agent'):
|
|
96
|
+
with self._members_lock:
|
|
97
|
+
if agent not in self.members:
|
|
98
|
+
self.members.append(agent)
|
|
99
|
+
with agent._group_lock: # 访问 Agent 的锁
|
|
100
|
+
agent.joined_groups[self.name] = self
|
|
101
|
+
|
|
102
|
+
def _safe_send_message(self, member: 'Agent', message: Message, print_conversation: bool):
|
|
103
|
+
try:
|
|
104
|
+
# 调用 Agent 的线程安全接收方法
|
|
105
|
+
member.threadsafe_receive(message,print_conversation=print_conversation)
|
|
106
|
+
except Exception as e:
|
|
107
|
+
import traceback
|
|
108
|
+
traceback.print_exc()
|
|
109
|
+
logger.error(f"Message delivery failed to {member.name}: {str(e)}")
|
|
110
|
+
|
|
111
|
+
def _handle_send_result(self, future):
|
|
112
|
+
try:
|
|
113
|
+
future.result()
|
|
114
|
+
except Exception as e:
|
|
115
|
+
logger.error(f"Message delivery error: {str(e)}")
|
|
116
|
+
|
|
117
|
+
def broadcast(self, message: Message, print_conversation: bool = False):
|
|
118
|
+
# 消息历史写入需要同步
|
|
119
|
+
with self._history_lock:
|
|
120
|
+
self.history.append(message)
|
|
121
|
+
|
|
122
|
+
# 使用线程池并行发送
|
|
123
|
+
futures = []
|
|
124
|
+
with self._members_lock: # 保护成员列表遍历
|
|
125
|
+
current_members = self.members.copy()
|
|
126
|
+
|
|
127
|
+
for member in current_members:
|
|
128
|
+
if member.name == message.sender:
|
|
129
|
+
continue
|
|
130
|
+
|
|
131
|
+
futures.append(
|
|
132
|
+
self._executor.submit(
|
|
133
|
+
self._safe_send_message,
|
|
134
|
+
member, message, print_conversation
|
|
135
|
+
)
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
# 异步等待所有任务完成(可选)
|
|
139
|
+
for future in futures:
|
|
140
|
+
future.add_done_callback(self._handle_send_result)
|
|
141
|
+
|
|
142
|
+
if print_conversation:
|
|
143
|
+
with self._history_lock: # 同步打印
|
|
144
|
+
print(f"[Group Broadcast End] {message.sender} finished broadcasting to {self.name} group")
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class GroupMembership:
|
|
148
|
+
def __init__(self, agent: 'BaseAgent', group: 'Group'):
|
|
149
|
+
self.agent = agent
|
|
150
|
+
self.group = group
|
|
151
|
+
|
|
152
|
+
def talk_to_all(self, content: str):
|
|
153
|
+
message = Message(
|
|
154
|
+
sender=self.agent.name,
|
|
155
|
+
content=content,
|
|
156
|
+
is_group=True,
|
|
157
|
+
group_name=self.group.name
|
|
158
|
+
)
|
|
159
|
+
self.group.broadcast(message)
|
|
160
|
+
|
|
161
|
+
def talk_to(self, content: str, mentions: List['BaseAgent']):
|
|
162
|
+
message = Message(
|
|
163
|
+
sender=self.agent.name,
|
|
164
|
+
content=f"@{' @'.join([a.name for a in mentions])} {content}",
|
|
165
|
+
is_group=True,
|
|
166
|
+
group_name=self.group.name,
|
|
167
|
+
mentions=[a.name for a in mentions]
|
|
168
|
+
)
|
|
169
|
+
self.group.broadcast(message)
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import locale
|
|
2
|
+
from byzerllm.utils import format_str_jinja2
|
|
3
|
+
|
|
4
|
+
MESSAGES = {
|
|
5
|
+
"auto_command_analyzing": {
|
|
6
|
+
"en": "Analyzing Command Request",
|
|
7
|
+
"zh": "正在分析命令请求"
|
|
8
|
+
},
|
|
9
|
+
# run_in_terminal方法的国际化文本
|
|
10
|
+
"agent_start": {
|
|
11
|
+
"en": "[bold cyan]Starting Agent: {{ project_name }}[/]",
|
|
12
|
+
"zh": "[bold cyan]启动代理: {{ project_name }}[/]"
|
|
13
|
+
},
|
|
14
|
+
"user_input": {
|
|
15
|
+
"en": "[bold]User Input:[/bold]\n{{ input }}",
|
|
16
|
+
"zh": "[bold]用户输入:[/bold]\n{{ input }}"
|
|
17
|
+
},
|
|
18
|
+
"user_input_title": {
|
|
19
|
+
"en": "Objective",
|
|
20
|
+
"zh": "目标"
|
|
21
|
+
},
|
|
22
|
+
"token_usage_log": {
|
|
23
|
+
"en": "Token Usage: Model={{ model }}, Input Tokens={{ input_tokens }}, Output Tokens={{ output_tokens }}, Input Cost=${{ input_cost }}, Output Cost=${{ output_cost }}",
|
|
24
|
+
"zh": "Token使用情况: 模型={{ model }}, 输入Token={{ input_tokens }}, 输出Token={{ output_tokens }}, 输入成本=${{ input_cost }}, 输出成本=${{ output_cost }}"
|
|
25
|
+
},
|
|
26
|
+
"tool_operation_title": {
|
|
27
|
+
"en": "🛠️ Operation: {{ tool_name }}",
|
|
28
|
+
"zh": "🛠️ 操作: {{ tool_name }}"
|
|
29
|
+
},
|
|
30
|
+
"tool_result_success_title": {
|
|
31
|
+
"en": "✅ Tool Result: {{ tool_name }}",
|
|
32
|
+
"zh": "✅ 工具结果: {{ tool_name }}"
|
|
33
|
+
},
|
|
34
|
+
"tool_result_failure_title": {
|
|
35
|
+
"en": "❌ Tool Result: {{ tool_name }}",
|
|
36
|
+
"zh": "❌ 工具结果: {{ tool_name }}"
|
|
37
|
+
},
|
|
38
|
+
"status": {
|
|
39
|
+
"en": "[bold]Status:[/bold] {{ status }}",
|
|
40
|
+
"zh": "[bold]状态:[/bold] {{ status }}"
|
|
41
|
+
},
|
|
42
|
+
"message": {
|
|
43
|
+
"en": "[bold]Message:[/bold] {{ message }}",
|
|
44
|
+
"zh": "[bold]消息:[/bold] {{ message }}"
|
|
45
|
+
},
|
|
46
|
+
"success_status": {
|
|
47
|
+
"en": "Success",
|
|
48
|
+
"zh": "成功"
|
|
49
|
+
},
|
|
50
|
+
"failure_status": {
|
|
51
|
+
"en": "Failure",
|
|
52
|
+
"zh": "失败"
|
|
53
|
+
},
|
|
54
|
+
"format_tool_error": {
|
|
55
|
+
"en": "Error formatting tool result content: {{ error }}",
|
|
56
|
+
"zh": "格式化工具结果内容时出错: {{ error }}"
|
|
57
|
+
},
|
|
58
|
+
"completion_title": {
|
|
59
|
+
"en": "🏁 Task Completed",
|
|
60
|
+
"zh": "🏁 任务完成"
|
|
61
|
+
},
|
|
62
|
+
"suggested_command": {
|
|
63
|
+
"en": "[dim]Suggested Command:[/dim] [bold cyan]{{ command }}[/]",
|
|
64
|
+
"zh": "[dim]建议命令:[/dim] [bold cyan]{{ command }}[/]"
|
|
65
|
+
},
|
|
66
|
+
"error_title": {
|
|
67
|
+
"en": "🔥 Error",
|
|
68
|
+
"zh": "🔥 错误"
|
|
69
|
+
},
|
|
70
|
+
"error_content": {
|
|
71
|
+
"en": "[bold red]Error:[/bold red] {{ message }}",
|
|
72
|
+
"zh": "[bold red]错误:[/bold red] {{ message }}"
|
|
73
|
+
},
|
|
74
|
+
"fatal_error_title": {
|
|
75
|
+
"en": "🔥 System Error",
|
|
76
|
+
"zh": "🔥 系统错误"
|
|
77
|
+
},
|
|
78
|
+
"fatal_error_content": {
|
|
79
|
+
"en": "[bold red]Fatal Error:[/bold red]\n{{ error }}",
|
|
80
|
+
"zh": "[bold red]致命错误:[/bold red]\n{{ error }}"
|
|
81
|
+
},
|
|
82
|
+
"shadow_merge_error": {
|
|
83
|
+
"en": "Error merging shadow changes to project: {{ error }}",
|
|
84
|
+
"zh": "合并影子更改到项目时出错: {{ error }}"
|
|
85
|
+
},
|
|
86
|
+
"agent_execution_complete": {
|
|
87
|
+
"en": "[bold cyan]Agent Execution Completed[/]",
|
|
88
|
+
"zh": "[bold cyan]代理执行完成[/]"
|
|
89
|
+
},
|
|
90
|
+
"unexpected_error": {
|
|
91
|
+
"en": "Unexpected error during agent execution:",
|
|
92
|
+
"zh": "代理执行过程中发生意外错误:"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def get_system_language():
|
|
98
|
+
try:
|
|
99
|
+
return locale.getdefaultlocale()[0][:2]
|
|
100
|
+
except:
|
|
101
|
+
return "en"
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def get_message(key):
|
|
105
|
+
lang = get_system_language()
|
|
106
|
+
if key in MESSAGES:
|
|
107
|
+
return MESSAGES[key].get(lang, MESSAGES[key].get("en", ""))
|
|
108
|
+
return ""
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def get_message_with_format(msg_key: str, **kwargs):
|
|
112
|
+
return format_str_jinja2(get_message(msg_key), **kwargs)
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from typing import Dict, Callable, Type
|
|
3
|
+
from autocoder.common.auto_coder_lang import get_system_language, format_str_jinja2
|
|
4
|
+
from autocoder.agent.base_agentic.types import (
|
|
5
|
+
BaseTool,
|
|
6
|
+
ReadFileTool, WriteToFileTool, ReplaceInFileTool, ExecuteCommandTool,
|
|
7
|
+
ListFilesTool, SearchFilesTool,
|
|
8
|
+
AskFollowupQuestionTool, UseMcpTool, AttemptCompletionTool
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
# Define message templates for each tool in English and Chinese
|
|
12
|
+
TOOL_DISPLAY_MESSAGES: Dict[Type[BaseTool], Dict[str, str]] = {
|
|
13
|
+
ReadFileTool: {
|
|
14
|
+
"en": "AutoCoder wants to read this file:\n[bold cyan]{{ path }}[/]",
|
|
15
|
+
"zh": "AutoCoder 想要读取此文件:\n[bold cyan]{{ path }}[/]"
|
|
16
|
+
},
|
|
17
|
+
WriteToFileTool: {
|
|
18
|
+
"en": (
|
|
19
|
+
"AutoCoder wants to write to this file:\n[bold cyan]{{ path }}[/]\n\n"
|
|
20
|
+
"[dim]Content Snippet:[/dim]\n{{ content_snippet }}{{ ellipsis }}"
|
|
21
|
+
),
|
|
22
|
+
"zh": (
|
|
23
|
+
"AutoCoder 想要写入此文件:\n[bold cyan]{{ path }}[/]\n\n"
|
|
24
|
+
"[dim]内容片段:[/dim]\n{{ content_snippet }}{{ ellipsis }}"
|
|
25
|
+
)
|
|
26
|
+
},
|
|
27
|
+
ReplaceInFileTool: {
|
|
28
|
+
"en": (
|
|
29
|
+
"AutoCoder wants to replace content in this file:\n[bold cyan]{{ path }}[/]\n\n"
|
|
30
|
+
"[dim]Diff Snippet:[/dim]\n{{ diff_snippet }}{{ ellipsis }}"
|
|
31
|
+
),
|
|
32
|
+
"zh": (
|
|
33
|
+
"AutoCoder 想要替换此文件中的内容:\n[bold cyan]{{ path }}[/]\n\n"
|
|
34
|
+
"[dim]差异片段:[/dim]\n{{ diff_snippet }}{{ ellipsis }}"
|
|
35
|
+
)
|
|
36
|
+
},
|
|
37
|
+
ExecuteCommandTool: {
|
|
38
|
+
"en": (
|
|
39
|
+
"AutoCoder wants to execute this command:\n[bold yellow]{{ command }}[/]\n"
|
|
40
|
+
"[dim](Requires Approval: {{ requires_approval }})[/]"
|
|
41
|
+
),
|
|
42
|
+
"zh": (
|
|
43
|
+
"AutoCoder 想要执行此命令:\n[bold yellow]{{ command }}[/]\n"
|
|
44
|
+
"[dim](需要批准:{{ requires_approval }})[/]"
|
|
45
|
+
)
|
|
46
|
+
},
|
|
47
|
+
ListFilesTool: {
|
|
48
|
+
"en": (
|
|
49
|
+
"AutoCoder wants to list files in:\n[bold green]{{ path }}[/] "
|
|
50
|
+
"{{ recursive_text }}"
|
|
51
|
+
),
|
|
52
|
+
"zh": (
|
|
53
|
+
"AutoCoder 想要列出此目录中的文件:\n[bold green]{{ path }}[/] "
|
|
54
|
+
"{{ recursive_text }}"
|
|
55
|
+
)
|
|
56
|
+
},
|
|
57
|
+
SearchFilesTool: {
|
|
58
|
+
"en": (
|
|
59
|
+
"AutoCoder wants to search files in:\n[bold green]{{ path }}[/]\n"
|
|
60
|
+
"[dim]File Pattern:[/dim] [yellow]{{ file_pattern }}[/]\n"
|
|
61
|
+
"[dim]Regex:[/dim] [yellow]{{ regex }}[/]"
|
|
62
|
+
),
|
|
63
|
+
"zh": (
|
|
64
|
+
"AutoCoder 想要在此目录中搜索文件:\n[bold green]{{ path }}[/]\n"
|
|
65
|
+
"[dim]文件模式:[/dim] [yellow]{{ file_pattern }}[/]\n"
|
|
66
|
+
"[dim]正则表达式:[/dim] [yellow]{{ regex }}[/]"
|
|
67
|
+
)
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
AskFollowupQuestionTool: {
|
|
71
|
+
"en": (
|
|
72
|
+
"AutoCoder is asking a question:\n[bold magenta]{{ question }}[/]\n"
|
|
73
|
+
"{{ options_text }}"
|
|
74
|
+
),
|
|
75
|
+
"zh": (
|
|
76
|
+
"AutoCoder 正在提问:\n[bold magenta]{{ question }}[/]\n"
|
|
77
|
+
"{{ options_text }}"
|
|
78
|
+
)
|
|
79
|
+
},
|
|
80
|
+
UseMcpTool: {
|
|
81
|
+
"en": (
|
|
82
|
+
"AutoCoder wants to use an MCP tool:\n"
|
|
83
|
+
"[dim]Server:[/dim] [blue]{{ server_name }}[/]\n"
|
|
84
|
+
"[dim]Tool:[/dim] [blue]{{ tool_name }}[/]\n"
|
|
85
|
+
"[dim]Args:[/dim] {{ arguments_snippet }}{{ ellipsis }}"
|
|
86
|
+
),
|
|
87
|
+
"zh": (
|
|
88
|
+
"AutoCoder 想要使用 MCP 工具:\n"
|
|
89
|
+
"[dim]服务器:[/dim] [blue]{{ server_name }}[/]\n"
|
|
90
|
+
"[dim]工具:[/dim] [blue]{{ tool_name }}[/]\n"
|
|
91
|
+
"[dim]参数:[/dim] {{ arguments_snippet }}{{ ellipsis }}"
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
def get_tool_display_message(tool: BaseTool) -> str:
|
|
97
|
+
"""
|
|
98
|
+
Generates a user-friendly, internationalized string representation for a tool call.
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
tool: The tool instance (Pydantic model).
|
|
102
|
+
|
|
103
|
+
Returns:
|
|
104
|
+
A formatted string for display in the terminal.
|
|
105
|
+
"""
|
|
106
|
+
lang = get_system_language()
|
|
107
|
+
tool_type = type(tool)
|
|
108
|
+
|
|
109
|
+
if tool_type not in TOOL_DISPLAY_MESSAGES:
|
|
110
|
+
# Fallback for unknown tools
|
|
111
|
+
return f"Unknown tool type: {tool_type.__name__}\nData: {tool.model_dump_json(indent=2)}"
|
|
112
|
+
|
|
113
|
+
templates = TOOL_DISPLAY_MESSAGES[tool_type]
|
|
114
|
+
template = templates.get(lang, templates.get("en", "Tool display template not found")) # Fallback to English
|
|
115
|
+
|
|
116
|
+
# Prepare context specific to each tool type
|
|
117
|
+
context = {}
|
|
118
|
+
if isinstance(tool, ReadFileTool):
|
|
119
|
+
context = {"path": tool.path}
|
|
120
|
+
elif isinstance(tool, WriteToFileTool):
|
|
121
|
+
snippet = tool.content[:150]
|
|
122
|
+
context = {
|
|
123
|
+
"path": tool.path,
|
|
124
|
+
"content_snippet": snippet,
|
|
125
|
+
"ellipsis": '...' if len(tool.content) > 150 else ''
|
|
126
|
+
}
|
|
127
|
+
elif isinstance(tool, ReplaceInFileTool):
|
|
128
|
+
snippet = tool.diff
|
|
129
|
+
context = {
|
|
130
|
+
"path": tool.path,
|
|
131
|
+
"diff_snippet": snippet,
|
|
132
|
+
"ellipsis": ''
|
|
133
|
+
}
|
|
134
|
+
elif isinstance(tool, ExecuteCommandTool):
|
|
135
|
+
context = {"command": tool.command, "requires_approval": tool.requires_approval}
|
|
136
|
+
elif isinstance(tool, ListFilesTool):
|
|
137
|
+
rec_text_en = '(Recursively)' if tool.recursive else '(Top Level)'
|
|
138
|
+
rec_text_zh = '(递归)' if tool.recursive else '(顶层)'
|
|
139
|
+
context = {
|
|
140
|
+
"path": tool.path,
|
|
141
|
+
"recursive_text": rec_text_zh if lang == 'zh' else rec_text_en
|
|
142
|
+
}
|
|
143
|
+
elif isinstance(tool, SearchFilesTool):
|
|
144
|
+
context = {
|
|
145
|
+
"path": tool.path,
|
|
146
|
+
"file_pattern": tool.file_pattern or '*',
|
|
147
|
+
"regex": tool.regex
|
|
148
|
+
}
|
|
149
|
+
elif isinstance(tool, ListCodeDefinitionNamesTool):
|
|
150
|
+
context = {"path": tool.path}
|
|
151
|
+
elif isinstance(tool, AskFollowupQuestionTool):
|
|
152
|
+
options_text_en = ""
|
|
153
|
+
options_text_zh = ""
|
|
154
|
+
if tool.options:
|
|
155
|
+
options_list_en = "\n".join([f"- {opt}" for opt in tool.options])
|
|
156
|
+
options_list_zh = "\n".join([f"- {opt}" for opt in tool.options]) # Assuming options are simple enough not to need translation
|
|
157
|
+
options_text_en = f"[dim]Options:[/dim]\n{options_list_en}"
|
|
158
|
+
options_text_zh = f"[dim]选项:[/dim]\n{options_list_zh}"
|
|
159
|
+
context = {
|
|
160
|
+
"question": tool.question,
|
|
161
|
+
"options_text": options_text_zh if lang == 'zh' else options_text_en
|
|
162
|
+
}
|
|
163
|
+
elif isinstance(tool, UseMcpTool):
|
|
164
|
+
args_str = tool.query
|
|
165
|
+
snippet = args_str[:100]
|
|
166
|
+
context = {
|
|
167
|
+
"server_name": tool.server_name,
|
|
168
|
+
"tool_name": tool.tool_name,
|
|
169
|
+
"arguments_snippet": snippet,
|
|
170
|
+
"ellipsis": '...' if len(args_str) > 100 else ''
|
|
171
|
+
}
|
|
172
|
+
else:
|
|
173
|
+
# Generic context for tools not specifically handled above
|
|
174
|
+
context = tool.model_dump()
|
|
175
|
+
|
|
176
|
+
try:
|
|
177
|
+
return format_str_jinja2(template, **context)
|
|
178
|
+
except Exception as e:
|
|
179
|
+
# Fallback in case of formatting errors
|
|
180
|
+
return f"Error formatting display for {tool_type.__name__}: {e}\nTemplate: {template}\nContext: {context}"
|