fix merge conflict
linuztx committed
Aug 9, 2025 at 23:40 UTC
411db9835cc95ad31071fde2b4861d29563324d7
1 file changed
+18
python/tools/code_execution_tool.py
+18
@@ -243,6 +243,24 @@ class CodeExecution(Tool):
243
prefix="",
244
):
245
246
+ # if not self.state:
247
+ self.state = await self.prepare_state(session=session)
248
+
249
+ # Common shell prompt regex patterns (add more as needed)
250
+ prompt_patterns = [
251
+ re.compile(r"\\(venv\\).+[$#] ?$"), # (venv) ...$ or (venv) ...#
252
+ re.compile(r"root@[^:]+:[^#]+# ?$"), # root@container:~#
253
+ re.compile(r"[a-zA-Z0-9_.-]+@[^:]+:[^$#]+[$#] ?$"), # user@host:~$
254
+ ]
255
+
256
+ # potential dialog detection
257
+ dialog_patterns = [
258
+ re.compile(r"Y/N", re.IGNORECASE), # Y/N anywhere in line
259
+ re.compile(r"yes/no", re.IGNORECASE), # yes/no anywhere in line
260
+ re.compile(r":\s*$"), # line ending with colon
261
+ re.compile(r"\?\s*$"), # line ending with question mark
262
+ ]
263
+
264
start_time = time.time()
265
last_output_time = start_time
266
full_output = ""