code-puppy 0.0.203__py3-none-any.whl → 0.0.204__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.
@@ -51,21 +51,50 @@ def get_terminal_session_id() -> str:
51
51
 
52
52
 
53
53
  def _is_process_alive(pid: int) -> bool:
54
- """Check if a process with the given PID is still alive.
54
+ """Check if a process with the given PID is still alive, cross-platform.
55
55
 
56
56
  Args:
57
57
  pid: Process ID to check
58
58
 
59
59
  Returns:
60
- bool: True if process exists, False otherwise
60
+ bool: True if process likely exists, False otherwise
61
61
  """
62
62
  try:
63
- # On Unix: os.kill(pid, 0) raises OSError if process doesn't exist
64
- # On Windows: This also works with signal 0
65
- os.kill(pid, 0)
63
+ if os.name == "nt":
64
+ # Windows: use OpenProcess to probe liveness safely
65
+ import ctypes
66
+ from ctypes import wintypes
67
+
68
+ PROCESS_QUERY_LIMITED_INFORMATION = 0x1000
69
+ kernel32 = ctypes.windll.kernel32 # type: ignore[attr-defined]
70
+ kernel32.OpenProcess.argtypes = [wintypes.DWORD, wintypes.BOOL, wintypes.DWORD]
71
+ kernel32.OpenProcess.restype = wintypes.HANDLE
72
+ handle = kernel32.OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, False, int(pid))
73
+ if handle:
74
+ kernel32.CloseHandle(handle)
75
+ return True
76
+ # If access denied, process likely exists but we can't query it
77
+ last_error = kernel32.GetLastError()
78
+ # ERROR_ACCESS_DENIED = 5
79
+ if last_error == 5:
80
+ return True
81
+ return False
82
+ else:
83
+ # Unix-like: signal 0 does not deliver a signal but checks existence
84
+ os.kill(int(pid), 0)
85
+ return True
86
+ except PermissionError:
87
+ # No permission to signal -> process exists
66
88
  return True
67
89
  except (OSError, ProcessLookupError):
90
+ # Process does not exist
91
+ return False
92
+ except ValueError:
93
+ # Invalid signal or pid format
68
94
  return False
95
+ except Exception:
96
+ # Be conservative – don't crash session cleanup due to platform quirks
97
+ return True
69
98
 
70
99
 
71
100
  def _cleanup_dead_sessions(sessions: dict[str, str]) -> dict[str, str]:
code_puppy/main.py CHANGED
@@ -421,7 +421,13 @@ async def interactive_mode(message_renderer, initial_command: str = None) -> Non
421
421
 
422
422
  # Handle / commands based on cleaned prompt (after stripping attachments)
423
423
  if cleaned_for_commands.startswith("/"):
424
- command_result = handle_command(cleaned_for_commands)
424
+ try:
425
+ command_result = handle_command(cleaned_for_commands)
426
+ except Exception as e:
427
+ from code_puppy.messaging import emit_error
428
+ emit_error(f"Command error: {e}")
429
+ # Continue interactive loop instead of exiting
430
+ continue
425
431
  if command_result is True:
426
432
  continue
427
433
  elif isinstance(command_result, str):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-puppy
3
- Version: 0.0.203
3
+ Version: 0.0.204
4
4
  Summary: Code generation agent
5
5
  Project-URL: repository, https://github.com/mpfaffenberger/code_puppy
6
6
  Project-URL: HomePage, https://github.com/mpfaffenberger/code_puppy
@@ -3,7 +3,7 @@ code_puppy/__main__.py,sha256=pDVssJOWP8A83iFkxMLY9YteHYat0EyWDQqMkKHpWp4,203
3
3
  code_puppy/callbacks.py,sha256=ukSgVFaEO68o6J09qFwDrnmNanrVv3toTLQhS504Meo,6162
4
4
  code_puppy/config.py,sha256=xT-nU1U4n7u8pyzJPG18-cJZBKv5OZI2CtHLt9DGRzU,26065
5
5
  code_puppy/http_utils.py,sha256=YLd8Y16idbI32JGeBXG8n5rT4o4X_zxk9FgUvK9XFo8,8248
6
- code_puppy/main.py,sha256=WqlOivWMzm0ijLB9qBHK5Q_adJurzkD_ywGEUVD16RA,23770
6
+ code_puppy/main.py,sha256=SUh2UNbbEwVWSQwDkz-xBp80Q8qenX7tItsEEopcZfI,24024
7
7
  code_puppy/model_factory.py,sha256=ZbIAJWMNKNdTCEMQK8Ig6TDDZlVNyGO9hOLHoLLPMYw,15397
8
8
  code_puppy/models.json,sha256=dClUciCo2RlVDs0ZAQCIur8MOavZUEAXHEecn0uPa-4,1629
9
9
  code_puppy/reopenable_async_client.py,sha256=4UJRaMp5np8cbef9F0zKQ7TPKOfyf5U-Kv-0zYUWDho,8274
@@ -21,7 +21,7 @@ code_puppy/agents/agent_cpp_reviewer.py,sha256=H4INgJo2OJ84QT7bfTkw4s1Ml7luwokhA
21
21
  code_puppy/agents/agent_creator_agent.py,sha256=IiwVirB6uoIeGOmtetut9eDv6o055ykND3V-fvyA8Lw,23042
22
22
  code_puppy/agents/agent_golang_reviewer.py,sha256=-OMuT8hkapVf2Oox46Ck9SRHlsfd8ab8uefbVfdW72M,3348
23
23
  code_puppy/agents/agent_javascript_reviewer.py,sha256=5YC4kRSvorcNgObjHjD2Rrgnvf8jlKhPqWdjOMjU9A0,3636
24
- code_puppy/agents/agent_manager.py,sha256=D5l72Xk3XVeb07FZHKxIMNfhOjxAAzC-8min-gv11mY,11568
24
+ code_puppy/agents/agent_manager.py,sha256=-q1p3_xHGTguXhDtHvVBWAscvX3ZrSNbXsl382GBeC4,12790
25
25
  code_puppy/agents/agent_python_reviewer.py,sha256=D0M3VA12QKdsyg2zIBI2FECxz0IP2fSIfg24xGzDhw0,3837
26
26
  code_puppy/agents/agent_qa_expert.py,sha256=wCGXzuAVElT5c-QigQVb8JX9Gw0JmViCUQQnADMSbVc,3796
27
27
  code_puppy/agents/agent_qa_kitten.py,sha256=5PeFFSwCFlTUvP6h5bGntx0xv5NmRwBiw0HnMqY8nLI,9107
@@ -123,9 +123,9 @@ code_puppy/tui/screens/help.py,sha256=eJuPaOOCp7ZSUlecearqsuX6caxWv7NQszUh0tZJjB
123
123
  code_puppy/tui/screens/mcp_install_wizard.py,sha256=vObpQwLbXjQsxmSg-WCasoev1usEi0pollKnL0SHu9U,27693
124
124
  code_puppy/tui/screens/settings.py,sha256=EoMxiguyeF0srwV1bj4_MG9rrxkNthh6TdTNsxnXLfE,11460
125
125
  code_puppy/tui/screens/tools.py,sha256=3pr2Xkpa9Js6Yhf1A3_wQVRzFOui-KDB82LwrsdBtyk,1715
126
- code_puppy-0.0.203.data/data/code_puppy/models.json,sha256=dClUciCo2RlVDs0ZAQCIur8MOavZUEAXHEecn0uPa-4,1629
127
- code_puppy-0.0.203.dist-info/METADATA,sha256=vEcAaiXB9z01PmgZTX_mCX_u-9KrT5M19oawPnWEAAM,20759
128
- code_puppy-0.0.203.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
129
- code_puppy-0.0.203.dist-info/entry_points.txt,sha256=Tp4eQC99WY3HOKd3sdvb22vZODRq0XkZVNpXOag_KdI,91
130
- code_puppy-0.0.203.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
131
- code_puppy-0.0.203.dist-info/RECORD,,
126
+ code_puppy-0.0.204.data/data/code_puppy/models.json,sha256=dClUciCo2RlVDs0ZAQCIur8MOavZUEAXHEecn0uPa-4,1629
127
+ code_puppy-0.0.204.dist-info/METADATA,sha256=Fcbi95ybiGcekCuITFxE1_3YGaFJjdXoICpjpw4FNPQ,20759
128
+ code_puppy-0.0.204.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
129
+ code_puppy-0.0.204.dist-info/entry_points.txt,sha256=Tp4eQC99WY3HOKd3sdvb22vZODRq0XkZVNpXOag_KdI,91
130
+ code_puppy-0.0.204.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
131
+ code_puppy-0.0.204.dist-info/RECORD,,