portacode 1.3.36__tar.gz → 1.3.37__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.

Potentially problematic release.


This version of portacode might be problematic. Click here for more details.

Files changed (100) hide show
  1. {portacode-1.3.36 → portacode-1.3.37}/PKG-INFO +1 -1
  2. {portacode-1.3.36 → portacode-1.3.37}/portacode/_version.py +2 -2
  3. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/system_handlers.py +25 -6
  4. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/terminal.py +22 -0
  5. {portacode-1.3.36 → portacode-1.3.37}/portacode.egg-info/PKG-INFO +1 -1
  6. {portacode-1.3.36 → portacode-1.3.37}/.claude/agents/communication-manager.md +0 -0
  7. {portacode-1.3.36 → portacode-1.3.37}/.claude/settings.local.json +0 -0
  8. {portacode-1.3.36 → portacode-1.3.37}/.gitignore +0 -0
  9. {portacode-1.3.36 → portacode-1.3.37}/.gitmodules +0 -0
  10. {portacode-1.3.36 → portacode-1.3.37}/LICENSE +0 -0
  11. {portacode-1.3.36 → portacode-1.3.37}/MANIFEST.in +0 -0
  12. {portacode-1.3.36 → portacode-1.3.37}/Makefile +0 -0
  13. {portacode-1.3.36 → portacode-1.3.37}/README.md +0 -0
  14. {portacode-1.3.36 → portacode-1.3.37}/backup.sh +0 -0
  15. {portacode-1.3.36 → portacode-1.3.37}/connect.py +0 -0
  16. {portacode-1.3.36 → portacode-1.3.37}/connect.sh +0 -0
  17. {portacode-1.3.36 → portacode-1.3.37}/docker-compose.yaml +0 -0
  18. {portacode-1.3.36 → portacode-1.3.37}/portacode/README.md +0 -0
  19. {portacode-1.3.36 → portacode-1.3.37}/portacode/__init__.py +0 -0
  20. {portacode-1.3.36 → portacode-1.3.37}/portacode/__main__.py +0 -0
  21. {portacode-1.3.36 → portacode-1.3.37}/portacode/cli.py +0 -0
  22. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/README.md +0 -0
  23. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/__init__.py +0 -0
  24. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/client.py +0 -0
  25. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/README.md +0 -0
  26. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/WEBSOCKET_PROTOCOL.md +0 -0
  27. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/__init__.py +0 -0
  28. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/base.py +0 -0
  29. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/chunked_content.py +0 -0
  30. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/file_handlers.py +0 -0
  31. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/project_aware_file_handlers.py +0 -0
  32. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/project_state/README.md +0 -0
  33. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/project_state/__init__.py +0 -0
  34. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/project_state/file_system_watcher.py +0 -0
  35. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/project_state/git_manager.py +0 -0
  36. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/project_state/handlers.py +0 -0
  37. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/project_state/manager.py +0 -0
  38. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/project_state/models.py +0 -0
  39. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/project_state/utils.py +0 -0
  40. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/project_state_handlers.py +0 -0
  41. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/registry.py +0 -0
  42. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/session.py +0 -0
  43. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/tab_factory.py +0 -0
  44. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/handlers/terminal_handlers.py +0 -0
  45. {portacode-1.3.36 → portacode-1.3.37}/portacode/connection/multiplex.py +0 -0
  46. {portacode-1.3.36 → portacode-1.3.37}/portacode/data.py +0 -0
  47. {portacode-1.3.36 → portacode-1.3.37}/portacode/keypair.py +0 -0
  48. {portacode-1.3.36 → portacode-1.3.37}/portacode/logging_categories.py +0 -0
  49. {portacode-1.3.36 → portacode-1.3.37}/portacode/service.py +0 -0
  50. {portacode-1.3.36 → portacode-1.3.37}/portacode/static/js/test-ntp-clock.html +0 -0
  51. {portacode-1.3.36 → portacode-1.3.37}/portacode/static/js/utils/ntp-clock.js +0 -0
  52. {portacode-1.3.36 → portacode-1.3.37}/portacode/utils/NTP_ARCHITECTURE.md +0 -0
  53. {portacode-1.3.36 → portacode-1.3.37}/portacode/utils/__init__.py +0 -0
  54. {portacode-1.3.36 → portacode-1.3.37}/portacode/utils/ntp_clock.py +0 -0
  55. {portacode-1.3.36 → portacode-1.3.37}/portacode.egg-info/SOURCES.txt +0 -0
  56. {portacode-1.3.36 → portacode-1.3.37}/portacode.egg-info/dependency_links.txt +0 -0
  57. {portacode-1.3.36 → portacode-1.3.37}/portacode.egg-info/entry_points.txt +0 -0
  58. {portacode-1.3.36 → portacode-1.3.37}/portacode.egg-info/requires.txt +0 -0
  59. {portacode-1.3.36 → portacode-1.3.37}/portacode.egg-info/top_level.txt +0 -0
  60. {portacode-1.3.36 → portacode-1.3.37}/pyproject.toml +0 -0
  61. {portacode-1.3.36 → portacode-1.3.37}/restore.sh +0 -0
  62. {portacode-1.3.36 → portacode-1.3.37}/run_tests.py +0 -0
  63. {portacode-1.3.36 → portacode-1.3.37}/setup.cfg +0 -0
  64. {portacode-1.3.36 → portacode-1.3.37}/setup.py +0 -0
  65. {portacode-1.3.36 → portacode-1.3.37}/test.sh +0 -0
  66. {portacode-1.3.36 → portacode-1.3.37}/test_modules/README.md +0 -0
  67. {portacode-1.3.36 → portacode-1.3.37}/test_modules/__init__.py +0 -0
  68. {portacode-1.3.36 → portacode-1.3.37}/test_modules/test_device_online.py +0 -0
  69. {portacode-1.3.36 → portacode-1.3.37}/test_modules/test_file_operations.py +0 -0
  70. {portacode-1.3.36 → portacode-1.3.37}/test_modules/test_git_status_ui.py +0 -0
  71. {portacode-1.3.36 → portacode-1.3.37}/test_modules/test_login_flow.py +0 -0
  72. {portacode-1.3.36 → portacode-1.3.37}/test_modules/test_navigate_testing_folder.py +0 -0
  73. {portacode-1.3.36 → portacode-1.3.37}/test_modules/test_terminal_buffer_performance.py +0 -0
  74. {portacode-1.3.36 → portacode-1.3.37}/test_modules/test_terminal_interaction.py +0 -0
  75. {portacode-1.3.36 → portacode-1.3.37}/test_modules/test_terminal_loading_race_condition.py +0 -0
  76. {portacode-1.3.36 → portacode-1.3.37}/test_modules/test_terminal_start.py +0 -0
  77. {portacode-1.3.36 → portacode-1.3.37}/test_request_id.py +0 -0
  78. {portacode-1.3.36 → portacode-1.3.37}/testing_framework/.env.example +0 -0
  79. {portacode-1.3.36 → portacode-1.3.37}/testing_framework/README.md +0 -0
  80. {portacode-1.3.36 → portacode-1.3.37}/testing_framework/__init__.py +0 -0
  81. {portacode-1.3.36 → portacode-1.3.37}/testing_framework/cli.py +0 -0
  82. {portacode-1.3.36 → portacode-1.3.37}/testing_framework/core/__init__.py +0 -0
  83. {portacode-1.3.36 → portacode-1.3.37}/testing_framework/core/base_test.py +0 -0
  84. {portacode-1.3.36 → portacode-1.3.37}/testing_framework/core/cli_manager.py +0 -0
  85. {portacode-1.3.36 → portacode-1.3.37}/testing_framework/core/hierarchical_runner.py +0 -0
  86. {portacode-1.3.36 → portacode-1.3.37}/testing_framework/core/playwright_manager.py +0 -0
  87. {portacode-1.3.36 → portacode-1.3.37}/testing_framework/core/runner.py +0 -0
  88. {portacode-1.3.36 → portacode-1.3.37}/testing_framework/core/shared_cli_manager.py +0 -0
  89. {portacode-1.3.36 → portacode-1.3.37}/testing_framework/core/test_discovery.py +0 -0
  90. {portacode-1.3.36 → portacode-1.3.37}/testing_framework/requirements.txt +0 -0
  91. {portacode-1.3.36 → portacode-1.3.37}/todo/UI_UX/opening_a_file_on_desktop_results_in_nothing.md +0 -0
  92. {portacode-1.3.36 → portacode-1.3.37}/todo/agent_context_management.md +0 -0
  93. {portacode-1.3.36 → portacode-1.3.37}/todo/issues/device_performance_degradation.md +0 -0
  94. {portacode-1.3.36 → portacode-1.3.37}/todo/issues/git_data_not_captured_in_proxmox.md +0 -0
  95. {portacode-1.3.36 → portacode-1.3.37}/todo/issues/indefinite_resource_loading.md +0 -0
  96. {portacode-1.3.36 → portacode-1.3.37}/todo/issues/portacode_service_silently_down.md +0 -0
  97. {portacode-1.3.36 → portacode-1.3.37}/todo/issues/premature_terminal_exit.md +0 -0
  98. {portacode-1.3.36 → portacode-1.3.37}/todo/issues/project_cpu_hotspots.md +0 -0
  99. {portacode-1.3.36 → portacode-1.3.37}/todo/issues/terminals_exit_upon_starting.md +0 -0
  100. {portacode-1.3.36 → portacode-1.3.37}/tools/test_python_ntp_clock.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: portacode
3
- Version: 1.3.36
3
+ Version: 1.3.37
4
4
  Summary: Portacode CLI client and SDK
5
5
  Home-page: https://github.com/portacode/portacode
6
6
  Author: Meena Erian
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '1.3.36'
32
- __version_tuple__ = version_tuple = (1, 3, 36)
31
+ __version__ = version = '1.3.37'
32
+ __version_tuple__ = version_tuple = (1, 3, 37)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -3,6 +3,8 @@
3
3
  import logging
4
4
  import os
5
5
  import platform
6
+ import threading
7
+ import time
6
8
  from pathlib import Path
7
9
  from typing import Any, Dict
8
10
  from portacode import __version__
@@ -12,6 +14,25 @@ from .base import SyncHandler
12
14
 
13
15
  logger = logging.getLogger(__name__)
14
16
 
17
+ # Global CPU monitoring
18
+ _cpu_percent = 0.0
19
+ _cpu_thread = None
20
+ _cpu_lock = threading.Lock()
21
+
22
+ def _cpu_monitor():
23
+ """Background thread to update CPU usage every 5 seconds."""
24
+ global _cpu_percent
25
+ while True:
26
+ _cpu_percent = psutil.cpu_percent(interval=5.0)
27
+
28
+ def _ensure_cpu_thread():
29
+ """Ensure CPU monitoring thread is running (singleton)."""
30
+ global _cpu_thread
31
+ with _cpu_lock:
32
+ if _cpu_thread is None or not _cpu_thread.is_alive():
33
+ _cpu_thread = threading.Thread(target=_cpu_monitor, daemon=True)
34
+ _cpu_thread.start()
35
+
15
36
 
16
37
  def _get_os_info() -> Dict[str, Any]:
17
38
  """Get operating system information with robust error handling."""
@@ -98,15 +119,13 @@ class SystemInfoHandler(SyncHandler):
98
119
  """Get system information including OS details."""
99
120
  logger.debug("Collecting system information...")
100
121
 
122
+ # Ensure CPU monitoring thread is running
123
+ _ensure_cpu_thread()
124
+
101
125
  # Collect basic system metrics
102
126
  info = {}
103
127
 
104
- try:
105
- info["cpu_percent"] = psutil.cpu_percent(interval=0.1)
106
- logger.debug("CPU usage: %s%%", info["cpu_percent"])
107
- except Exception as e:
108
- logger.warning("Failed to get CPU info: %s", e)
109
- info["cpu_percent"] = 0.0
128
+ info["cpu_percent"] = _cpu_percent
110
129
 
111
130
  try:
112
131
  info["memory"] = psutil.virtual_memory()._asdict()
@@ -420,6 +420,14 @@ class TerminalManager:
420
420
  pass
421
421
  self._ctl_task = asyncio.create_task(self._control_loop())
422
422
 
423
+ # Start periodic system info sender
424
+ if getattr(self, "_system_info_task", None):
425
+ try:
426
+ self._system_info_task.cancel()
427
+ except Exception:
428
+ pass
429
+ self._system_info_task = asyncio.create_task(self._periodic_system_info())
430
+
423
431
  # For initial connections, request client sessions after control loop starts
424
432
  if is_initial:
425
433
  asyncio.create_task(self._initial_connection_setup())
@@ -518,6 +526,20 @@ class TerminalManager:
518
526
  # Continue processing other messages
519
527
  continue
520
528
 
529
+ async def _periodic_system_info(self) -> None:
530
+ """Send system_info event every 10 seconds when clients are connected."""
531
+ while True:
532
+ try:
533
+ await asyncio.sleep(10)
534
+ if self._client_session_manager.has_interested_clients():
535
+ from .handlers.system_handlers import SystemInfoHandler
536
+ handler = SystemInfoHandler(self._control_channel, self._context)
537
+ system_info = handler.execute({})
538
+ await self._send_session_aware(system_info)
539
+ except Exception as exc:
540
+ logger.exception("Error in periodic system info: %s", exc)
541
+ continue
542
+
521
543
  async def _send_initial_data_to_clients(self, newly_added_sessions: List[str] = None):
522
544
  """Send initial system info and terminal list to connected clients.
523
545
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: portacode
3
- Version: 1.3.36
3
+ Version: 1.3.37
4
4
  Summary: Portacode CLI client and SDK
5
5
  Home-page: https://github.com/portacode/portacode
6
6
  Author: Meena Erian
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