auto-coder 0.1.335__py3-none-any.whl → 0.1.336__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.335.dist-info → auto_coder-0.1.336.dist-info}/METADATA +2 -2
- {auto_coder-0.1.335.dist-info → auto_coder-0.1.336.dist-info}/RECORD +34 -16
- autocoder/auto_coder.py +34 -17
- autocoder/auto_coder_rag.py +18 -9
- autocoder/auto_coder_runner.py +45 -4
- autocoder/common/__init__.py +1 -0
- autocoder/common/v2/agent/__init__.py +0 -0
- autocoder/common/v2/agent/agentic_edit.py +1302 -0
- autocoder/common/v2/agent/agentic_edit_tools/__init__.py +28 -0
- autocoder/common/v2/agent/agentic_edit_tools/ask_followup_question_tool_resolver.py +70 -0
- autocoder/common/v2/agent/agentic_edit_tools/attempt_completion_tool_resolver.py +35 -0
- autocoder/common/v2/agent/agentic_edit_tools/base_tool_resolver.py +33 -0
- autocoder/common/v2/agent/agentic_edit_tools/execute_command_tool_resolver.py +88 -0
- autocoder/common/v2/agent/agentic_edit_tools/list_code_definition_names_tool_resolver.py +80 -0
- autocoder/common/v2/agent/agentic_edit_tools/list_files_tool_resolver.py +105 -0
- autocoder/common/v2/agent/agentic_edit_tools/plan_mode_respond_tool_resolver.py +35 -0
- autocoder/common/v2/agent/agentic_edit_tools/read_file_tool_resolver.py +51 -0
- autocoder/common/v2/agent/agentic_edit_tools/replace_in_file_tool_resolver.py +144 -0
- autocoder/common/v2/agent/agentic_edit_tools/search_files_tool_resolver.py +99 -0
- autocoder/common/v2/agent/agentic_edit_tools/use_mcp_tool_resolver.py +46 -0
- autocoder/common/v2/agent/agentic_edit_tools/write_to_file_tool_resolver.py +58 -0
- autocoder/common/v2/agent/agentic_edit_types.py +162 -0
- autocoder/common/v2/agent/agentic_tool_display.py +184 -0
- autocoder/common/v2/code_agentic_editblock_manager.py +812 -0
- autocoder/events/event_manager.py +4 -4
- autocoder/events/event_types.py +1 -0
- autocoder/memory/active_context_manager.py +2 -29
- autocoder/models.py +10 -2
- autocoder/utils/llms.py +4 -2
- autocoder/version.py +1 -1
- {auto_coder-0.1.335.dist-info → auto_coder-0.1.336.dist-info}/LICENSE +0 -0
- {auto_coder-0.1.335.dist-info → auto_coder-0.1.336.dist-info}/WHEEL +0 -0
- {auto_coder-0.1.335.dist-info → auto_coder-0.1.336.dist-info}/entry_points.txt +0 -0
- {auto_coder-0.1.335.dist-info → auto_coder-0.1.336.dist-info}/top_level.txt +0 -0
|
@@ -62,7 +62,7 @@ class EventManager:
|
|
|
62
62
|
self.event_store.append_event(event)
|
|
63
63
|
return event
|
|
64
64
|
|
|
65
|
-
def write_completion(self, content: Union[Dict[str, Any], Any]) -> Event:
|
|
65
|
+
def write_completion(self, content: Union[Dict[str, Any], Any], metadata: Dict[str, Any] = {}) -> Event:
|
|
66
66
|
"""
|
|
67
67
|
Write a completion event.
|
|
68
68
|
|
|
@@ -74,11 +74,11 @@ class EventManager:
|
|
|
74
74
|
"""
|
|
75
75
|
if not isinstance(content, dict):
|
|
76
76
|
content = content.to_dict()
|
|
77
|
-
event = Event(event_type=EventType.COMPLETION, content=content)
|
|
77
|
+
event = Event(event_type=EventType.COMPLETION, content=content, metadata=metadata)
|
|
78
78
|
self.event_store.append_event(event)
|
|
79
79
|
return event
|
|
80
80
|
|
|
81
|
-
def write_error(self, content: Union[Dict[str, Any], Any]) -> Event:
|
|
81
|
+
def write_error(self, content: Union[Dict[str, Any], Any], metadata: Dict[str, Any] = {}) -> Event:
|
|
82
82
|
"""
|
|
83
83
|
Write an error event.
|
|
84
84
|
|
|
@@ -90,7 +90,7 @@ class EventManager:
|
|
|
90
90
|
"""
|
|
91
91
|
if not isinstance(content, dict):
|
|
92
92
|
content = content.to_dict()
|
|
93
|
-
event = Event(event_type=EventType.ERROR, content=content)
|
|
93
|
+
event = Event(event_type=EventType.ERROR, content=content, metadata=metadata)
|
|
94
94
|
self.event_store.append_event(event)
|
|
95
95
|
return event
|
|
96
96
|
|
autocoder/events/event_types.py
CHANGED
|
@@ -68,6 +68,7 @@ class EventMetadata(BaseModel):
|
|
|
68
68
|
stream_out_type: str = field(default="") # 标记,比如当前这个流式是用于什么场景的,比如用于产生命令的还是啥
|
|
69
69
|
is_streaming: bool = field(default=False) # 是否是流式输出
|
|
70
70
|
output: str = field(default="") # result or delta, 在流式里,我们也可能会输出 ResultContent 类型
|
|
71
|
+
path: str = field(default="") # 唯一路径,比如 /agent/edit/tool/call
|
|
71
72
|
|
|
72
73
|
def to_dict(self) -> Dict[str, Any]:
|
|
73
74
|
"""Convert event metadata to dictionary for serialization"""
|
|
@@ -99,37 +99,10 @@ class ActiveContextManager:
|
|
|
99
99
|
if self._is_initialized:
|
|
100
100
|
return
|
|
101
101
|
self.source_dir = source_dir
|
|
102
|
-
|
|
103
|
-
log_dir = os.path.join(source_dir, ".auto-coder", "active-context")
|
|
104
|
-
os.makedirs(log_dir, exist_ok=True)
|
|
105
|
-
log_file = os.path.join(log_dir, "active.log")
|
|
106
|
-
|
|
107
|
-
# 配置全局日志输出到文件,不输出到控制台
|
|
108
|
-
global_logger.configure(
|
|
109
|
-
handlers=[
|
|
110
|
-
# 移除控制台输出,只保留文件输出
|
|
111
|
-
# 文件 Handler
|
|
112
|
-
{
|
|
113
|
-
"sink": log_file,
|
|
114
|
-
"level": "INFO",
|
|
115
|
-
"rotation": "10 MB",
|
|
116
|
-
"retention": "1 week",
|
|
117
|
-
"format": "{time:YYYY-MM-DD HH:mm:ss} | {level} | {name} | {message}",
|
|
118
|
-
"filter": lambda record: record["extra"].get("name") in ["DirectoryMapper", "ActiveContextManager","ActivePackage","AsyncProcessor"]
|
|
119
|
-
},
|
|
120
|
-
# 控制台 Handler
|
|
121
|
-
{
|
|
122
|
-
"sink": sys.stdout,
|
|
123
|
-
"level": "INFO",
|
|
124
|
-
"format": "{time:YYYY-MM-DD HH:mm:ss} | {name} | {message}",
|
|
125
|
-
"filter": lambda record: record["extra"].get("name") not in ["DirectoryMapper", "ActiveContextManager","ActivePackage","AsyncProcessor","TokenCostCalculator"]
|
|
126
|
-
}
|
|
127
|
-
]
|
|
128
|
-
)
|
|
129
|
-
|
|
102
|
+
|
|
130
103
|
# 创建专用的logger实例
|
|
131
104
|
self.logger = global_logger.bind(name="ActiveContextManager")
|
|
132
|
-
|
|
105
|
+
|
|
133
106
|
|
|
134
107
|
self.llm = llm
|
|
135
108
|
self.directory_mapper = DirectoryMapper()
|
autocoder/models.py
CHANGED
|
@@ -17,7 +17,8 @@ default_models_list = [
|
|
|
17
17
|
"is_reasoning": True,
|
|
18
18
|
"input_price": 0.0, # 单位:M/百万 input tokens
|
|
19
19
|
"output_price": 0.0, # 单位:M/百万 output tokens
|
|
20
|
-
"average_speed": 0.0 # 单位:秒/请求
|
|
20
|
+
"average_speed": 0.0, # 单位:秒/请求
|
|
21
|
+
"max_output_tokens": 8096
|
|
21
22
|
},
|
|
22
23
|
{
|
|
23
24
|
"name": "deepseek_chat",
|
|
@@ -29,7 +30,8 @@ default_models_list = [
|
|
|
29
30
|
"is_reasoning": False,
|
|
30
31
|
"input_price": 0.0,
|
|
31
32
|
"output_price": 0.0,
|
|
32
|
-
"average_speed": 0.0
|
|
33
|
+
"average_speed": 0.0,
|
|
34
|
+
"max_output_tokens": 8096
|
|
33
35
|
},
|
|
34
36
|
{
|
|
35
37
|
"name":"o1",
|
|
@@ -302,6 +304,8 @@ def update_model(name: str, model_data: Dict) -> Dict:
|
|
|
302
304
|
- is_reasoning: 是否为推理模型
|
|
303
305
|
- input_price: 输入价格
|
|
304
306
|
- output_price: 输出价格
|
|
307
|
+
- max_output_tokens: 最大输出tokens
|
|
308
|
+
- average_speed: 平均速度
|
|
305
309
|
|
|
306
310
|
Returns:
|
|
307
311
|
Dict: 更新后的模型信息,如果未找到则返回None
|
|
@@ -327,6 +331,10 @@ def update_model(name: str, model_data: Dict) -> Dict:
|
|
|
327
331
|
model["input_price"] = float(model_data["input_price"])
|
|
328
332
|
if "output_price" in model_data:
|
|
329
333
|
model["output_price"] = float(model_data["output_price"])
|
|
334
|
+
if "max_output_tokens" in model_data:
|
|
335
|
+
model["max_output_tokens"] = int(model_data["max_output_tokens"])
|
|
336
|
+
if "average_speed" in model_data:
|
|
337
|
+
model["average_speed"] = float(model_data["average_speed"])
|
|
330
338
|
|
|
331
339
|
# 保存更新后的模型
|
|
332
340
|
models[i] = model
|
autocoder/utils/llms.py
CHANGED
|
@@ -69,7 +69,8 @@ def get_single_llm(model_names: str, product_mode: str):
|
|
|
69
69
|
"saas.base_url": model_info["base_url"],
|
|
70
70
|
"saas.api_key": model_info["api_key"],
|
|
71
71
|
"saas.model": model_info["model_name"],
|
|
72
|
-
"saas.is_reasoning": model_info["is_reasoning"]
|
|
72
|
+
"saas.is_reasoning": model_info["is_reasoning"],
|
|
73
|
+
"saas.max_output_tokens": model_info.get("max_output_tokens", 8096)
|
|
73
74
|
}
|
|
74
75
|
)
|
|
75
76
|
return target_llm
|
|
@@ -87,7 +88,8 @@ def get_single_llm(model_names: str, product_mode: str):
|
|
|
87
88
|
"saas.base_url": model_info["base_url"],
|
|
88
89
|
"saas.api_key": model_info["api_key"],
|
|
89
90
|
"saas.model": model_info["model_name"],
|
|
90
|
-
"saas.is_reasoning": model_info["is_reasoning"]
|
|
91
|
+
"saas.is_reasoning": model_info["is_reasoning"],
|
|
92
|
+
"saas.max_output_tokens": model_info.get("max_output_tokens", 8096)
|
|
91
93
|
}
|
|
92
94
|
)
|
|
93
95
|
return target_llm
|
autocoder/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.336"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|