aacode 1.8.2__tar.gz → 1.8.4__tar.gz
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.
- {aacode-1.8.2 → aacode-1.8.4}/PKG-INFO +3 -3
- {aacode-1.8.2 → aacode-1.8.4}/aacode/README.md +2 -2
- {aacode-1.8.2 → aacode-1.8.4}/aacode/__init__.py +1 -1
- {aacode-1.8.2 → aacode-1.8.4}/aacode/core/main_agent.py +2 -1
- {aacode-1.8.2 → aacode-1.8.4}/aacode/main.py +4 -2
- {aacode-1.8.2 → aacode-1.8.4}/aacode/tools/atomic_tools.py +25 -5
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/tool_schemas.py +9 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode.egg-info/PKG-INFO +3 -3
- {aacode-1.8.2 → aacode-1.8.4}/aacode.egg-info/SOURCES.txt +1 -0
- {aacode-1.8.2 → aacode-1.8.4}/pyproject.toml +1 -1
- aacode-1.8.4/tests/test_stop_on_exit.py +167 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/LICENSE +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/__main__.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/aacode_config.yaml +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/agent.yaml +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/cli.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/config.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/core/__init__.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/core/agent.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/core/multi_agent.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/core/prompts.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/core/react_loop.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/core/sub_agent.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/i18n/__init__.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/i18n/_dict.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/init.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/sandbox/__init__.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/sandbox/mcp_client.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/sandbox/vm_manager.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/server/__init__.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/server/__pycache__/__init__.cpython-312.pyc +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/server/__pycache__/api.cpython-312.pyc +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/server/__pycache__/runner.cpython-312.pyc +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/server/api.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/server/runner.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/skills/SKILL_template.md +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/skills/book_writer/SKILL.md +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/skills/numpy/SKILL.md +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/skills/numpy/main.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/skills/pandas/SKILL.md +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/skills/pandas/main.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/skills/playwright/SKILL.md +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/skills/playwright/main.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/skills/skill_creator/SKILL.md +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/tools/__init__.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/tools/code_tools.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/tools/custom_tools.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/tools/multimodal_tools.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/tools/sandbox_tools.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/tools/skills_tools.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/tools/todo_tools.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/tools/web_tools.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/__init__.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/agent_logger.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/async_helpers.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/class_method_mapper.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/code_analyzer.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/colors.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/context_manager.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/file_lock.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/light_ast.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/mcp_manager.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/message_utils.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/mock_model.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/safety.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/session_manager.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/todo_manager.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/tool_adapter.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode/utils/tool_registry.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode.egg-info/dependency_links.txt +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode.egg-info/entry_points.txt +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode.egg-info/requires.txt +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/aacode.egg-info/top_level.txt +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/setup.cfg +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_adaptive_truncation.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_api_truncation.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_atomic_tools.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_cache_prefix_stability.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_cli_default_project.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_compact_trigger.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_compact_user_protection.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_compaction_append.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_config_defaults.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_config_merge.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_config_persistence.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_context_compaction.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_context_monitor_tokens.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_dynamic_system_persist.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_e2e_integration.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_error_recovery.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_fetch_url_display.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_file_lock_concurrency.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_init_and_todo_static.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_init_md_autoload.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_init_pip_persistence.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_message_utils.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_model_retry.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_model_retry_user.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_multiline_parse.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_multimodal_tools_robustness.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_process_cleanup.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_python312_compat.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_python_compat.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_react_loop_native.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_react_loop_timeout.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_recent_changes.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_recent_changes_comprehensive.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_safety_guard.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_safety_guard_relaxed.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_safety_path_fallback.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_session_append_only.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_session_comprehensive.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_session_data_integrity.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_session_messages.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_session_persist_clean.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_session_recovery.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_session_single_track.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_session_todo_isolation.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_skill_result_truncation.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_skills_dual_discovery.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_skills_refactor.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_skills_system.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_stale_loop_detection.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_streaming_output.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_system_message_refactor.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_system_prompt_static.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_timeout_cleanup.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_token_count_reasoning.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_tool_adapter.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_tool_schemas.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_web_tools_config.py +0 -0
- {aacode-1.8.2 → aacode-1.8.4}/tests/test_web_tools_html_clean.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aacode
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.4
|
|
4
4
|
Summary: AI Coding Assistant based on ReAct architecture with file-based context management
|
|
5
5
|
Author: xiefujin
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -126,8 +126,8 @@ If you prefer a graphical interface, try AACode Desktop:
|
|
|
126
126
|
|
|
127
127
|
| Platform | Download |
|
|
128
128
|
|----------|---------------------------------------------------------------------------------------------------------|
|
|
129
|
-
| macOS (Apple Silicon) | [AACode_1.8.
|
|
130
|
-
| Windows | [AACode_1.8.
|
|
129
|
+
| macOS (Apple Silicon) | [AACode_1.8.4_aarch64.dmg](https://github.com/kandada/aacode/raw/main/desktop/AACode_1.8.4_aarch64.dmg) |
|
|
130
|
+
| Windows | [AACode_1.8.4_x64-setup.exe](https://github.com/kandada/aacode/raw/main/desktop/AACode_1.8.4_x64-setup.exe) |
|
|
131
131
|
| Android | [aacode-v1.7.24-arm64.apk](https://github.com/kandada/aacode/raw/main/mobile_app/aacode-v1.7.24-arm64.apk) |
|
|
132
132
|
|
|
133
133
|
> The desktop client still requires Python and dependencies (not required for the mobile app). See 👉 [DESKTOP.md](DESKTOP.md) for full setup instructions.
|
|
@@ -82,8 +82,8 @@ If you prefer a graphical interface, try AACode Desktop:
|
|
|
82
82
|
|
|
83
83
|
| Platform | Download |
|
|
84
84
|
|----------|---------------------------------------------------------------------------------------------------------|
|
|
85
|
-
| macOS (Apple Silicon) | [AACode_1.8.
|
|
86
|
-
| Windows | [AACode_1.8.
|
|
85
|
+
| macOS (Apple Silicon) | [AACode_1.8.4_aarch64.dmg](https://github.com/kandada/aacode/raw/main/desktop/AACode_1.8.4_aarch64.dmg) |
|
|
86
|
+
| Windows | [AACode_1.8.4_x64-setup.exe](https://github.com/kandada/aacode/raw/main/desktop/AACode_1.8.4_x64-setup.exe) |
|
|
87
87
|
| Android | [aacode-v1.7.24-arm64.apk](https://github.com/kandada/aacode/raw/main/mobile_app/aacode-v1.7.24-arm64.apk) |
|
|
88
88
|
|
|
89
89
|
> The desktop client still requires Python and dependencies (not required for the mobile app). See 👉 [DESKTOP.md](DESKTOP.md) for full setup instructions.
|
|
@@ -1246,7 +1246,8 @@ mark_todo_completed(todo_id="t1") → precisely marked complete"""
|
|
|
1246
1246
|
Returns:
|
|
1247
1247
|
execute结果
|
|
1248
1248
|
"""
|
|
1249
|
-
|
|
1249
|
+
display_task = task[:15] + "..." if len(task) > 15 else task
|
|
1250
|
+
print(style(t("agent.start_task", task=display_task), fg=BLUE, bold=True))
|
|
1250
1251
|
self.start_time = asyncio.get_event_loop().time()
|
|
1251
1252
|
self._save_batch_counter = 0
|
|
1252
1253
|
|
|
@@ -286,7 +286,8 @@ class AICoder:
|
|
|
286
286
|
Returns:
|
|
287
287
|
execute结果
|
|
288
288
|
"""
|
|
289
|
-
|
|
289
|
+
display_task = task[:15] + "..." if len(task) > 15 else task
|
|
290
|
+
print(style(f"\n🎯 Starting task: {display_task}", fg=BLUE, bold=True))
|
|
290
291
|
print(t("cli.aacode_work_dir", path=self.project_path))
|
|
291
292
|
print(f"🎯 Target project dir: {self.target_project}")
|
|
292
293
|
print(f"📝 Init instructions loaded ({len(self.init_instructions.split())} chars)")
|
|
@@ -567,7 +568,8 @@ async def continue_session(coder, project_dir):
|
|
|
567
568
|
user_input = input("> ").strip()
|
|
568
569
|
|
|
569
570
|
# execute task
|
|
570
|
-
|
|
571
|
+
display_input = user_input[:15] + "..." if len(user_input) > 15 else user_input
|
|
572
|
+
print(f"\n🎯 Starting execution: {display_input}")
|
|
571
573
|
print("Preparing...")
|
|
572
574
|
|
|
573
575
|
try:
|
|
@@ -13,6 +13,7 @@ import asyncio
|
|
|
13
13
|
import os
|
|
14
14
|
import subprocess
|
|
15
15
|
import sys
|
|
16
|
+
import time
|
|
16
17
|
import uuid
|
|
17
18
|
from pathlib import Path
|
|
18
19
|
from typing import Dict, Any, List, Optional
|
|
@@ -27,7 +28,7 @@ class AtomicTools:
|
|
|
27
28
|
self.safety_guard = safety_guard
|
|
28
29
|
|
|
29
30
|
async def run_shell(
|
|
30
|
-
self, command: str, timeout: int = 120, stdin_input: str = None, max_output: int = None, **kwargs
|
|
31
|
+
self, command: str, timeout: int = 120, stdin_input: str = None, max_output: int = None, stop_on_exit: bool = False, **kwargs
|
|
31
32
|
) -> Dict[str, Any]:
|
|
32
33
|
"""
|
|
33
34
|
执行shell命令(带安全护栏)
|
|
@@ -37,6 +38,7 @@ class AtomicTools:
|
|
|
37
38
|
timeout: 超时时间(秒)
|
|
38
39
|
stdin_input: 传给程序的标准输入内容(可选)。程序有 input() 时使用,多行用 \\n 分隔
|
|
39
40
|
max_output: 限制返回的输出最大字符数。默认None(不限制),传数字如200可限制输出
|
|
41
|
+
stop_on_exit: 主进程退出后是否不等子进程管道立即返回。默认False。命令会spawn长期子进程时(如open Simulator)可设True防挂死
|
|
40
42
|
|
|
41
43
|
Note: **kwargs 用于接收并忽略模型可能传入的额外参数
|
|
42
44
|
"""
|
|
@@ -97,6 +99,13 @@ class AtomicTools:
|
|
|
97
99
|
except UnicodeDecodeError:
|
|
98
100
|
return data.decode("gbk", errors="replace")
|
|
99
101
|
|
|
102
|
+
async def _poll_process_exit(proc, t):
|
|
103
|
+
deadline = time.monotonic() + t
|
|
104
|
+
while proc.returncode is None:
|
|
105
|
+
if time.monotonic() > deadline:
|
|
106
|
+
raise asyncio.TimeoutError()
|
|
107
|
+
await asyncio.sleep(0.01)
|
|
108
|
+
|
|
100
109
|
try:
|
|
101
110
|
if stdin_input:
|
|
102
111
|
stdout, stderr = await asyncio.wait_for(
|
|
@@ -114,8 +123,19 @@ class AtomicTools:
|
|
|
114
123
|
stderr_reader = asyncio.create_task(
|
|
115
124
|
_stream_lines(process.stderr, "╰ ", stderr_buf)
|
|
116
125
|
)
|
|
117
|
-
await
|
|
118
|
-
|
|
126
|
+
await _poll_process_exit(process, timeout)
|
|
127
|
+
if stop_on_exit:
|
|
128
|
+
try:
|
|
129
|
+
await asyncio.wait_for(
|
|
130
|
+
asyncio.gather(stdout_reader, stderr_reader),
|
|
131
|
+
timeout=0.5,
|
|
132
|
+
)
|
|
133
|
+
except asyncio.TimeoutError:
|
|
134
|
+
stdout_reader.cancel()
|
|
135
|
+
stderr_reader.cancel()
|
|
136
|
+
await asyncio.gather(stdout_reader, stderr_reader, return_exceptions=True)
|
|
137
|
+
else:
|
|
138
|
+
await asyncio.gather(stdout_reader, stderr_reader)
|
|
119
139
|
stdout_text = "\n".join(stdout_buf)
|
|
120
140
|
stderr_text = "\n".join(stderr_buf)
|
|
121
141
|
|
|
@@ -167,11 +187,11 @@ class AtomicTools:
|
|
|
167
187
|
)
|
|
168
188
|
# Reap the process (avoid zombies)
|
|
169
189
|
try:
|
|
170
|
-
await
|
|
190
|
+
await _poll_process_exit(process, 5.0)
|
|
171
191
|
except Exception:
|
|
172
192
|
try:
|
|
173
193
|
process.kill()
|
|
174
|
-
await
|
|
194
|
+
await _poll_process_exit(process, 2.0)
|
|
175
195
|
except Exception:
|
|
176
196
|
pass
|
|
177
197
|
return {
|
|
@@ -54,6 +54,15 @@ RUN_SHELL_SCHEMA = ToolSchema(
|
|
|
54
54
|
example=None,
|
|
55
55
|
aliases=["max_chars", "limit", "output_limit"],
|
|
56
56
|
),
|
|
57
|
+
ToolParameter(
|
|
58
|
+
name="stop_on_exit",
|
|
59
|
+
type=bool,
|
|
60
|
+
required=False,
|
|
61
|
+
default=False,
|
|
62
|
+
description="If true, stop waiting for stdout/stderr immediately after the main process exits, instead of waiting for all child processes to close their pipes. Use when the command spawns long-running children (e.g. open Simulator, start server) to prevent the tool from hanging. Default is False (wait for all output).",
|
|
63
|
+
example=True,
|
|
64
|
+
aliases=["detach", "no_wait_children"],
|
|
65
|
+
),
|
|
57
66
|
],
|
|
58
67
|
examples=[
|
|
59
68
|
{"command": "ls -la", "description": "List all files in current directory (including hidden files)"},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aacode
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.4
|
|
4
4
|
Summary: AI Coding Assistant based on ReAct architecture with file-based context management
|
|
5
5
|
Author: xiefujin
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -126,8 +126,8 @@ If you prefer a graphical interface, try AACode Desktop:
|
|
|
126
126
|
|
|
127
127
|
| Platform | Download |
|
|
128
128
|
|----------|---------------------------------------------------------------------------------------------------------|
|
|
129
|
-
| macOS (Apple Silicon) | [AACode_1.8.
|
|
130
|
-
| Windows | [AACode_1.8.
|
|
129
|
+
| macOS (Apple Silicon) | [AACode_1.8.4_aarch64.dmg](https://github.com/kandada/aacode/raw/main/desktop/AACode_1.8.4_aarch64.dmg) |
|
|
130
|
+
| Windows | [AACode_1.8.4_x64-setup.exe](https://github.com/kandada/aacode/raw/main/desktop/AACode_1.8.4_x64-setup.exe) |
|
|
131
131
|
| Android | [aacode-v1.7.24-arm64.apk](https://github.com/kandada/aacode/raw/main/mobile_app/aacode-v1.7.24-arm64.apk) |
|
|
132
132
|
|
|
133
133
|
> The desktop client still requires Python and dependencies (not required for the mobile app). See 👉 [DESKTOP.md](DESKTOP.md) for full setup instructions.
|
|
@@ -118,6 +118,7 @@ tests/test_skills_dual_discovery.py
|
|
|
118
118
|
tests/test_skills_refactor.py
|
|
119
119
|
tests/test_skills_system.py
|
|
120
120
|
tests/test_stale_loop_detection.py
|
|
121
|
+
tests/test_stop_on_exit.py
|
|
121
122
|
tests/test_streaming_output.py
|
|
122
123
|
tests/test_system_message_refactor.py
|
|
123
124
|
tests/test_system_prompt_static.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "aacode"
|
|
7
|
-
version = "1.8.
|
|
7
|
+
version = "1.8.4"
|
|
8
8
|
description = "AI Coding Assistant based on ReAct architecture with file-based context management"
|
|
9
9
|
readme = "aacode/README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"""
|
|
2
|
+
测试 stop_on_exit 参数 —— 主进程退出后不等待子进程管道,防挂死
|
|
3
|
+
"""
|
|
4
|
+
import asyncio
|
|
5
|
+
import sys
|
|
6
|
+
import tempfile
|
|
7
|
+
import time
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
|
11
|
+
|
|
12
|
+
import pytest
|
|
13
|
+
from aacode.tools.atomic_tools import AtomicTools
|
|
14
|
+
from aacode.utils.safety import SafetyGuard
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@pytest.fixture
|
|
18
|
+
def atomic_tools():
|
|
19
|
+
with tempfile.TemporaryDirectory() as td:
|
|
20
|
+
project_path = Path(td)
|
|
21
|
+
safety_guard = SafetyGuard(project_path)
|
|
22
|
+
tools = AtomicTools(project_path, safety_guard)
|
|
23
|
+
yield tools
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class TestStopOnExit:
|
|
27
|
+
"""stop_on_exit 参数 —— 进程退出后行为控制"""
|
|
28
|
+
|
|
29
|
+
@pytest.mark.asyncio
|
|
30
|
+
async def test_stop_on_exit_false_normal_command(self, atomic_tools):
|
|
31
|
+
"""stop_on_exit=False(默认):正常命令执行完整,输出不丢失"""
|
|
32
|
+
result = await atomic_tools.run_shell("echo hello", timeout=10)
|
|
33
|
+
assert result["success"] is True
|
|
34
|
+
assert result["returncode"] == 0
|
|
35
|
+
assert "hello" in result["stdout"]
|
|
36
|
+
assert "error" not in result
|
|
37
|
+
|
|
38
|
+
@pytest.mark.asyncio
|
|
39
|
+
async def test_stop_on_exit_true_normal_command(self, atomic_tools):
|
|
40
|
+
"""stop_on_exit=True:正常命令执行完整,输出不丢失"""
|
|
41
|
+
result = await atomic_tools.run_shell(
|
|
42
|
+
"echo hello_world", timeout=10, stop_on_exit=True
|
|
43
|
+
)
|
|
44
|
+
assert result["success"] is True
|
|
45
|
+
assert result["returncode"] == 0
|
|
46
|
+
assert "hello_world" in result["stdout"]
|
|
47
|
+
|
|
48
|
+
@pytest.mark.asyncio
|
|
49
|
+
async def test_stop_on_exit_false_complete_output(self, atomic_tools):
|
|
50
|
+
"""stop_on_exit=False:确保所有输出都被读到"""
|
|
51
|
+
result = await atomic_tools.run_shell(
|
|
52
|
+
"python3 -c \"for i in range(200): print(f'line{i}')\"",
|
|
53
|
+
timeout=10,
|
|
54
|
+
)
|
|
55
|
+
assert result["success"] is True
|
|
56
|
+
lines = result["stdout"].strip().split("\n")
|
|
57
|
+
assert len(lines) == 200
|
|
58
|
+
assert "line199" in result["stdout"]
|
|
59
|
+
|
|
60
|
+
@pytest.mark.asyncio
|
|
61
|
+
async def test_stop_on_exit_true_complete_output(self, atomic_tools):
|
|
62
|
+
"""stop_on_exit=True:正常命令的输出完整捕获(快速 drain 不丢数据)"""
|
|
63
|
+
result = await atomic_tools.run_shell(
|
|
64
|
+
"python3 -c \"for i in range(200): print(f'line{i}')\"",
|
|
65
|
+
timeout=10,
|
|
66
|
+
stop_on_exit=True,
|
|
67
|
+
)
|
|
68
|
+
assert result["success"] is True
|
|
69
|
+
lines = result["stdout"].strip().split("\n")
|
|
70
|
+
assert len(lines) == 200
|
|
71
|
+
assert "line199" in result["stdout"]
|
|
72
|
+
|
|
73
|
+
@pytest.mark.asyncio
|
|
74
|
+
async def test_stop_on_exit_true_fast_after_child_spawn(self, atomic_tools):
|
|
75
|
+
"""stop_on_exit=True:主进程 exit 后子进程持有管道,工具不应挂死,应在很短时间内返回"""
|
|
76
|
+
start = time.monotonic()
|
|
77
|
+
result = await atomic_tools.run_shell(
|
|
78
|
+
"bash -c 'sleep 5 & echo PARENT_DONE'",
|
|
79
|
+
timeout=10,
|
|
80
|
+
stop_on_exit=True,
|
|
81
|
+
)
|
|
82
|
+
elapsed = time.monotonic() - start
|
|
83
|
+
assert result["success"] is True
|
|
84
|
+
assert "PARENT_DONE" in result["stdout"]
|
|
85
|
+
assert elapsed < 1.0, (
|
|
86
|
+
f"stop_on_exit=True should return quickly, but took {elapsed:.1f}s"
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
@pytest.mark.asyncio
|
|
90
|
+
async def test_stop_on_exit_false_would_hang_on_child(self, atomic_tools):
|
|
91
|
+
"""stop_on_exit=False:主进程退出后子进程持有管道,工具会等待子进程释放管道"""
|
|
92
|
+
start = time.monotonic()
|
|
93
|
+
result = await atomic_tools.run_shell(
|
|
94
|
+
"bash -c 'sleep 3 & echo PARENT_OUT'",
|
|
95
|
+
timeout=10,
|
|
96
|
+
stop_on_exit=False,
|
|
97
|
+
)
|
|
98
|
+
elapsed = time.monotonic() - start
|
|
99
|
+
assert result["success"] is True
|
|
100
|
+
assert "PARENT_OUT" in result["stdout"]
|
|
101
|
+
assert elapsed >= 2.5, (
|
|
102
|
+
f"stop_on_exit=False should wait for child to close pipes (~3s), but took {elapsed:.1f}s"
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
@pytest.mark.asyncio
|
|
106
|
+
async def test_stop_on_exit_true_with_timeout(self, atomic_tools):
|
|
107
|
+
"""stop_on_exit=True 与 timeout 同时使用"""
|
|
108
|
+
result = await atomic_tools.run_shell(
|
|
109
|
+
"echo combined_test",
|
|
110
|
+
timeout=5,
|
|
111
|
+
stop_on_exit=True,
|
|
112
|
+
)
|
|
113
|
+
assert result["success"] is True
|
|
114
|
+
assert "combined_test" in result["stdout"]
|
|
115
|
+
|
|
116
|
+
@pytest.mark.asyncio
|
|
117
|
+
async def test_stop_on_exit_true_large_output_with_child(self, atomic_tools):
|
|
118
|
+
"""stop_on_exit=True:大量输出 + 子进程持有管道,drain 捕获残留数据"""
|
|
119
|
+
result = await atomic_tools.run_shell(
|
|
120
|
+
"python3 -c \"import sys; [sys.stdout.write(f'x{y}\\n') for y in range(500)]; sys.stdout.flush()\" && sleep 5 &",
|
|
121
|
+
timeout=10,
|
|
122
|
+
stop_on_exit=True,
|
|
123
|
+
)
|
|
124
|
+
assert result["success"] is True
|
|
125
|
+
lines = result["stdout"].strip().split("\n")
|
|
126
|
+
assert len(lines) >= 490, (
|
|
127
|
+
f"Expected >=490 lines captured, got {len(lines)}"
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
@pytest.mark.asyncio
|
|
131
|
+
async def test_stop_on_exit_true_repeated_does_not_break(self, atomic_tools):
|
|
132
|
+
"""stop_on_exit=True:多次调用不应残留状态"""
|
|
133
|
+
for i in range(5):
|
|
134
|
+
result = await atomic_tools.run_shell(
|
|
135
|
+
f"echo run_{i}", timeout=10, stop_on_exit=True
|
|
136
|
+
)
|
|
137
|
+
assert result["success"] is True
|
|
138
|
+
assert f"run_{i}" in result["stdout"]
|
|
139
|
+
|
|
140
|
+
@pytest.mark.asyncio
|
|
141
|
+
async def test_stop_on_exit_true_stderr_captured(self, atomic_tools):
|
|
142
|
+
"""stop_on_exit=True:stderr 也应正确捕获"""
|
|
143
|
+
result = await atomic_tools.run_shell(
|
|
144
|
+
"python3 -c \"import sys; sys.stderr.write('err_data'); sys.stdout.write('out_data')\"",
|
|
145
|
+
timeout=10,
|
|
146
|
+
stop_on_exit=True,
|
|
147
|
+
)
|
|
148
|
+
assert result["success"] is True
|
|
149
|
+
assert "err_data" in result["stderr"]
|
|
150
|
+
assert "out_data" in result["stdout"]
|
|
151
|
+
|
|
152
|
+
@pytest.mark.asyncio
|
|
153
|
+
async def test_stop_on_exit_true_with_timeout_long_process(self, atomic_tools):
|
|
154
|
+
"""stop_on_exit=True + timeout:长时间运行的进程超时返回"""
|
|
155
|
+
result = await atomic_tools.run_shell(
|
|
156
|
+
"sleep 30", timeout=1, stop_on_exit=True
|
|
157
|
+
)
|
|
158
|
+
assert result["success"] is True
|
|
159
|
+
assert result.get("timeout") is True
|
|
160
|
+
|
|
161
|
+
@pytest.mark.asyncio
|
|
162
|
+
async def test_stop_on_exit_defaults_to_false(self, atomic_tools):
|
|
163
|
+
"""不传 stop_on_exit 时默认 False,行为兼容旧版本"""
|
|
164
|
+
result = await atomic_tools.run_shell("echo compat_test", timeout=10)
|
|
165
|
+
assert result["success"] is True
|
|
166
|
+
assert "compat_test" in result["stdout"]
|
|
167
|
+
assert "stop_on_exit" not in result
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|