auto-coder 0.1.339__py3-none-any.whl → 0.1.341__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.

@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: auto-coder
3
- Version: 0.1.339
3
+ Version: 0.1.341
4
4
  Summary: AutoCoder: AutoCoder
5
5
  Author: allwefantasy
6
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
7
- Classifier: Programming Language :: Python :: 3.9
8
6
  Classifier: Programming Language :: Python :: 3.10
7
+ Classifier: Programming Language :: Python :: 3.11
8
+ Classifier: Programming Language :: Python :: 3.12
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
11
  Requires-Dist: contextlib2
@@ -4,7 +4,7 @@ autocoder/auto_coder_lang.py,sha256=Rtupq6N3_HT7JRhDKdgCBcwRaiAnyCOR_Gsp4jUomrI,
4
4
  autocoder/auto_coder_rag.py,sha256=NesRm7sIJrRQL1xxm_lbMtM7gi-KrYv9f26RfBuloZE,35386
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=Xrzeo9u7UIvIjKgaV12O-XItl10dhjogp-7TNIvqAP8,111518
7
+ autocoder/auto_coder_runner.py,sha256=-6s6wLoiedOjcUPP-658jovP08frJ4csJk3QP8ssvGo,111781
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=CthuvdjVjTQOVv-zREsl8OCsZHPSP9OQcIgHULrW2Ro,25842
@@ -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=_SCar82QIeBFTZZBdM2jPS6atKVhHnvE0gX3V0CsxD4,11590
16
16
  autocoder/run_context.py,sha256=IUfSO6_gp2Wt1blFWAmOpN0b0nDrTTk4LmtCYUBIoro,1643
17
- autocoder/version.py,sha256=-seC5wEXkr8QKedh44SePAzcBOumRQcM3gKZh2mLQy0,23
17
+ autocoder/version.py,sha256=LegJaIowJMsa5uThYESSu9bRr94ij_6zuPr7GfWvb-4,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
@@ -126,8 +126,8 @@ autocoder/common/v2/code_editblock_manager.py,sha256=G0CIuV9Ki0FqMLnpA8nBT4pnkCN
126
126
  autocoder/common/v2/code_manager.py,sha256=C403bS-f6urixwitlKHcml-J03hci-UyNwHJOqBiY6Q,9182
127
127
  autocoder/common/v2/code_strict_diff_manager.py,sha256=v-J1kDyLg7tLGg_6_lbO9S4fNkx7M_L8Xr2G7fPptiU,9347
128
128
  autocoder/common/v2/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
129
- autocoder/common/v2/agent/agentic_edit.py,sha256=KnnzwDb54ptMtFgvGjCTOuzHd0Er4LRDuOeHHSLT9qY,88698
130
- autocoder/common/v2/agent/agentic_edit_conversation.py,sha256=2GZrw5f8Sh9GgUDnuFc2v7Q4syrm77kKEfXI6k6uEFY,7310
129
+ autocoder/common/v2/agent/agentic_edit.py,sha256=e35KhV0hTz973RcF98qylVFCaBoWtC0EufmEZgHrHD4,91123
130
+ autocoder/common/v2/agent/agentic_edit_conversation.py,sha256=qLLhTegH619JQTp3s1bj5FVn2hAcoV-DlhGO3UyIOMc,7338
131
131
  autocoder/common/v2/agent/agentic_edit_types.py,sha256=6qBLLmvdlcsbzrpMHsYQVIHqbOWubMXOnmkqTs1pBWQ,4629
132
132
  autocoder/common/v2/agent/agentic_tool_display.py,sha256=WKirt-2V346KLnbHgH3NVJiK3xvriD9oaCWj2IdvzLU,7309
133
133
  autocoder/common/v2/agent/agentic_edit_tools/__init__.py,sha256=wGICCc1dYh07osB21j62zOQ9Ws0PyyOQ12UYRHmHrtI,1229
@@ -140,7 +140,7 @@ autocoder/common/v2/agent/agentic_edit_tools/list_files_tool_resolver.py,sha256=
140
140
  autocoder/common/v2/agent/agentic_edit_tools/plan_mode_respond_tool_resolver.py,sha256=SZwFUxK6d2BaKWqQXi_c3IVe2iffviF6VUXJA9T9sx0,1492
141
141
  autocoder/common/v2/agent/agentic_edit_tools/read_file_tool_resolver.py,sha256=9Bh0KVbL0qiIqwChlb77biiBiETQ3zekxGe5Fj7hXAg,2800
142
142
  autocoder/common/v2/agent/agentic_edit_tools/replace_in_file_tool_resolver.py,sha256=lpD4fCbVR8GTrynqXON69IjM94nPy3nuUL62Ashm5O4,7988
143
- autocoder/common/v2/agent/agentic_edit_tools/search_files_tool_resolver.py,sha256=K-TcqY0z7nDupMkTRDAJdqW3z2Y_RUM_wUb-pOEVQRI,6044
143
+ autocoder/common/v2/agent/agentic_edit_tools/search_files_tool_resolver.py,sha256=ew0RwJ4oGjnpBOyYYtfxbFqU5W_kclT6FrCkpOB-tgs,6058
144
144
  autocoder/common/v2/agent/agentic_edit_tools/use_mcp_tool_resolver.py,sha256=wM2Xy4bcnD0TSLEmcM8rvvyyWenN5_KQnJMO6hJ8lTE,1716
145
145
  autocoder/common/v2/agent/agentic_edit_tools/write_to_file_tool_resolver.py,sha256=UO4SrkDek3WDlRdlHH022W1roSNMdMcipJqDxRBlheM,3044
146
146
  autocoder/compilers/__init__.py,sha256=C0HOms70QA747XD0uZEMmGtRFcIPenohyqECNStv0Bw,1647
@@ -250,7 +250,7 @@ autocoder/regex_project/__init__.py,sha256=EBZeCL5ORyD_9_5u_UuG4s7XtpXOu0y1sWDmx
250
250
  autocoder/regexproject/__init__.py,sha256=QMXphSxjuv_LDIx0L_0jnnvCzMfmrOl0VMTVmXabeL0,8976
251
251
  autocoder/shadows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
252
252
  autocoder/shadows/shadow_manager.py,sha256=_DINnvD3oPaHopagL3B3PL0FFfEz7U6DYSEvEkJZ2yE,19230
253
- autocoder/suffixproject/__init__.py,sha256=XZwHQuY5QLRpb__wS2Kad2wQGHSuY-PoANkdwGl0D6s,10354
253
+ autocoder/suffixproject/__init__.py,sha256=Rew-M9W4pgO9cvw9UCdrc6QVCPdBhVcIpPBnJxrLJ3M,10374
254
254
  autocoder/tsproject/__init__.py,sha256=e_TWVyXQQxYKsXqdQZuFVqNCQLdtBVNJRTs0fgLXVdA,11055
255
255
  autocoder/utils/__init__.py,sha256=W47ac6IOZhNR1rdbho9fvhHnPI_N1i4oMcZOwxLelbU,1123
256
256
  autocoder/utils/_markitdown.py,sha256=RU88qn4eZfYIy0GDrPxlI8oYXIypbi63VRJjdlnE0VU,47431
@@ -276,9 +276,9 @@ autocoder/utils/types.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
276
276
  autocoder/utils/auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
277
277
  autocoder/utils/auto_coder_utils/chat_stream_out.py,sha256=KW0mlmcHlStXi8-_6fXZ2-ifeJ5mgP0OV7DQFzCtIsw,14008
278
278
  autocoder/utils/chat_auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
279
- auto_coder-0.1.339.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
280
- auto_coder-0.1.339.dist-info/METADATA,sha256=MnX-I9AFRF5xVGXxuurajWhBPbN6GwMpfyx4aOZK4do,2747
281
- auto_coder-0.1.339.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
282
- auto_coder-0.1.339.dist-info/entry_points.txt,sha256=0nzHtHH4pNcM7xq4EBA2toS28Qelrvcbrr59GqD_0Ak,350
283
- auto_coder-0.1.339.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
284
- auto_coder-0.1.339.dist-info/RECORD,,
279
+ auto_coder-0.1.341.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
280
+ auto_coder-0.1.341.dist-info/METADATA,sha256=nXClzn15uBj3sXwn4stOcwYHoOwt52vJTA1_uE9Xa0o,2728
281
+ auto_coder-0.1.341.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
282
+ auto_coder-0.1.341.dist-info/entry_points.txt,sha256=0nzHtHH4pNcM7xq4EBA2toS28Qelrvcbrr59GqD_0Ak,350
283
+ auto_coder-0.1.341.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
284
+ auto_coder-0.1.341.dist-info/RECORD,,
@@ -2821,8 +2821,9 @@ def generate_new_yaml(query: str):
2821
2821
  def auto_command(query: str,extra_args: Dict[str,Any]={}):
2822
2822
  """处理/auto指令"""
2823
2823
  args = get_final_config()
2824
- memory = get_memory()
2825
- if args.enable_agentic_edit:
2824
+ memory = get_memory()
2825
+ if args.enable_agentic_edit:
2826
+ from autocoder.run_context import get_run_context,RunMode
2826
2827
  execute_file,args = generate_new_yaml(query)
2827
2828
  args.file = execute_file
2828
2829
  current_files = memory.get("current_files",{}).get("files",[])
@@ -2831,16 +2832,20 @@ def auto_command(query: str,extra_args: Dict[str,Any]={}):
2831
2832
  with open(file,"r",encoding="utf-8") as f:
2832
2833
  sources.append(SourceCode(module_name=file,source_code=f.read()))
2833
2834
 
2834
- llm = get_single_llm(args.code_model or args.model,product_mode=args.product_mode)
2835
- agent = AgenticEdit(llm=llm,args=args,files=SourceCodeList(sources=sources),
2836
- conversation_history=[],
2837
- memory_config=MemoryConfig(memory=memory,
2838
- save_memory_func=save_memory), command_config=CommandConfig,
2839
- conversation_name="current"
2840
- )
2835
+ llm = get_single_llm(args.code_model or args.model,product_mode=args.product_mode)
2836
+ conversation_history = extra_args.get("conversations",[])
2837
+ agent = AgenticEdit(llm=llm,args=args,files=SourceCodeList(sources=sources),
2838
+ conversation_history=conversation_history,
2839
+ memory_config=MemoryConfig(memory=memory,
2840
+ save_memory_func=save_memory), command_config=CommandConfig,
2841
+ conversation_name="current"
2842
+ )
2843
+ if get_run_context() == RunMode.TERMINAL:
2841
2844
  agent.run_in_terminal(AgenticEditRequest(user_input=query))
2842
- return
2843
-
2845
+ else:
2846
+ agent.run_with_events(AgenticEditRequest(user_input=query))
2847
+ return
2848
+
2844
2849
  args = get_final_config()
2845
2850
  # 准备请求参数
2846
2851
  request = AutoCommandRequest(
@@ -11,6 +11,7 @@ from autocoder.common.printer import Printer
11
11
  from rich.console import Console
12
12
  from rich.panel import Panel
13
13
  from pydantic import SkipValidation
14
+ from byzerllm.utils.types import SingleOutputMeta
14
15
 
15
16
  # Removed ResultManager, stream_out, git_utils, AutoCommandTools, count_tokens, global_cancel, ActionYmlFileManager, get_event_manager, EventContentCreator, get_run_context, AgenticFilterStreamOutType
16
17
  from autocoder.common import AutoCoderArgs, git_utils, SourceCodeList, SourceCode
@@ -118,6 +119,8 @@ class AgenticEdit:
118
119
 
119
120
  self.conversation_manager = AgenticConversation(
120
121
  args, self.conversation_history, conversation_name=conversation_name)
122
+ # 当前不开启历史记录,所以清空
123
+ self.conversation_manager.clear_history()
121
124
 
122
125
  self.shadow_manager = ShadowManager(
123
126
  args.source_dir, args.event_file, args.ignore_clean_shadows)
@@ -744,12 +747,13 @@ class AgenticEdit:
744
747
  self.conversation_manager.add_user_message(request.user_input)
745
748
  logger.debug(
746
749
  f"Initial conversation history size: {len(conversations)}")
747
-
750
+
751
+ tool_executed = False
748
752
  while True:
749
753
  global_cancel.check_and_raise()
750
754
  logger.info(
751
755
  f"Starting LLM interaction cycle. History size: {len(conversations)}")
752
- tool_executed = False
756
+
753
757
  assistant_buffer = ""
754
758
 
755
759
  llm_response_gen = stream_chat_with_continue(
@@ -1142,7 +1146,44 @@ class AgenticEdit:
1142
1146
  metadata={}
1143
1147
  )
1144
1148
  event_manager.write_result(
1145
- content=content.to_dict(), metadata=metadata)
1149
+ content=content.to_dict(), metadata=metadata.to_dict())
1150
+ elif isinstance(agent_event, PlanModeRespondEvent):
1151
+ metadata.path = "/agent/edit/plan_mode_respond"
1152
+ content = EventContentCreator.create_markdown_result(
1153
+ content=agent_event.completion.response,
1154
+ metadata={}
1155
+ )
1156
+ event_manager.write_result(
1157
+ content=content.to_dict(), metadata=metadata.to_dict())
1158
+
1159
+ elif isinstance(agent_event, TokenUsageEvent):
1160
+ last_meta: SingleOutputMeta = agent_event.usage
1161
+ # Get model info for pricing
1162
+ from autocoder.utils import llms as llm_utils
1163
+ model_name = ",".join(llm_utils.get_llm_names(self.llm))
1164
+ model_info = llm_utils.get_model_info(
1165
+ model_name, self.args.product_mode) or {}
1166
+ input_price = model_info.get(
1167
+ "input_price", 0.0) if model_info else 0.0
1168
+ output_price = model_info.get(
1169
+ "output_price", 0.0) if model_info else 0.0
1170
+
1171
+ # Calculate costs
1172
+ input_cost = (last_meta.input_tokens_count *
1173
+ input_price) / 1000000 # Convert to millions
1174
+ # Convert to millions
1175
+ output_cost = (
1176
+ last_meta.generated_tokens_count * output_price) / 1000000
1177
+
1178
+ get_event_manager(self.args.event_file).write_result(
1179
+ EventContentCreator.create_result(content=EventContentCreator.ResultTokenStatContent(
1180
+ model_name=model_name,
1181
+ elapsed_time=0.0,
1182
+ first_token_time=last_meta.first_token_time,
1183
+ input_tokens=last_meta.input_tokens_count,
1184
+ output_tokens=last_meta.generated_tokens_count,
1185
+ ).to_dict()),metadata=metadata.to_dict())
1186
+
1146
1187
  elif isinstance(agent_event, CompletionEvent):
1147
1188
  # 在这里完成实际合并
1148
1189
  try:
@@ -1156,7 +1197,7 @@ class AgenticEdit:
1156
1197
  success_code="AGENT_COMPLETE",
1157
1198
  success_message="Agent attempted task completion.",
1158
1199
  result={
1159
- **agent_event.completion.model_dump()
1200
+ "response": agent_event.completion.result
1160
1201
  }
1161
1202
  )
1162
1203
  event_manager.write_completion(
@@ -1200,7 +1241,7 @@ class AgenticEdit:
1200
1241
  def apply_changes(self):
1201
1242
  """
1202
1243
  Apply all tracked file changes to the original project directory.
1203
- """
1244
+ """
1204
1245
  for (file_path, change) in self.get_all_file_changes().items():
1205
1246
  with open(file_path, 'w', encoding='utf-8') as f:
1206
1247
  f.write(change.content)
@@ -144,6 +144,7 @@ class AgenticConversation:
144
144
  def clear_history(self):
145
145
  """Clears the conversation history."""
146
146
  self._history = []
147
+ self._save_memory()
147
148
 
148
149
  def __len__(self) -> int:
149
150
  """Returns the number of messages in the history."""
@@ -54,7 +54,7 @@ class SearchFilesToolResolver(BaseToolResolver):
54
54
  compiled_regex = re.compile(regex_pattern)
55
55
  search_glob_pattern = os.path.join(search_base_path, "**", file_pattern)
56
56
 
57
- ignored_dirs = ['.git', 'node_modules', '.mvn', '.idea', '__pycache__', '.venv', 'venv', 'dist', 'build', '.gradle']
57
+ ignored_dirs = ['.git',".auto-coder", 'node_modules', '.mvn', '.idea', '__pycache__', '.venv', 'venv', 'dist', 'build', '.gradle']
58
58
  logger.info(f"Searching for regex '{regex_pattern}' in files matching '{file_pattern}' under '{search_base_path}' (shadow: {shadow_exists}), ignoring directories: {ignored_dirs}")
59
59
 
60
60
  for filepath in glob.glob(search_glob_pattern, recursive=True):
@@ -57,6 +57,7 @@ class SuffixProject:
57
57
  "actions",
58
58
  ".idea",
59
59
  "venv",
60
+ ".next"
60
61
  ]
61
62
 
62
63
  @byzerllm.prompt()
autocoder/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.339"
1
+ __version__ = "0.1.341"