auto-coder 2.0.0__py3-none-any.whl → 2.0.1__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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: auto-coder
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: AutoCoder: AutoCoder
5
5
  Author: allwefantasy
6
6
  Author-email: allwefantasy <allwefantasy@gmail.com>
@@ -1,7 +1,7 @@
1
1
  autocoder/__init__.py,sha256=NEhXal38_QBSv5oLypJTO8MAr_cOVjGoKWk_P6N9rqQ,897
2
2
  autocoder/auto_coder.py,sha256=aIr8mt_qnkHSOQFIOPXzMj6CD7UEIKA_FSfgdd818lk,46139
3
3
  autocoder/auto_coder_rag.py,sha256=zGuNBrelZEAKRVUNJOM0gziLvJurXgBSDRZ2hrP3gAQ,449
4
- autocoder/auto_coder_runner.py,sha256=DzLb6k7yf14dOX2nqLnH0JszRUWNRnQxLJcGr8aIhFQ,73454
4
+ autocoder/auto_coder_runner.py,sha256=TXW9ZapYFyiJ1sZt16FtoFBAqikolwdkrexDsW7-Fkw,73082
5
5
  autocoder/auto_coder_terminal.py,sha256=ck5AZs3h4ShL41UQZym11C7fcqJMDGnudd4wToGMihw,568
6
6
  autocoder/auto_coder_terminal_v3.py,sha256=wCfzSKd2PDsA5C2Js65p8ribd1gWbDv2gzJp6bdtT8c,5365
7
7
  autocoder/chat_auto_coder.py,sha256=qfM1JwtooPQ2hcc7FIIjwZc8gp3kYXrmgjQTd1Xu3rw,49782
@@ -11,7 +11,7 @@ autocoder/lang.py,sha256=PFtATuOhHRnfpqHQkXr6p4C893JvpsgwTMif3l-GEi0,14321
11
11
  autocoder/models.py,sha256=qFYDLt0F5tbXi58mlc-2uVF3_g4L1sFkV3dJD8fixSc,7975
12
12
  autocoder/rags.py,sha256=WhpcjVHhzlJO4IuvFTzQv7N3A1dkQdp1Lbra9hVOGys,11838
13
13
  autocoder/run_context.py,sha256=Oiw0fIdpbnNGdcTPVWF5aC-SPErCDUQ0JgbHVrfXkK0,1925
14
- autocoder/version.py,sha256=4FeKNv9PYjhtFNUEPqXP_AFXquUS578gA_QnPa2qPLc,161
14
+ autocoder/version.py,sha256=9NDruQl26yNLIYu7HsDDYZNbq6Z4Ga63RFXP9o5lLa4,161
15
15
  autocoder/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  autocoder/agent/auto_demand_organizer.py,sha256=URAq0gSEiHeV_W4zwhOI_83kHz0Ryfj1gcfh5jwCv_w,6501
17
17
  autocoder/agent/auto_filegroup.py,sha256=vLXC8FBxf9CZfE-M5iQ6AJJWIQaC2TeMKC4gERInohs,7051
@@ -51,7 +51,7 @@ autocoder/agent/base_agentic/tools/use_mcp_tool_resolver.py,sha256=Ph63zm6973nxR
51
51
  autocoder/agent/base_agentic/tools/write_to_file_tool_resolver.py,sha256=i4nPprmYPGs6yqKxQnA_RZowZmuYkDz6iETSFlIlcgE,8790
52
52
  autocoder/agent/entry_command_agent/__init__.py,sha256=7SHnGHmLJhmB-kmCskf-qIeIzouq6Sc7pWyeU4jtnn4,848
53
53
  autocoder/agent/entry_command_agent/auto_tool.py,sha256=Wf-zHL4lCWkggjQ-hEP4L3dJ8cqo8Y2Fl2gDmdzFKzM,1505
54
- autocoder/agent/entry_command_agent/chat.py,sha256=qFLFcTHSJZvhAstk65q7svqubNkW71ZHumbDoQxbco8,20206
54
+ autocoder/agent/entry_command_agent/chat.py,sha256=9pnA7jvtox3luX5SaONgQOOKDXzCnSGJ3agiC-AOT_Y,20094
55
55
  autocoder/agent/entry_command_agent/designer.py,sha256=iCPRJIK-aVpbcdDuUBjCBYq97TgamDTU30TVhik4HBA,1427
56
56
  autocoder/agent/entry_command_agent/generate_command.py,sha256=VmYPzkY-5ikxJ6nl_tPg4WaVwfBJ3Z6oKXNKBOmgLQE,1145
57
57
  autocoder/agent/entry_command_agent/project_reader.py,sha256=wPoMCrTaByYcUnxpgHFLRCaNLwc8pSjNGORIHz3W9Bw,1871
@@ -215,7 +215,7 @@ autocoder/common/file_handler/__init__.py,sha256=tbANP4tqMubF4dUGBRuFQD9pHASjoKS
215
215
  autocoder/common/file_handler/active_context_handler.py,sha256=hmQV-YJzykpHE_xNsFCIHKjwa8YZBVo8PZrh2Hzvjms,6049
216
216
  autocoder/common/file_handler/add_files_handler.py,sha256=drhS7viWOEMf7z7PaH257nNrsNWVAsAAuCD1NRXrtys,16192
217
217
  autocoder/common/file_handler/chat_handler.py,sha256=Vke9bjhVwb6eZl2jNT8GgdyV3mGojSn8AwUYeSUo01c,5964
218
- autocoder/common/file_handler/coding_handler.py,sha256=gd78yLeqSwzXpeHmgefqN-FmgWnhQl0k622h1YST49Q,14692
218
+ autocoder/common/file_handler/coding_handler.py,sha256=br8S2Oy7IhBnoD1Cacx7FtbDq8EewAMtGZOoncP2i6Y,14861
219
219
  autocoder/common/file_handler/commit_handler.py,sha256=mYZ5dEKGATzyi4lOzEpEOP7ra_PSTgAu4Ldkict9jc0,7318
220
220
  autocoder/common/file_handler/lib_handler.py,sha256=fdqg9GM_1V1M8EaCapFx10rd6y-yo-NJCSakRM0koeI,5341
221
221
  autocoder/common/file_handler/list_files_handler.py,sha256=sBSfRmFoYA3GGOi6LeZXgkYmRzojz3y-ffZkMQK8dBc,4009
@@ -284,7 +284,7 @@ autocoder/common/llms/demo_error_handling.py,sha256=Z3traNClk9iSTjDmtALuGaF_F5yW
284
284
  autocoder/common/llms/factory.py,sha256=XaCNx7PGjAvwSmvMV-4oac6zbGbjByVEXvU2kS8LZKs,5620
285
285
  autocoder/common/llms/manager.py,sha256=ffc0TdUmdF2jHkmqHsmnsezMyZl5ONfihBOQYfcTv3E,9477
286
286
  autocoder/common/llms/pricing.py,sha256=9Y52-WL7BLfAU41PoEQVBFsgm8WTveBKvUeOvsITQdE,3622
287
- autocoder/common/llms/registry.py,sha256=WmaCPmVu9rekWVzx-p0RU_msipl1mkNQNl4H8IZxUMY,10531
287
+ autocoder/common/llms/registry.py,sha256=PaHOt5E3AxRnB78eDt6SE2vXte5qozzLpTlxi6fbyyQ,11474
288
288
  autocoder/common/llms/schema.py,sha256=h2BAZATFHxedQshOB9JqxHxLWL2cSieE4RqPR62Pvys,3357
289
289
  autocoder/common/llms/simple_demo.py,sha256=0IK7oXaPul2GWs5eqUFNrtPCzI-s8-JjwEApvHJK_1g,1276
290
290
  autocoder/common/llms/test_quick_model.py,sha256=873S1ZNK86y2PAaFlORKn5rOLestTMmYw21VTgjiIKE,4060
@@ -489,7 +489,7 @@ autocoder/common/v2/agent/agentic_edit_tools/linter_config_models.py,sha256=3E3c
489
489
  autocoder/common/v2/agent/agentic_edit_tools/linter_enabled_tool_resolver.py,sha256=YQsbgNrTEzHCiy2Iv-bJ5txr81nuZSNYpye8T1n4tXY,7783
490
490
  autocoder/common/v2/agent/agentic_edit_tools/list_code_definition_names_tool_resolver.py,sha256=8QoMsADUDWliqiDt_dpguz31403syB8eeW0Pcw-qfb8,3842
491
491
  autocoder/common/v2/agent/agentic_edit_tools/list_files_tool_resolver.py,sha256=Keh88CCPISDxdTmvNEIZKv1oUoqfB_NgnoIUxcrrLu8,11119
492
- autocoder/common/v2/agent/agentic_edit_tools/load_extra_document_tool_resolver.py,sha256=eR9WeAd8ElkUPdMt-NItNO0jQTu77W0spKCkIUbUkmc,13341
492
+ autocoder/common/v2/agent/agentic_edit_tools/load_extra_document_tool_resolver.py,sha256=oHWqETN0R5gHOiPTdrUD_q0xNF8X2CXuZhfMlmjxLA8,13836
493
493
  autocoder/common/v2/agent/agentic_edit_tools/plan_mode_respond_tool_resolver.py,sha256=lGT4_QYJK6Fa9f6HVSGo0cSsGK7qCsDYgJGUowNxPzk,1499
494
494
  autocoder/common/v2/agent/agentic_edit_tools/read_file_tool_resolver.py,sha256=h2iyQ524_p1GPdqN_-iWea8SeQ1WSTt-Lvjo9tAwARo,14632
495
495
  autocoder/common/v2/agent/agentic_edit_tools/replace_in_file_tool_resolver.py,sha256=rLLPwNSqOOWuRyGTUWSS6ZrRhQ6wEcgls5LSThr-1os,35811
@@ -543,7 +543,7 @@ autocoder/compilers/reactjs_compiler.py,sha256=h1_9OqiA8ca84-u3DIxQifvtH-2FSsKFW
543
543
  autocoder/compilers/shadow_compiler.py,sha256=ARx2DBr1U521u7kKnZqg3GbLMi8ggGaX5D7VEckej3U,1699
544
544
  autocoder/compilers/vue_compiler.py,sha256=_wOjaDdz8FiameLML_PxHZb_uP24AVenhJVO1lRNP4Q,19745
545
545
  autocoder/completer/__init__.py,sha256=moRG9r4bru9QonSdvmfq_DNfe5-4--50uiXYT1ba6pY,200
546
- autocoder/completer/command_completer_v2.py,sha256=y2uOxxCKvsqHB2aGwYVdhBhr_0Aj428R1h7aUwQLVWc,43495
546
+ autocoder/completer/command_completer_v2.py,sha256=RsN2I7f8wrwMpnFrZQB_781Zwtdnup-L_SPuxerBb5w,45658
547
547
  autocoder/data/byzerllm.md,sha256=SGCMpEaUQ0ysPxQsgzyyp5sgvEr8dZsxEGAfVcPBIq0,47741
548
548
  autocoder/data/tokenizer.json,sha256=7Lb5_DaYlDRvBRH0B0ynXO5c1fOwbQLxujX805-OEh0,7847602
549
549
  autocoder/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -551,7 +551,7 @@ autocoder/db/store.py,sha256=tFT66bP2ZKIqZip-uhLkHRSLaaOAUUDZfozJwcqix3c,1908
551
551
  autocoder/default_project/__init__.py,sha256=sa7yZn7iMmaT0SC7GhsS1IstlElZUrRsCWz_uCXnuxw,15742
552
552
  autocoder/dispacher/__init__.py,sha256=0vTXan1wzL3KWa368Rdez_QyWghcj80X3K7GkxudLq0,1042
553
553
  autocoder/dispacher/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
554
- autocoder/dispacher/actions/action.py,sha256=dGcAkviGiO9ZHqCk8rln432EftzTfOHMpXkyaIYjGxY,29812
554
+ autocoder/dispacher/actions/action.py,sha256=v7HImKydWVWIdrbJuM9HFIgXp8O4FR0SstBSfCLiE_o,33225
555
555
  autocoder/dispacher/actions/copilot.py,sha256=2nQzKt8Sr40mIDOizZWyl4ekCwaHYklvgGlVfvhOlFM,13106
556
556
  autocoder/dispacher/actions/plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
557
557
  autocoder/dispacher/actions/plugins/action_regex_project.py,sha256=8QjSTl_-9o4XujBGPBX2MbvS0KLWQt3zYLGgV8s0m2A,7867
@@ -565,7 +565,7 @@ autocoder/helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
565
565
  autocoder/helper/project_creator.py,sha256=sgXrZyAaGc84aUT7K7d7N1ztT-mSNGoLnsT-uKMUvVw,21472
566
566
  autocoder/helper/rag_doc_creator.py,sha256=A3lB_jr1KU4bxLbBTX9-nxyylwDirxSi1NXmbPTnp90,4386
567
567
  autocoder/index/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
568
- autocoder/index/entry.py,sha256=_o0JobHuulaY3w0WNGga_RdTKzGollyCxk9HmBbQlGg,14394
568
+ autocoder/index/entry.py,sha256=Rkin91rBCooekzIvjEeCAPDsFpCd69b_bxpgLtm56MQ,14398
569
569
  autocoder/index/for_command.py,sha256=BFvljE4t6VaMBGboZAuhUCzVK0EitCy_n5D_7FEnihw,3204
570
570
  autocoder/index/index.py,sha256=jvn0lELcj1UmxBsUwaD3fzhzOsrBJ17mOWsd3Mdj0s8,34461
571
571
  autocoder/index/symbols_utils.py,sha256=_EP7E_qWXxluAxq3FGZLlLfdrfwx3FmxCdulI8VGuac,2244
@@ -581,7 +581,7 @@ autocoder/index/tests/test_index_manager.py,sha256=3OdwobjkmNtoJjYLL___qIkFodF-d
581
581
  autocoder/index/tests/test_module_integration.py,sha256=73oIpPfJUzjgN9AIwSd_NMPv4-tsOmjSbT8_elvrhnQ,11329
582
582
  autocoder/index/tests/test_symbols_utils.py,sha256=s1COXywZfm1TInWgtYuq3nK2oTkIJr1wQ2-9K87uGM8,7033
583
583
  autocoder/inner/__init__.py,sha256=QvyRDGC8bBukLNBKvCDBiHz5JDRG8RfxBZzk8CgaKEQ,136
584
- autocoder/inner/agentic.py,sha256=7HB1XGt-OuKx3_vqUDnFUx769it86vkYa6Fz4_1i0kg,36039
584
+ autocoder/inner/agentic.py,sha256=DNFolJGkmAP3XD7a8J0N19UzzKjJdoCk4A0QBBSl70I,35649
585
585
  autocoder/inner/async_command_handler.py,sha256=0MBxCVL6y3Vri_1zencUtl2xYzOfN7h8f1TKLKL9RWY,36691
586
586
  autocoder/inner/conversation_command_handlers.py,sha256=EHszrWMV-w1nImdJfpQ28yjOBqjKQ_aI5bM53aforDY,22960
587
587
  autocoder/inner/merge_command_handler.py,sha256=2ogANavUeFthWQYi98tooA4HS7r-kGUFh9Xm83e3v5E,7400
@@ -781,15 +781,15 @@ autocoder/utils/chat_auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCe
781
781
  autocoder/workflow_agents/__init__.py,sha256=21KqJcrkM2wFCiiux1OsOCqPq9FGloVYD6rmocufFfg,2208
782
782
  autocoder/workflow_agents/agent.py,sha256=Oeyr2CqG9TrpkFgt_oW2Xwf_TqLOEPe8pirwjuH6Iec,4851
783
783
  autocoder/workflow_agents/exceptions.py,sha256=DRsyRDJu3Kda_o9qybCog9Ey-nFHWY6B0cN06JZU7C4,18846
784
- autocoder/workflow_agents/executor.py,sha256=N5sy3Ltf_Ssgg2ZsYhhcrngmFN38H8BrEf9-WfznWvE,17587
785
- autocoder/workflow_agents/loader.py,sha256=lUNKtrrna5Q8upGBu8gNdRna-UyPzji5dJOUm02pHgc,23983
784
+ autocoder/workflow_agents/executor.py,sha256=HqyWVtoqfjad9skw15oNVQhosn2fEnjhto0CQ3DKWWs,23927
785
+ autocoder/workflow_agents/loader.py,sha256=IjfrJN4P31L4NogKdZ6D6LP4Iu5W_X1RxihTHekUck8,24450
786
786
  autocoder/workflow_agents/runner.py,sha256=ZceDxX-ETkKskAs9SVhHqOehpb3jB1klMTPHJKmV1WU,8892
787
- autocoder/workflow_agents/types.py,sha256=BD6occLtlSVc12ARgOqL-IJjrlr2rNGR46iCXEtcjB0,3618
787
+ autocoder/workflow_agents/types.py,sha256=C-vXXG3gMjHX2L8Ga8AETJKzoWIOAdMfW2B6cYzz6JA,3687
788
788
  autocoder/workflow_agents/utils.py,sha256=bRSaKVxa3RohS5bFaZ5sNSA8osqNOVT3acszLa-2MlM,11890
789
789
  autocoder/workflow_agents/workflow_manager.py,sha256=7pUHzI5-LC8GomxDENeD5iORBQmimsXp6_s1trBgCj0,7117
790
- auto_coder-2.0.0.dist-info/LICENSE,sha256=JaCF1ZyJ0bdU2DJ5yr3Lz_ceYJLxUakA6d06nXxdYfY,6327
791
- auto_coder-2.0.0.dist-info/METADATA,sha256=BCtdbufsiFu9PAGrlsGutcy5jPj6RV5AEYJrRurgAb8,15649
792
- auto_coder-2.0.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
793
- auto_coder-2.0.0.dist-info/entry_points.txt,sha256=HzBXhI9vP3hpe7aD0N9souZz7VTnn-_zKJ3Zq75GOvc,444
794
- auto_coder-2.0.0.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
795
- auto_coder-2.0.0.dist-info/RECORD,,
790
+ auto_coder-2.0.1.dist-info/LICENSE,sha256=JaCF1ZyJ0bdU2DJ5yr3Lz_ceYJLxUakA6d06nXxdYfY,6327
791
+ auto_coder-2.0.1.dist-info/METADATA,sha256=84gnhv1S1yUceJmVzVKOjbvWGlgXqR11CPuPM9tjJEs,15649
792
+ auto_coder-2.0.1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
793
+ auto_coder-2.0.1.dist-info/entry_points.txt,sha256=HzBXhI9vP3hpe7aD0N9souZz7VTnn-_zKJ3Zq75GOvc,444
794
+ auto_coder-2.0.1.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
795
+ auto_coder-2.0.1.dist-info/RECORD,,
@@ -1,17 +1,12 @@
1
-
2
- import os
3
1
  import time
4
2
  import json
5
- from typing import Dict, Any, List
6
3
  from rich.console import Console
7
4
  from rich.panel import Panel
8
- from rich.markdown import Markdown
9
- from rich.live import Live
10
5
  from prompt_toolkit import prompt
11
6
  from prompt_toolkit.formatted_text import FormattedText
12
7
  from loguru import logger
13
8
  import byzerllm
14
-
9
+ from typing import Optional
15
10
  from autocoder.common.auto_coder_lang import get_message
16
11
  from autocoder.common.memory_manager import save_to_memory_file
17
12
  from autocoder.common.utils_code_auto_generate import stream_chat_with_continue
@@ -26,16 +21,9 @@ from autocoder.events.event_types import EventMetadata
26
21
  from autocoder.common.mcp_tools.server import get_mcp_server
27
22
  from autocoder.common.mcp_tools.types import McpRequest
28
23
  from autocoder.utils.llms import get_llm_names
29
- from autocoder.utils.request_queue import (
30
- request_queue,
31
- RequestValue,
32
- DefaultValue,
33
- RequestOption,
34
- )
35
24
  from autocoder.run_context import get_run_context, RunMode
36
25
  from autocoder.common.action_yml_file_manager import ActionYmlFileManager
37
26
  from autocoder.common.conversations.get_conversation_manager import get_conversation_manager
38
- from autocoder.common.conversations.exceptions import ConversationManagerError
39
27
 
40
28
 
41
29
  class ChatAgent:
@@ -49,14 +37,14 @@ class ChatAgent:
49
37
  # 生成命名空间用于会话隔离
50
38
  self.namespace = self._generate_namespace()
51
39
 
52
- def _generate_namespace(self) -> str:
40
+ def _generate_namespace(self) -> Optional[str]:
53
41
  """
54
42
  生成命名空间,用于会话隔离
55
43
 
56
44
  Returns:
57
45
  str: 基于项目路径的命名空间
58
46
  """
59
- return "manual"
47
+ return None
60
48
 
61
49
  def run(self):
62
50
  """执行 chat 命令的主要逻辑"""
@@ -207,17 +195,19 @@ class ChatAgent:
207
195
  source_count += 1
208
196
 
209
197
  # 构建索引和过滤文件
210
- if "no_context" not in commands_info:
211
- from autocoder.index.index import IndexManager
198
+ if "no_context" not in commands_info:
212
199
  from autocoder.index.entry import build_index_and_filter_files
213
200
  from autocoder.pyproject import PyProject
214
201
  from autocoder.tsproject import TSProject
215
202
  from autocoder.suffixproject import SuffixProject
203
+ from autocoder.default_project import DefaultProject
216
204
 
217
205
  if self.args.project_type == "ts":
218
206
  pp = TSProject(args=self.args, llm=self.llm)
219
207
  elif self.args.project_type == "py":
220
208
  pp = PyProject(args=self.args, llm=self.llm)
209
+ elif not self.args.project_type or self.args.project_type == "*":
210
+ pp = DefaultProject(args=self.args, llm=self.llm)
221
211
  else:
222
212
  pp = SuffixProject(args=self.args, llm=self.llm, file_filter=None)
223
213
  pp.run()
@@ -90,15 +90,6 @@ from autocoder.common.v2.agent.runner import (
90
90
  from autocoder.completer import CommandCompleterV2
91
91
  from autocoder.common.core_config import get_memory_manager, load_memory as _load_memory
92
92
  from autocoder.common.global_cancel import global_cancel
93
- from autocoder.inner.async_command_handler import AsyncCommandHandler
94
- from autocoder.inner.queue_command_handler import QueueCommandHandler
95
- from autocoder.inner.conversation_command_handlers import (
96
- ConversationNewCommandHandler,
97
- ConversationResumeCommandHandler,
98
- ConversationListCommandHandler,
99
- ConversationRenameCommandHandler,
100
- ConversationCommandCommandHandler,
101
- )
102
93
 
103
94
  # 对外API,用于第三方集成 auto-coder 使用。
104
95
 
@@ -195,6 +186,7 @@ commands = [
195
186
  "/conf/import",
196
187
  "/exclude_dirs",
197
188
  "/queue",
189
+ "/workflow"
198
190
  ]
199
191
 
200
192
 
@@ -36,6 +36,16 @@ class CodingHandler:
36
36
  def __init__(self):
37
37
  self.console = Console()
38
38
  self._config = None
39
+ self.namespace = self._generate_namespace()
40
+
41
+ def _generate_namespace(self) -> Optional[str]:
42
+ """
43
+ 生成命名空间,用于会话隔离
44
+
45
+ Returns:
46
+ str: 基于项目路径的命名空间
47
+ """
48
+ return None
39
49
 
40
50
  def _create_config(self):
41
51
  """创建 coding 命令的类型化配置"""
@@ -330,13 +340,11 @@ class CodingHandler:
330
340
  )
331
341
  )
332
342
 
333
- try:
334
- # 使用 conversations 模块获取聊天历史,命名空间为 "manual"
343
+ try:
335
344
  conversation_manager = get_conversation_manager()
336
-
337
- # 获取 "manual" 命名空间的当前会话ID
345
+
338
346
  current_conversation_id = conversation_manager.get_current_conversation_id(
339
- "manual"
347
+ self.namespace
340
348
  )
341
349
 
342
350
  conversations = []
@@ -360,7 +368,7 @@ class CodingHandler:
360
368
  elif conv["role"] == "assistant":
361
369
  context += f"你: {conv['content']}\n"
362
370
  context += "</history>\n"
363
-
371
+
364
372
  return context
365
373
 
366
374
  except Exception as e:
@@ -38,12 +38,40 @@ DEFAULT_MODELS = [
38
38
  "max_output_tokens": 8000,
39
39
  "context_window": 200000,
40
40
  },
41
+ {
42
+ "name": "bigmodel/coding/glm-4-6",
43
+ "description": "智谱 AI GLM-4,国产大模型,性价比高",
44
+ "model_name": "glm-4.6",
45
+ "model_type": "saas/openai",
46
+ "base_url": "https://open.bigmodel.cn/api/coding/paas/v4",
47
+ "provider": "bigmodel",
48
+ "api_key_path": "",
49
+ "is_reasoning": False,
50
+ "input_price": 0.0,
51
+ "output_price": 0.0,
52
+ "max_output_tokens": 8000,
53
+ "context_window": 200000,
54
+ },
55
+ {
56
+ "name": "minimax/m2",
57
+ "description": "MiniMax M2 模型,适合编程任务",
58
+ "model_name": "MiniMax-M2",
59
+ "model_type": "saas/openai",
60
+ "base_url": "https://api.minimaxi.com/v1",
61
+ "provider": "minimax",
62
+ "is_reasoning": True,
63
+ "input_price": 2.1,
64
+ "output_price": 8.4,
65
+ "max_output_tokens": 24288,
66
+ "context_window": 204800,
67
+ "api_key_path": ""
68
+ },
41
69
  {
42
70
  "name": "deepseek/deepseek-chat",
43
71
  "description": "DeepSeek 官方 API,性能接近 GPT-4,价格低廉",
44
72
  "model_name": "deepseek-chat",
45
73
  "model_type": "saas/openai",
46
- "base_url": "https://api.deepseek.com/v1",
74
+ "base_url": "https://api.deepseek.com/beta",
47
75
  "provider": "deepseek",
48
76
  "api_key_path": "",
49
77
  "is_reasoning": False,
@@ -37,7 +37,7 @@ def _workflow_subagents() -> str:
37
37
  spec:
38
38
  globals: # Global default configuration
39
39
  model: v3_chat # Default model
40
- product_mode: lite # Product mode (e.g., lite)
40
+ product_mode: lite # Product mode (e.g., lite)
41
41
  timeout_sec: 300 # Default timeout (seconds)
42
42
  include_rules: false # Whether the runner includes rule context
43
43
 
@@ -121,6 +121,13 @@ def _workflow_subagents() -> str:
121
121
  - id: step ID (unique)
122
122
  - agent: reference to `agents[].id`
123
123
  - needs: list of dependencies
124
+ - replicas: optional, number of parallel replicas (default: 1)
125
+ - When replicas > 1, the step runs multiple identical copies in parallel
126
+ - Success policy: any replica succeeds → step succeeds
127
+ - Result merging:
128
+ - JSON format: merges into a JSON array `[{...}, {...}]`
129
+ - Text format: concatenates with `\n---\n` separator
130
+ - Unset or 1: behaves as before (backward compatible)
124
131
  - conversation: step-level conversation control
125
132
  - action: new | resume | continue
126
133
  - new: always starts a new conversation and sets it as the "linked conversation" (subsequent resume will reuse it)
@@ -138,7 +145,7 @@ def _workflow_subagents() -> str:
138
145
  - When format=json, you can use `jsonpath`
139
146
  - When format=text, you can use `regex`
140
147
  - You can also directly pass through "${attempt_result}"
141
- - The system automatically injects `conversation_id` into each steps outputs, and it is a real conversation ID; even if you explicitly write `conversation_id`, it will be overwritten with the real value
148
+ - The system automatically injects `conversation_id` into each step's outputs, and it is a real conversation ID; even if you explicitly write `conversation_id`, it will be overwritten with the real value
142
149
 
143
150
  ---
144
151
 
@@ -229,7 +236,7 @@ def _workflow_subagents() -> str:
229
236
  spec:
230
237
  globals:
231
238
  model: v3_chat # Default model; can be overridden per agent
232
- product_mode: lite # Default product mode
239
+ product_mode: lite # Default product mode
233
240
  include_rules: false # Whether to include rules context in SdkRunner
234
241
 
235
242
  vars: # Optional: global variables for templating
@@ -240,7 +247,7 @@ def _workflow_subagents() -> str:
240
247
  default_action: resume # resume | new | continue
241
248
 
242
249
  attempt: # AttemptCompletion return contract (global)
243
- format: text # json | text
250
+ format: text # json | text
244
251
 
245
252
  agents: # Agents: each agent is a runner configuration (SdkRunner in this design)
246
253
  - id: context
@@ -254,6 +261,7 @@ def _workflow_subagents() -> str:
254
261
  steps: # DAG, executed in topological order
255
262
  - id: gather_context
256
263
  agent: context
264
+ replicas: 2 # Run 2 parallel replicas to improve context discovery coverage
257
265
  conversation: # Keep only action; conversation_id also supports templating
258
266
  action: new
259
267
  with: # Input for TerminalRunner; becomes AgenticEditRequest.user_input
@@ -281,7 +289,7 @@ def _workflow_subagents() -> str:
281
289
  conversation_id: "${conversation_id}"
282
290
 
283
291
  - id: write_code
284
- needs: [gather_context]
292
+ needs: [gather_context]
285
293
  agent: code
286
294
  conversation:
287
295
  action: new
@@ -324,11 +332,10 @@ class LoadExtraDocumentToolResolver(BaseToolResolver):
324
332
  return path.read_text(encoding="utf-8")
325
333
  except FileNotFoundError:
326
334
  raise FileNotFoundError(f"Document not found: {path}")
327
-
328
335
 
329
336
  def resolve(self) -> ToolResult:
330
337
  try:
331
- name = self.tool.name.strip()
338
+ name = self.tool.name.strip()
332
339
  # 按名称选择对应的 prompt 函数,并返回其 prompt 文本(非模型推理输出)
333
340
  if name == "workflow_subagents":
334
341
  prompt_text = _workflow_subagents.prompt()
@@ -116,6 +116,7 @@ COMMAND_HIERARCHY = {
116
116
  "/help": {},
117
117
  "/init": {},
118
118
  },
119
+ "/workflow": {},
119
120
  }
120
121
 
121
122
 
@@ -204,6 +205,7 @@ class CommandCompleterV2(Completer):
204
205
  "/summon": self._handle_text_with_symbols,
205
206
  "/design": self._handle_design,
206
207
  "/rules": self._handle_rules,
208
+ "/workflow": self._handle_workflow,
207
209
  # Add handlers for other commands if they need specific logic beyond @/@@
208
210
  # Default handler for plain text or commands not explicitly handled
209
211
  "default": self._handle_text_with_symbols,
@@ -753,6 +755,47 @@ class CommandCompleterV2(Completer):
753
755
  elif word.startswith("<"): # Potential tag completion
754
756
  yield from self._handle_img_tag(document, complete_event, word, text)
755
757
 
758
+ def _handle_workflow(
759
+ self, document: Document, complete_event: CompleteEvent, word: str, text: str
760
+ ) -> Iterable[Completion]:
761
+ """Handles completions for /workflow command."""
762
+ args_text = text[len("/workflow") :].lstrip()
763
+ parts = args_text.split()
764
+ last_part = parts[-1] if parts and not text.endswith(" ") else ""
765
+
766
+ # If no arguments or first argument, complete workflow names
767
+ if not args_text or (len(parts) == 1 and not text.endswith(" ")):
768
+ # List workflow files from .autocoderworkflow directory
769
+ workflow_dir = os.path.join(self.project_root, ".autocoderworkflow")
770
+ if os.path.isdir(workflow_dir):
771
+ try:
772
+ for f in os.listdir(workflow_dir):
773
+ if f.endswith(".yaml") or f.endswith(".yml"):
774
+ workflow_name = os.path.splitext(f)[0]
775
+ if workflow_name.startswith(last_part):
776
+ yield Completion(
777
+ workflow_name,
778
+ start_position=-len(last_part),
779
+ display=f"{workflow_name} (workflow)",
780
+ )
781
+ except OSError:
782
+ pass # Ignore errors listing directory
783
+
784
+ # If workflow name is specified, complete query= parameter
785
+ elif len(parts) >= 1 and not text.endswith(" "):
786
+ # Complete query= when typing "qu"
787
+ if "query=".startswith(last_part):
788
+ yield Completion("query=", start_position=-len(last_part))
789
+
790
+ # Support symbol completions within /workflow arguments
791
+ # Allow @ (file path) and @@ (symbols) just like in chat/coding
792
+ if word.startswith("@") and not word.startswith("@@"):
793
+ yield from self._handle_at_completion(document, complete_event, word, text)
794
+ elif word.startswith("@@"):
795
+ yield from self._handle_double_at_completion(
796
+ document, complete_event, word, text
797
+ )
798
+
756
799
  def _handle_rules(
757
800
  self, document: Document, complete_event: CompleteEvent, word: str, text: str
758
801
  ) -> Iterable[Completion]: