machineconfig 1.97__py3-none-any.whl → 2.1__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 machineconfig might be problematic. Click here for more details.
- machineconfig/cluster/cloud_manager.py +22 -29
- machineconfig/cluster/data_transfer.py +2 -3
- machineconfig/cluster/distribute.py +0 -2
- machineconfig/cluster/file_manager.py +4 -5
- machineconfig/cluster/job_params.py +1 -4
- machineconfig/cluster/loader_runner.py +8 -11
- machineconfig/cluster/remote_machine.py +4 -5
- machineconfig/cluster/script_execution.py +2 -2
- machineconfig/cluster/script_notify_upon_completion.py +0 -1
- machineconfig/cluster/sessions_managers/archive/create_zellij_template.py +4 -6
- machineconfig/cluster/sessions_managers/archive/session_managers.py +0 -1
- machineconfig/cluster/sessions_managers/enhanced_command_runner.py +35 -75
- machineconfig/cluster/sessions_managers/wt_local.py +113 -185
- machineconfig/cluster/sessions_managers/wt_local_manager.py +127 -197
- machineconfig/cluster/sessions_managers/wt_remote.py +60 -67
- machineconfig/cluster/sessions_managers/wt_remote_manager.py +110 -149
- machineconfig/cluster/sessions_managers/wt_utils/layout_generator.py +61 -64
- machineconfig/cluster/sessions_managers/wt_utils/process_monitor.py +72 -172
- machineconfig/cluster/sessions_managers/wt_utils/remote_executor.py +27 -60
- machineconfig/cluster/sessions_managers/wt_utils/session_manager.py +58 -137
- machineconfig/cluster/sessions_managers/wt_utils/status_reporter.py +46 -74
- machineconfig/cluster/sessions_managers/zellij_local.py +91 -147
- machineconfig/cluster/sessions_managers/zellij_local_manager.py +165 -190
- machineconfig/cluster/sessions_managers/zellij_remote.py +51 -58
- machineconfig/cluster/sessions_managers/zellij_remote_manager.py +40 -46
- machineconfig/cluster/sessions_managers/zellij_utils/example_usage.py +19 -17
- machineconfig/cluster/sessions_managers/zellij_utils/layout_generator.py +30 -31
- machineconfig/cluster/sessions_managers/zellij_utils/process_monitor.py +64 -134
- machineconfig/cluster/sessions_managers/zellij_utils/remote_executor.py +7 -11
- machineconfig/cluster/sessions_managers/zellij_utils/session_manager.py +27 -55
- machineconfig/cluster/sessions_managers/zellij_utils/status_reporter.py +14 -13
- machineconfig/cluster/templates/cli_click.py +0 -1
- machineconfig/cluster/templates/cli_gooey.py +0 -2
- machineconfig/cluster/templates/cli_trogon.py +0 -1
- machineconfig/cluster/templates/run_cloud.py +0 -1
- machineconfig/cluster/templates/run_cluster.py +0 -1
- machineconfig/cluster/templates/run_remote.py +0 -1
- machineconfig/cluster/templates/utils.py +27 -11
- machineconfig/jobs/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/linux/msc/cli_agents.sh +16 -0
- machineconfig/jobs/python/check_installations.py +9 -9
- machineconfig/jobs/python/create_bootable_media.py +0 -2
- machineconfig/jobs/python/python_cargo_build_share.py +2 -2
- machineconfig/jobs/python/python_ve_symlink.py +9 -11
- machineconfig/jobs/python/tasks.py +0 -1
- machineconfig/jobs/python/vscode/api.py +5 -5
- machineconfig/jobs/python/vscode/link_ve.py +20 -21
- machineconfig/jobs/python/vscode/select_interpreter.py +28 -29
- machineconfig/jobs/python/vscode/sync_code.py +14 -18
- machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/python_custom_installers/archive/ngrok.py +15 -15
- machineconfig/jobs/python_custom_installers/dev/aider.py +10 -18
- machineconfig/jobs/python_custom_installers/dev/alacritty.py +12 -21
- machineconfig/jobs/python_custom_installers/dev/brave.py +13 -22
- machineconfig/jobs/python_custom_installers/dev/bypass_paywall.py +13 -20
- machineconfig/jobs/python_custom_installers/dev/code.py +17 -24
- machineconfig/jobs/python_custom_installers/dev/cursor.py +10 -21
- machineconfig/jobs/python_custom_installers/dev/docker_desktop.py +12 -11
- machineconfig/jobs/python_custom_installers/dev/espanso.py +19 -23
- machineconfig/jobs/python_custom_installers/dev/goes.py +9 -16
- machineconfig/jobs/python_custom_installers/dev/lvim.py +13 -21
- machineconfig/jobs/python_custom_installers/dev/nerdfont.py +15 -22
- machineconfig/jobs/python_custom_installers/dev/redis.py +15 -23
- machineconfig/jobs/python_custom_installers/dev/wezterm.py +15 -22
- machineconfig/jobs/python_custom_installers/dev/winget.py +32 -50
- machineconfig/jobs/python_custom_installers/docker.py +15 -24
- machineconfig/jobs/python_custom_installers/gh.py +18 -26
- machineconfig/jobs/python_custom_installers/hx.py +33 -17
- machineconfig/jobs/python_custom_installers/warp-cli.py +15 -23
- machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/python_generic_installers/config.json +412 -389
- machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/jobs/python_windows_installers/dev/config.json +1 -1
- machineconfig/jobs/windows/archive/archive_pygraphviz.ps1 +1 -1
- machineconfig/jobs/windows/msc/cli_agents.bat +0 -0
- machineconfig/jobs/windows/msc/cli_agents.ps1 +0 -0
- machineconfig/jobs/windows/start_terminal.ps1 +1 -1
- machineconfig/logger.py +50 -0
- machineconfig/profile/create.py +50 -36
- machineconfig/profile/create_hardlinks.py +33 -26
- machineconfig/profile/shell.py +87 -60
- machineconfig/scripts/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/cloud/init.sh +2 -2
- machineconfig/scripts/linux/checkout_versions +1 -1
- machineconfig/scripts/linux/choose_wezterm_theme +1 -1
- machineconfig/scripts/linux/cloud_copy +1 -1
- machineconfig/scripts/linux/cloud_manager +1 -1
- machineconfig/scripts/linux/cloud_mount +1 -1
- machineconfig/scripts/linux/cloud_repo_sync +1 -1
- machineconfig/scripts/linux/cloud_sync +1 -1
- machineconfig/scripts/linux/croshell +1 -1
- machineconfig/scripts/linux/devops +3 -5
- machineconfig/scripts/linux/fire +2 -1
- machineconfig/scripts/linux/fire_agents +3 -3
- machineconfig/scripts/linux/ftpx +1 -1
- machineconfig/scripts/linux/gh_models +1 -1
- machineconfig/scripts/linux/kill_process +1 -1
- machineconfig/scripts/linux/mcinit +2 -2
- machineconfig/scripts/linux/repos +1 -1
- machineconfig/scripts/linux/scheduler +1 -1
- machineconfig/scripts/linux/start_slidev +1 -1
- machineconfig/scripts/linux/start_terminals +1 -1
- machineconfig/scripts/linux/url2md +1 -1
- machineconfig/scripts/linux/warp-cli.sh +122 -0
- machineconfig/scripts/linux/wifi_conn +1 -1
- machineconfig/scripts/python/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/croshell.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_jobs.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/__init__.py +0 -0
- machineconfig/scripts/python/ai/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/generate_files.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/mcinit.cpython-313.pyc +0 -0
- machineconfig/scripts/python/ai/chatmodes/Thinking-Beast-Mode.chatmode.md +337 -0
- machineconfig/scripts/python/ai/chatmodes/Ultimate-Transparent-Thinking-Beast-Mode.chatmode.md +644 -0
- machineconfig/scripts/python/ai/chatmodes/deepResearch.chatmode.md +81 -0
- machineconfig/scripts/python/ai/configs/.gemini/settings.json +81 -0
- machineconfig/scripts/python/ai/generate_files.py +84 -0
- machineconfig/scripts/python/ai/instructions/python/dev.instructions.md +45 -0
- machineconfig/scripts/python/ai/mcinit.py +107 -0
- machineconfig/scripts/python/ai/prompts/allLintersAndTypeCheckers.prompt.md +5 -0
- machineconfig/scripts/python/ai/prompts/research-report-skeleton.prompt.md +38 -0
- machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +52 -0
- machineconfig/scripts/python/archive/tmate_conn.py +5 -5
- machineconfig/scripts/python/archive/tmate_start.py +3 -3
- machineconfig/scripts/python/choose_wezterm_theme.py +2 -2
- machineconfig/scripts/python/cloud_copy.py +20 -19
- machineconfig/scripts/python/cloud_mount.py +10 -8
- machineconfig/scripts/python/cloud_repo_sync.py +15 -15
- machineconfig/scripts/python/cloud_sync.py +1 -1
- machineconfig/scripts/python/croshell.py +18 -16
- machineconfig/scripts/python/devops.py +6 -6
- machineconfig/scripts/python/devops_add_identity.py +9 -7
- machineconfig/scripts/python/devops_add_ssh_key.py +19 -19
- machineconfig/scripts/python/devops_backup_retrieve.py +14 -14
- machineconfig/scripts/python/devops_devapps_install.py +3 -3
- machineconfig/scripts/python/devops_update_repos.py +141 -53
- machineconfig/scripts/python/dotfile.py +3 -3
- machineconfig/scripts/python/fire_agents.py +202 -41
- machineconfig/scripts/python/fire_jobs.py +20 -21
- machineconfig/scripts/python/ftpx.py +4 -3
- machineconfig/scripts/python/gh_models.py +94 -94
- machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-313.pyc +0 -0
- machineconfig/scripts/python/helpers/cloud_helpers.py +3 -3
- machineconfig/scripts/python/helpers/helpers2.py +3 -3
- machineconfig/scripts/python/helpers/helpers4.py +8 -7
- machineconfig/scripts/python/helpers/helpers5.py +7 -7
- machineconfig/scripts/python/helpers/repo_sync_helpers.py +2 -2
- machineconfig/scripts/python/mount_nfs.py +4 -3
- machineconfig/scripts/python/mount_nw_drive.py +4 -4
- machineconfig/scripts/python/mount_ssh.py +4 -3
- machineconfig/scripts/python/repos.py +9 -9
- machineconfig/scripts/python/scheduler.py +1 -1
- machineconfig/scripts/python/start_slidev.py +9 -8
- machineconfig/scripts/python/start_terminals.py +1 -1
- machineconfig/scripts/python/viewer.py +40 -40
- machineconfig/scripts/python/wifi_conn.py +65 -66
- machineconfig/scripts/python/wsl_windows_transfer.py +2 -2
- machineconfig/scripts/windows/checkout_version.ps1 +1 -3
- machineconfig/scripts/windows/choose_wezterm_theme.ps1 +1 -3
- machineconfig/scripts/windows/cloud_copy.ps1 +2 -6
- machineconfig/scripts/windows/cloud_manager.ps1 +1 -1
- machineconfig/scripts/windows/cloud_repo_sync.ps1 +1 -2
- machineconfig/scripts/windows/cloud_sync.ps1 +2 -2
- machineconfig/scripts/windows/croshell.ps1 +2 -2
- machineconfig/scripts/windows/devops.ps1 +1 -4
- machineconfig/scripts/windows/dotfile.ps1 +1 -3
- machineconfig/scripts/windows/fire.ps1 +1 -1
- machineconfig/scripts/windows/ftpx.ps1 +2 -2
- machineconfig/scripts/windows/gpt.ps1 +1 -1
- machineconfig/scripts/windows/kill_process.ps1 +1 -2
- machineconfig/scripts/windows/mcinit.ps1 +2 -2
- machineconfig/scripts/windows/mount_nfs.ps1 +1 -1
- machineconfig/scripts/windows/mount_ssh.ps1 +1 -1
- machineconfig/scripts/windows/pomodoro.ps1 +1 -1
- machineconfig/scripts/windows/py2exe.ps1 +1 -3
- machineconfig/scripts/windows/repos.ps1 +1 -1
- machineconfig/scripts/windows/scheduler.ps1 +1 -1
- machineconfig/scripts/windows/snapshot.ps1 +2 -2
- machineconfig/scripts/windows/start_slidev.ps1 +1 -1
- machineconfig/scripts/windows/start_terminals.ps1 +1 -1
- machineconfig/scripts/windows/wifi_conn.ps1 +1 -1
- machineconfig/scripts/windows/wsl_windows_transfer.ps1 +1 -3
- machineconfig/settings/lf/linux/lfrc +1 -1
- machineconfig/settings/linters/.ruff.toml +2 -2
- machineconfig/settings/linters/.ruff_cache/.gitignore +2 -0
- machineconfig/settings/linters/.ruff_cache/CACHEDIR.TAG +1 -0
- machineconfig/settings/lvim/windows/archive/config_additional.lua +1 -1
- machineconfig/settings/shells/ipy/profiles/default/startup/playext.py +71 -71
- machineconfig/settings/shells/wt/settings.json +8 -8
- machineconfig/settings/svim/linux/init.toml +1 -1
- machineconfig/settings/svim/windows/init.toml +1 -1
- machineconfig/setup_linux/web_shortcuts/croshell.sh +0 -54
- machineconfig/setup_linux/web_shortcuts/interactive.sh +6 -6
- machineconfig/setup_linux/web_shortcuts/tmp.sh +2 -0
- machineconfig/setup_windows/web_shortcuts/all.ps1 +2 -2
- machineconfig/setup_windows/web_shortcuts/ascii_art.ps1 +1 -1
- machineconfig/setup_windows/web_shortcuts/croshell.ps1 +1 -1
- machineconfig/setup_windows/web_shortcuts/interactive.ps1 +5 -5
- machineconfig/setup_windows/wt_and_pwsh/install_fonts.ps1 +51 -15
- machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +75 -18
- machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +52 -42
- machineconfig/utils/ai/browser_user_wrapper.py +5 -5
- machineconfig/utils/ai/generate_file_checklist.py +19 -22
- machineconfig/utils/ai/url2md.py +5 -3
- machineconfig/utils/cloud/onedrive/setup_oauth.py +5 -4
- machineconfig/utils/cloud/onedrive/transaction.py +192 -227
- machineconfig/utils/code.py +71 -43
- machineconfig/utils/installer.py +77 -85
- machineconfig/utils/installer_utils/installer_abc.py +29 -17
- machineconfig/utils/installer_utils/installer_class.py +188 -83
- machineconfig/utils/io_save.py +3 -15
- machineconfig/utils/links.py +22 -11
- machineconfig/utils/notifications.py +197 -0
- machineconfig/utils/options.py +38 -25
- machineconfig/utils/path.py +18 -6
- machineconfig/utils/path_reduced.py +637 -316
- machineconfig/utils/procs.py +69 -63
- machineconfig/utils/scheduling.py +11 -13
- machineconfig/utils/ssh.py +351 -0
- machineconfig/utils/terminal.py +225 -0
- machineconfig/utils/utils.py +13 -12
- machineconfig/utils/utils2.py +43 -10
- machineconfig/utils/utils5.py +242 -46
- machineconfig/utils/ve.py +11 -6
- {machineconfig-1.97.dist-info → machineconfig-2.1.dist-info}/METADATA +15 -9
- {machineconfig-1.97.dist-info → machineconfig-2.1.dist-info}/RECORD +232 -235
- machineconfig/cluster/self_ssh.py +0 -57
- machineconfig/jobs/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/archive/python_tools.txt +0 -12
- machineconfig/jobs/python/vscode/__pycache__/select_interpreter.cpython-311.pyc +0 -0
- machineconfig/jobs/python_custom_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python_generic_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python_generic_installers/update.py +0 -3
- machineconfig/jobs/python_linux_installers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/create.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/shell.cpython-311.pyc +0 -0
- machineconfig/scripts/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/linux/activate_ve +0 -87
- machineconfig/scripts/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_copy.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_mount.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/cloud_sync.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/croshell.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_backup_retrieve.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_devapps_install.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_agents.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_jobs.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/get_zellij_cmd.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/repos.cpython-311.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/init.cpython-311.pyc +0 -0
- machineconfig/scripts/python/ai/init.py +0 -56
- machineconfig/scripts/python/ai/rules/python/dev.md +0 -31
- machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/cloud_helpers.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers2.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/repo_sync_helpers.cpython-311.pyc +0 -0
- machineconfig/scripts/windows/activate_ve.ps1 +0 -54
- {machineconfig-1.97.dist-info → machineconfig-2.1.dist-info}/WHEEL +0 -0
- {machineconfig-1.97.dist-info → machineconfig-2.1.dist-info}/top_level.txt +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"""
|
|
3
3
|
Windows Terminal session management utilities for local and remote operations.
|
|
4
4
|
"""
|
|
5
|
+
|
|
5
6
|
import logging
|
|
6
7
|
import subprocess
|
|
7
8
|
from typing import Dict, Any, Optional
|
|
@@ -13,57 +14,51 @@ logger = logging.getLogger(__name__)
|
|
|
13
14
|
|
|
14
15
|
class WTSessionManager:
|
|
15
16
|
"""Handles Windows Terminal session operations on local and remote machines."""
|
|
16
|
-
|
|
17
|
-
def __init__(self, remote_executor: Optional[WTRemoteExecutor] = None,
|
|
18
|
-
session_name: str = "default", tmp_layout_dir: Path | None = None):
|
|
17
|
+
|
|
18
|
+
def __init__(self, remote_executor: Optional[WTRemoteExecutor] = None, session_name: str = "default", tmp_layout_dir: Path | None = None):
|
|
19
19
|
self.remote_executor = remote_executor
|
|
20
20
|
self.session_name = session_name
|
|
21
21
|
self.tmp_layout_dir = tmp_layout_dir or Path.home() / "tmp_results" / "wt_layouts" / "layout_manager"
|
|
22
22
|
self.is_local = remote_executor is None
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
@property
|
|
25
25
|
def location_name(self) -> str:
|
|
26
26
|
"""Get the location name for status reporting."""
|
|
27
27
|
return "local" if self.is_local else (self.remote_executor.remote_name if self.remote_executor else "unknown")
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
def _run_command(self, command: str, timeout: int = 30) -> subprocess.CompletedProcess[str]:
|
|
30
30
|
"""Run command either locally or remotely."""
|
|
31
31
|
if self.is_local:
|
|
32
|
-
return subprocess.run(
|
|
33
|
-
["powershell", "-Command", command],
|
|
34
|
-
capture_output=True,
|
|
35
|
-
text=True,
|
|
36
|
-
timeout=timeout
|
|
37
|
-
)
|
|
32
|
+
return subprocess.run(["powershell", "-Command", command], capture_output=True, text=True, timeout=timeout)
|
|
38
33
|
else:
|
|
39
34
|
if self.remote_executor is None:
|
|
40
35
|
raise ValueError("Remote executor is None but is_local is False")
|
|
41
36
|
return self.remote_executor.run_command(command, timeout)
|
|
42
|
-
|
|
37
|
+
|
|
43
38
|
def copy_script_to_remote(self, local_script_file: Path, random_suffix: str) -> str:
|
|
44
39
|
"""Copy the script file to the remote machine and return the remote path."""
|
|
45
40
|
if self.is_local:
|
|
46
41
|
# For local operations, just return the local path
|
|
47
42
|
return str(local_script_file)
|
|
48
|
-
|
|
43
|
+
|
|
49
44
|
if self.remote_executor is None:
|
|
50
45
|
raise ValueError("Remote executor is None but operation requires remote access")
|
|
51
|
-
|
|
46
|
+
|
|
52
47
|
remote_layout_dir = f"~/{self.tmp_layout_dir.relative_to(Path.home())}"
|
|
53
48
|
remote_script_file = f"{remote_layout_dir}/wt_script_{self.session_name}_{random_suffix}.ps1"
|
|
54
|
-
|
|
49
|
+
|
|
55
50
|
# Create remote directory
|
|
56
51
|
if not self.remote_executor.create_remote_directory(remote_layout_dir):
|
|
57
52
|
raise RuntimeError(f"Failed to create remote directory: {remote_layout_dir}")
|
|
58
|
-
|
|
53
|
+
|
|
59
54
|
# Copy script file to remote machine
|
|
60
55
|
copy_result = self.remote_executor.copy_file_to_remote(str(local_script_file), remote_script_file)
|
|
61
56
|
if not copy_result["success"]:
|
|
62
57
|
raise RuntimeError(f"Failed to copy script file to remote: {copy_result['error']}")
|
|
63
|
-
|
|
58
|
+
|
|
64
59
|
logger.info(f"Windows Terminal script file copied to remote: {self.remote_executor.remote_name}:{remote_script_file}")
|
|
65
60
|
return remote_script_file
|
|
66
|
-
|
|
61
|
+
|
|
67
62
|
def check_wt_session_status(self) -> Dict[str, Any]:
|
|
68
63
|
"""Check if Windows Terminal windows exist and are running."""
|
|
69
64
|
try:
|
|
@@ -74,66 +69,37 @@ Select-Object Id, ProcessName, StartTime, MainWindowTitle |
|
|
|
74
69
|
ConvertTo-Json -Depth 2
|
|
75
70
|
"""
|
|
76
71
|
result = self._run_command(wt_check_cmd, timeout=10)
|
|
77
|
-
|
|
72
|
+
|
|
78
73
|
if result.returncode == 0:
|
|
79
74
|
output = result.stdout.strip()
|
|
80
75
|
if output and output != "":
|
|
81
76
|
try:
|
|
82
77
|
import json
|
|
78
|
+
|
|
83
79
|
processes = json.loads(output)
|
|
84
80
|
if not isinstance(processes, list):
|
|
85
81
|
processes = [processes]
|
|
86
|
-
|
|
82
|
+
|
|
87
83
|
# Look for windows that might belong to our session
|
|
88
84
|
session_windows = []
|
|
89
85
|
for proc in processes:
|
|
90
86
|
window_title = proc.get("MainWindowTitle", "")
|
|
91
87
|
if self.session_name in window_title or not window_title:
|
|
92
88
|
session_windows.append(proc)
|
|
93
|
-
|
|
94
|
-
return {
|
|
95
|
-
"wt_running": True,
|
|
96
|
-
"session_exists": len(session_windows) > 0,
|
|
97
|
-
"session_name": self.session_name,
|
|
98
|
-
"all_windows": processes,
|
|
99
|
-
"session_windows": session_windows,
|
|
100
|
-
"location": self.location_name
|
|
101
|
-
}
|
|
89
|
+
|
|
90
|
+
return {"wt_running": True, "session_exists": len(session_windows) > 0, "session_name": self.session_name, "all_windows": processes, "session_windows": session_windows, "location": self.location_name}
|
|
102
91
|
except Exception as e:
|
|
103
92
|
logger.error(f"Failed to parse Windows Terminal process info: {e}")
|
|
104
|
-
return {
|
|
105
|
-
"wt_running": True,
|
|
106
|
-
"session_exists": False,
|
|
107
|
-
"error": f"Failed to parse process info: {e}",
|
|
108
|
-
"session_name": self.session_name,
|
|
109
|
-
"location": self.location_name
|
|
110
|
-
}
|
|
93
|
+
return {"wt_running": True, "session_exists": False, "error": f"Failed to parse process info: {e}", "session_name": self.session_name, "location": self.location_name}
|
|
111
94
|
else:
|
|
112
|
-
return {
|
|
113
|
-
"wt_running": False,
|
|
114
|
-
"session_exists": False,
|
|
115
|
-
"session_name": self.session_name,
|
|
116
|
-
"all_windows": [],
|
|
117
|
-
"location": self.location_name
|
|
118
|
-
}
|
|
95
|
+
return {"wt_running": False, "session_exists": False, "session_name": self.session_name, "all_windows": [], "location": self.location_name}
|
|
119
96
|
else:
|
|
120
|
-
return {
|
|
121
|
-
|
|
122
|
-
"error": result.stderr,
|
|
123
|
-
"session_name": self.session_name,
|
|
124
|
-
"location": self.location_name
|
|
125
|
-
}
|
|
126
|
-
|
|
97
|
+
return {"wt_running": False, "error": result.stderr, "session_name": self.session_name, "location": self.location_name}
|
|
98
|
+
|
|
127
99
|
except Exception as e:
|
|
128
|
-
return {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
"session_name": self.session_name,
|
|
132
|
-
"location": self.location_name
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
def start_wt_session(self, script_file_path: Optional[str] = None,
|
|
136
|
-
wt_command: Optional[str] = None) -> Dict[str, Any]:
|
|
100
|
+
return {"wt_running": False, "error": str(e), "session_name": self.session_name, "location": self.location_name}
|
|
101
|
+
|
|
102
|
+
def start_wt_session(self, script_file_path: Optional[str] = None, wt_command: Optional[str] = None) -> Dict[str, Any]:
|
|
137
103
|
"""Start a Windows Terminal session with the generated layout."""
|
|
138
104
|
try:
|
|
139
105
|
if script_file_path:
|
|
@@ -143,51 +109,36 @@ ConvertTo-Json -Depth 2
|
|
|
143
109
|
else:
|
|
144
110
|
script_filename = Path(script_file_path).name
|
|
145
111
|
script_path = f"~/{self.tmp_layout_dir.relative_to(Path.home())}/{script_filename}"
|
|
146
|
-
|
|
112
|
+
|
|
147
113
|
logger.info(f"Starting Windows Terminal session '{self.session_name}' with script: {script_path}")
|
|
148
|
-
|
|
114
|
+
|
|
149
115
|
# Execute the PowerShell script
|
|
150
116
|
if self.is_local:
|
|
151
117
|
start_cmd = f"& '{script_path}'"
|
|
152
118
|
else:
|
|
153
119
|
start_cmd = f"powershell -ExecutionPolicy Bypass -File '{script_path}'"
|
|
154
|
-
|
|
120
|
+
|
|
155
121
|
elif wt_command:
|
|
156
122
|
# Execute the wt command directly
|
|
157
123
|
logger.info(f"Starting Windows Terminal session '{self.session_name}' with command: {wt_command}")
|
|
158
124
|
start_cmd = wt_command
|
|
159
125
|
else:
|
|
160
126
|
raise ValueError("Either script_file_path or wt_command must be provided.")
|
|
161
|
-
|
|
127
|
+
|
|
162
128
|
logger.info(f"Executing command: {start_cmd}")
|
|
163
129
|
result = self._run_command(start_cmd, timeout=30)
|
|
164
|
-
|
|
130
|
+
|
|
165
131
|
if result.returncode == 0:
|
|
166
132
|
logger.info(f"Windows Terminal session '{self.session_name}' started successfully")
|
|
167
|
-
return {
|
|
168
|
-
"success": True,
|
|
169
|
-
"session_name": self.session_name,
|
|
170
|
-
"location": self.location_name,
|
|
171
|
-
"message": "Session started successfully"
|
|
172
|
-
}
|
|
133
|
+
return {"success": True, "session_name": self.session_name, "location": self.location_name, "message": "Session started successfully"}
|
|
173
134
|
else:
|
|
174
|
-
return {
|
|
175
|
-
|
|
176
|
-
"error": result.stderr or result.stdout,
|
|
177
|
-
"session_name": self.session_name,
|
|
178
|
-
"location": self.location_name
|
|
179
|
-
}
|
|
180
|
-
|
|
135
|
+
return {"success": False, "error": result.stderr or result.stdout, "session_name": self.session_name, "location": self.location_name}
|
|
136
|
+
|
|
181
137
|
except Exception as e:
|
|
182
138
|
error_location = "locally" if self.is_local else f"on {self.remote_executor.remote_name if self.remote_executor else 'unknown'}"
|
|
183
139
|
logger.error(f"Failed to start Windows Terminal session {error_location}: {e}")
|
|
184
|
-
return {
|
|
185
|
-
|
|
186
|
-
"error": str(e),
|
|
187
|
-
"session_name": self.session_name,
|
|
188
|
-
"location": self.location_name
|
|
189
|
-
}
|
|
190
|
-
|
|
140
|
+
return {"success": False, "error": str(e), "session_name": self.session_name, "location": self.location_name}
|
|
141
|
+
|
|
191
142
|
def attach_to_session(self, window_name: Optional[str] = None) -> None:
|
|
192
143
|
"""Attach to a Windows Terminal session/window."""
|
|
193
144
|
try:
|
|
@@ -197,24 +148,24 @@ ConvertTo-Json -Depth 2
|
|
|
197
148
|
attach_cmd = f"wt -w {window_name}"
|
|
198
149
|
else:
|
|
199
150
|
attach_cmd = f"wt -w {self.session_name}"
|
|
200
|
-
|
|
151
|
+
|
|
201
152
|
logger.info(f"Attaching to local Windows Terminal window '{window_name or self.session_name}'")
|
|
202
153
|
subprocess.run(attach_cmd, shell=True)
|
|
203
154
|
else:
|
|
204
155
|
# For remote sessions, use SSH with interactive terminal
|
|
205
156
|
if self.remote_executor is None:
|
|
206
157
|
raise ValueError("Remote executor is None but operation requires remote access")
|
|
207
|
-
|
|
158
|
+
|
|
208
159
|
if window_name:
|
|
209
160
|
attach_cmd = f"wt -w {window_name}"
|
|
210
161
|
else:
|
|
211
162
|
attach_cmd = f"wt -w {self.session_name}"
|
|
212
|
-
|
|
163
|
+
|
|
213
164
|
self.remote_executor.start_wt_session_interactive(attach_cmd)
|
|
214
165
|
except Exception as e:
|
|
215
166
|
logger.error(f"Failed to attach to Windows Terminal session: {e}")
|
|
216
167
|
raise
|
|
217
|
-
|
|
168
|
+
|
|
218
169
|
def kill_wt_session(self, force: bool = True) -> Dict[str, Any]:
|
|
219
170
|
"""Kill Windows Terminal processes related to this session."""
|
|
220
171
|
try:
|
|
@@ -224,77 +175,47 @@ ConvertTo-Json -Depth 2
|
|
|
224
175
|
else:
|
|
225
176
|
# Try to gracefully close windows (this is harder to target specific windows)
|
|
226
177
|
kill_cmd = "Get-Process -Name 'WindowsTerminal' -ErrorAction SilentlyContinue | ForEach-Object { $_.CloseMainWindow() }"
|
|
227
|
-
|
|
178
|
+
|
|
228
179
|
logger.info(f"Killing Windows Terminal session '{self.session_name}'")
|
|
229
180
|
result = self._run_command(kill_cmd, timeout=10)
|
|
230
|
-
|
|
231
|
-
return {
|
|
232
|
-
|
|
233
|
-
"message": "Session killed" if result.returncode == 0 else result.stderr,
|
|
234
|
-
"session_name": self.session_name,
|
|
235
|
-
"location": self.location_name
|
|
236
|
-
}
|
|
237
|
-
|
|
181
|
+
|
|
182
|
+
return {"success": result.returncode == 0, "message": "Session killed" if result.returncode == 0 else result.stderr, "session_name": self.session_name, "location": self.location_name}
|
|
183
|
+
|
|
238
184
|
except Exception as e:
|
|
239
185
|
logger.error(f"Failed to kill Windows Terminal session: {e}")
|
|
240
|
-
return {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
"session_name": self.session_name,
|
|
244
|
-
"location": self.location_name
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
def create_new_tab(self, tab_name: str, cwd: str, command: str,
|
|
248
|
-
window_name: Optional[str] = None) -> Dict[str, Any]:
|
|
186
|
+
return {"success": False, "error": str(e), "session_name": self.session_name, "location": self.location_name}
|
|
187
|
+
|
|
188
|
+
def create_new_tab(self, tab_name: str, cwd: str, command: str, window_name: Optional[str] = None) -> Dict[str, Any]:
|
|
249
189
|
"""Create a new tab in the Windows Terminal session."""
|
|
250
190
|
try:
|
|
251
191
|
# Build the new-tab command
|
|
252
192
|
tab_cmd_parts = ["wt"]
|
|
253
|
-
|
|
193
|
+
|
|
254
194
|
if window_name:
|
|
255
195
|
tab_cmd_parts.extend(["-w", f'"{window_name}"'])
|
|
256
|
-
|
|
196
|
+
|
|
257
197
|
tab_cmd_parts.append("new-tab")
|
|
258
198
|
tab_cmd_parts.extend(["-d", f'"{cwd}"'])
|
|
259
199
|
tab_cmd_parts.extend(["--title", f'"{tab_name}"'])
|
|
260
200
|
tab_cmd_parts.append(f'"{command}"')
|
|
261
|
-
|
|
201
|
+
|
|
262
202
|
new_tab_cmd = " ".join(tab_cmd_parts)
|
|
263
|
-
|
|
203
|
+
|
|
264
204
|
logger.info(f"Creating new tab '{tab_name}' in Windows Terminal")
|
|
265
205
|
result = self._run_command(new_tab_cmd, timeout=15)
|
|
266
|
-
|
|
267
|
-
return {
|
|
268
|
-
|
|
269
|
-
"message": f"Tab '{tab_name}' created" if result.returncode == 0 else result.stderr,
|
|
270
|
-
"tab_name": tab_name,
|
|
271
|
-
"command": command,
|
|
272
|
-
"location": self.location_name
|
|
273
|
-
}
|
|
274
|
-
|
|
206
|
+
|
|
207
|
+
return {"success": result.returncode == 0, "message": f"Tab '{tab_name}' created" if result.returncode == 0 else result.stderr, "tab_name": tab_name, "command": command, "location": self.location_name}
|
|
208
|
+
|
|
275
209
|
except Exception as e:
|
|
276
210
|
logger.error(f"Failed to create new tab '{tab_name}': {e}")
|
|
277
|
-
return {
|
|
278
|
-
|
|
279
|
-
"error": str(e),
|
|
280
|
-
"tab_name": tab_name,
|
|
281
|
-
"location": self.location_name
|
|
282
|
-
}
|
|
283
|
-
|
|
211
|
+
return {"success": False, "error": str(e), "tab_name": tab_name, "location": self.location_name}
|
|
212
|
+
|
|
284
213
|
def get_wt_version(self) -> Dict[str, Any]:
|
|
285
214
|
"""Get Windows Terminal version information."""
|
|
286
215
|
try:
|
|
287
216
|
version_cmd = "wt --version"
|
|
288
217
|
result = self._run_command(version_cmd, timeout=10)
|
|
289
|
-
|
|
290
|
-
return {
|
|
291
|
-
"success": result.returncode == 0,
|
|
292
|
-
"version": result.stdout.strip() if result.returncode == 0 else "Unknown",
|
|
293
|
-
"location": self.location_name
|
|
294
|
-
}
|
|
218
|
+
|
|
219
|
+
return {"success": result.returncode == 0, "version": result.stdout.strip() if result.returncode == 0 else "Unknown", "location": self.location_name}
|
|
295
220
|
except Exception as e:
|
|
296
|
-
return {
|
|
297
|
-
"success": False,
|
|
298
|
-
"error": str(e),
|
|
299
|
-
"location": self.location_name
|
|
300
|
-
}
|
|
221
|
+
return {"success": False, "error": str(e), "location": self.location_name}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"""
|
|
3
3
|
Status reporting utilities for Windows Terminal layouts and sessions.
|
|
4
4
|
"""
|
|
5
|
+
|
|
5
6
|
import logging
|
|
6
7
|
from typing import Dict, Any, Tuple
|
|
7
8
|
from .process_monitor import WTProcessMonitor
|
|
@@ -12,145 +13,130 @@ logger = logging.getLogger(__name__)
|
|
|
12
13
|
|
|
13
14
|
class WTStatusReporter:
|
|
14
15
|
"""Handles comprehensive status reporting for Windows Terminal sessions."""
|
|
15
|
-
|
|
16
|
+
|
|
16
17
|
def __init__(self, process_monitor: WTProcessMonitor, session_manager: WTSessionManager):
|
|
17
18
|
self.process_monitor = process_monitor
|
|
18
19
|
self.session_manager = session_manager
|
|
19
|
-
|
|
20
|
+
|
|
20
21
|
def get_comprehensive_status(self, tab_config: Dict[str, Tuple[str, str]]) -> Dict[str, Any]:
|
|
21
22
|
"""Get comprehensive status including Windows Terminal session and all commands."""
|
|
22
23
|
wt_status = self.session_manager.check_wt_session_status()
|
|
23
24
|
commands_status = self.process_monitor.check_all_commands_status(tab_config)
|
|
24
|
-
|
|
25
|
+
|
|
25
26
|
running_count = sum(1 for status in commands_status.values() if status.get("running", False))
|
|
26
27
|
total_count = len(commands_status)
|
|
27
|
-
|
|
28
|
+
|
|
28
29
|
return {
|
|
29
30
|
"wt_session": wt_status,
|
|
30
31
|
"commands": commands_status,
|
|
31
|
-
"summary": {
|
|
32
|
-
"total_commands": total_count,
|
|
33
|
-
"running_commands": running_count,
|
|
34
|
-
"stopped_commands": total_count - running_count,
|
|
35
|
-
"session_healthy": wt_status.get("session_exists", False),
|
|
36
|
-
"location": wt_status.get("location", "unknown")
|
|
37
|
-
}
|
|
32
|
+
"summary": {"total_commands": total_count, "running_commands": running_count, "stopped_commands": total_count - running_count, "session_healthy": wt_status.get("session_exists", False), "location": wt_status.get("location", "unknown")},
|
|
38
33
|
}
|
|
39
|
-
|
|
34
|
+
|
|
40
35
|
def print_status_report(self, tab_config: Dict[str, Tuple[str, str]]) -> None:
|
|
41
36
|
"""Print a comprehensive status report for the Windows Terminal session."""
|
|
42
37
|
status = self.get_comprehensive_status(tab_config)
|
|
43
38
|
wt_session = status["wt_session"]
|
|
44
39
|
commands = status["commands"]
|
|
45
40
|
summary = status["summary"]
|
|
46
|
-
|
|
41
|
+
|
|
47
42
|
print("=" * 80)
|
|
48
43
|
print("🖥️ WINDOWS TERMINAL STATUS REPORT")
|
|
49
44
|
print("=" * 80)
|
|
50
|
-
|
|
45
|
+
|
|
51
46
|
# Session status
|
|
52
47
|
location = wt_session.get("location", "unknown")
|
|
53
48
|
print(f"📍 Location: {location}")
|
|
54
49
|
print(f"🪟 Session: {self.session_manager.session_name}")
|
|
55
|
-
|
|
50
|
+
|
|
56
51
|
if wt_session.get("wt_running", False):
|
|
57
52
|
if wt_session.get("session_exists", False):
|
|
58
53
|
session_windows = wt_session.get("session_windows", [])
|
|
59
54
|
all_windows = wt_session.get("all_windows", [])
|
|
60
|
-
print(
|
|
55
|
+
print("✅ Windows Terminal is running")
|
|
61
56
|
print(f" Session windows: {len(session_windows)}")
|
|
62
57
|
print(f" Total WT windows: {len(all_windows)}")
|
|
63
58
|
else:
|
|
64
|
-
print(
|
|
59
|
+
print("⚠️ Windows Terminal is running but no session windows found")
|
|
65
60
|
else:
|
|
66
61
|
error_msg = wt_session.get("error", "Unknown error")
|
|
67
62
|
print(f"❌ Windows Terminal session issue: {error_msg}")
|
|
68
|
-
|
|
63
|
+
|
|
69
64
|
print()
|
|
70
|
-
|
|
65
|
+
|
|
71
66
|
# Commands status
|
|
72
67
|
print(f"📋 COMMANDS STATUS ({summary['running_commands']}/{summary['total_commands']} running):")
|
|
73
68
|
print("-" * 60)
|
|
74
|
-
|
|
69
|
+
|
|
75
70
|
for tab_name, cmd_status in commands.items():
|
|
76
71
|
status_icon = "✅" if cmd_status.get("running", False) else "❌"
|
|
77
72
|
cmd_text = cmd_status.get("command", "Unknown")[:50]
|
|
78
73
|
if len(cmd_status.get("command", "")) > 50:
|
|
79
74
|
cmd_text += "..."
|
|
80
|
-
|
|
75
|
+
|
|
81
76
|
print(f" {status_icon} {tab_name}")
|
|
82
77
|
print(f" Command: {cmd_text}")
|
|
83
|
-
|
|
78
|
+
|
|
84
79
|
if cmd_status.get("processes"):
|
|
85
80
|
processes = cmd_status["processes"][:3] # Show first 3 processes
|
|
86
81
|
for proc in processes:
|
|
87
82
|
pid = proc.get("pid", "Unknown")
|
|
88
83
|
name = proc.get("name", "Unknown")
|
|
89
84
|
print(f" └─ PID {pid}: {name}")
|
|
90
|
-
|
|
85
|
+
|
|
91
86
|
if len(cmd_status["processes"]) > 3:
|
|
92
87
|
remaining = len(cmd_status["processes"]) - 3
|
|
93
88
|
print(f" └─ ... and {remaining} more processes")
|
|
94
|
-
|
|
89
|
+
|
|
95
90
|
if cmd_status.get("error"):
|
|
96
91
|
print(f" Error: {cmd_status['error']}")
|
|
97
|
-
|
|
92
|
+
|
|
98
93
|
print()
|
|
99
|
-
|
|
94
|
+
|
|
100
95
|
# Summary
|
|
101
96
|
print("📊 SUMMARY:")
|
|
102
97
|
print(f" Total commands: {summary['total_commands']}")
|
|
103
98
|
print(f" Running: {summary['running_commands']}")
|
|
104
99
|
print(f" Stopped: {summary['stopped_commands']}")
|
|
105
100
|
print(f" Session healthy: {'✅' if summary['session_healthy'] else '❌'}")
|
|
106
|
-
|
|
101
|
+
|
|
107
102
|
print("=" * 80)
|
|
108
|
-
|
|
103
|
+
|
|
109
104
|
def get_windows_terminal_overview(self) -> Dict[str, Any]:
|
|
110
105
|
"""Get an overview of all Windows Terminal windows and processes."""
|
|
111
106
|
try:
|
|
112
107
|
wt_windows = self.process_monitor.get_windows_terminal_windows()
|
|
113
108
|
wt_version = self.session_manager.get_wt_version()
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
"success": True,
|
|
117
|
-
"windows_info": wt_windows,
|
|
118
|
-
"version_info": wt_version,
|
|
119
|
-
"location": self.process_monitor.location_name
|
|
120
|
-
}
|
|
109
|
+
|
|
110
|
+
return {"success": True, "windows_info": wt_windows, "version_info": wt_version, "location": self.process_monitor.location_name}
|
|
121
111
|
except Exception as e:
|
|
122
112
|
logger.error(f"Failed to get Windows Terminal overview: {e}")
|
|
123
|
-
return {
|
|
124
|
-
|
|
125
|
-
"error": str(e),
|
|
126
|
-
"location": self.process_monitor.location_name
|
|
127
|
-
}
|
|
128
|
-
|
|
113
|
+
return {"success": False, "error": str(e), "location": self.process_monitor.location_name}
|
|
114
|
+
|
|
129
115
|
def print_windows_terminal_overview(self) -> None:
|
|
130
116
|
"""Print an overview of Windows Terminal status."""
|
|
131
117
|
overview = self.get_windows_terminal_overview()
|
|
132
|
-
|
|
118
|
+
|
|
133
119
|
print("=" * 80)
|
|
134
120
|
print("🖥️ WINDOWS TERMINAL OVERVIEW")
|
|
135
121
|
print("=" * 80)
|
|
136
|
-
|
|
122
|
+
|
|
137
123
|
if overview["success"]:
|
|
138
124
|
location = overview.get("location", "unknown")
|
|
139
125
|
print(f"📍 Location: {location}")
|
|
140
|
-
|
|
126
|
+
|
|
141
127
|
# Version info
|
|
142
128
|
version_info = overview.get("version_info", {})
|
|
143
129
|
if version_info.get("success"):
|
|
144
130
|
print(f"📦 Version: {version_info.get('version', 'Unknown')}")
|
|
145
131
|
else:
|
|
146
132
|
print(f"📦 Version: Error getting version - {version_info.get('error', 'Unknown')}")
|
|
147
|
-
|
|
133
|
+
|
|
148
134
|
# Windows info
|
|
149
135
|
windows_info = overview.get("windows_info", {})
|
|
150
136
|
if windows_info.get("success"):
|
|
151
137
|
windows = windows_info.get("windows", [])
|
|
152
138
|
print(f"🪟 Active Windows: {len(windows)}")
|
|
153
|
-
|
|
139
|
+
|
|
154
140
|
if windows:
|
|
155
141
|
print("\nActive Windows:")
|
|
156
142
|
for i, window in enumerate(windows[:5], 1): # Show first 5 windows
|
|
@@ -158,7 +144,7 @@ class WTStatusReporter:
|
|
|
158
144
|
title = window.get("WindowTitle", "No Title")
|
|
159
145
|
start_time = window.get("StartTime", "Unknown")
|
|
160
146
|
print(f" {i}. PID {pid}: {title} (Started: {start_time})")
|
|
161
|
-
|
|
147
|
+
|
|
162
148
|
if len(windows) > 5:
|
|
163
149
|
print(f" ... and {len(windows) - 5} more windows")
|
|
164
150
|
else:
|
|
@@ -167,18 +153,18 @@ class WTStatusReporter:
|
|
|
167
153
|
print(f"🪟 Windows Info: Error - {windows_info.get('error', 'Unknown')}")
|
|
168
154
|
else:
|
|
169
155
|
print(f"❌ Failed to get overview: {overview.get('error', 'Unknown')}")
|
|
170
|
-
|
|
156
|
+
|
|
171
157
|
print("=" * 80)
|
|
172
|
-
|
|
158
|
+
|
|
173
159
|
def generate_status_summary(self, tab_config: Dict[str, Tuple[str, str]]) -> Dict[str, Any]:
|
|
174
160
|
"""Generate a concise status summary suitable for monitoring."""
|
|
175
161
|
try:
|
|
176
162
|
comprehensive_status = self.get_comprehensive_status(tab_config)
|
|
177
163
|
wt_overview = self.get_windows_terminal_overview()
|
|
178
|
-
|
|
164
|
+
|
|
179
165
|
summary = comprehensive_status["summary"]
|
|
180
166
|
wt_status = comprehensive_status["wt_session"]
|
|
181
|
-
|
|
167
|
+
|
|
182
168
|
return {
|
|
183
169
|
"timestamp": None, # Will be filled by caller if needed
|
|
184
170
|
"session_name": self.session_manager.session_name,
|
|
@@ -190,39 +176,25 @@ class WTStatusReporter:
|
|
|
190
176
|
"stopped_commands": summary["stopped_commands"],
|
|
191
177
|
"all_commands_running": summary["running_commands"] == summary["total_commands"],
|
|
192
178
|
"wt_windows_count": len(wt_overview.get("windows_info", {}).get("windows", [])) if wt_overview["success"] else 0,
|
|
193
|
-
"wt_version": wt_overview.get("version_info", {}).get("version", "Unknown") if wt_overview["success"] else "Unknown"
|
|
179
|
+
"wt_version": wt_overview.get("version_info", {}).get("version", "Unknown") if wt_overview["success"] else "Unknown",
|
|
194
180
|
}
|
|
195
181
|
except Exception as e:
|
|
196
182
|
logger.error(f"Failed to generate status summary: {e}")
|
|
197
|
-
return {
|
|
198
|
-
|
|
199
|
-
"session_name": self.session_manager.session_name,
|
|
200
|
-
"location": self.process_monitor.location_name
|
|
201
|
-
}
|
|
202
|
-
|
|
183
|
+
return {"error": str(e), "session_name": self.session_manager.session_name, "location": self.process_monitor.location_name}
|
|
184
|
+
|
|
203
185
|
def check_tab_specific_status(self, tab_name: str, tab_config: Dict[str, Tuple[str, str]]) -> Dict[str, Any]:
|
|
204
186
|
"""Get detailed status for a specific tab."""
|
|
205
187
|
if tab_name not in tab_config:
|
|
206
|
-
return {
|
|
207
|
-
|
|
208
|
-
"tab_name": tab_name
|
|
209
|
-
}
|
|
210
|
-
|
|
188
|
+
return {"error": f"Tab '{tab_name}' not found in configuration", "tab_name": tab_name}
|
|
189
|
+
|
|
211
190
|
try:
|
|
212
191
|
cmd_status = self.process_monitor.check_command_status(tab_name, tab_config)
|
|
213
|
-
|
|
192
|
+
|
|
214
193
|
# Add additional context
|
|
215
194
|
cwd, command = tab_config[tab_name]
|
|
216
|
-
cmd_status["tab_config"] = {
|
|
217
|
-
|
|
218
|
-
"command": command
|
|
219
|
-
}
|
|
220
|
-
|
|
195
|
+
cmd_status["tab_config"] = {"working_directory": cwd, "command": command}
|
|
196
|
+
|
|
221
197
|
return cmd_status
|
|
222
198
|
except Exception as e:
|
|
223
199
|
logger.error(f"Failed to check status for tab '{tab_name}': {e}")
|
|
224
|
-
return {
|
|
225
|
-
"error": str(e),
|
|
226
|
-
"tab_name": tab_name,
|
|
227
|
-
"location": self.process_monitor.location_name
|
|
228
|
-
}
|
|
200
|
+
return {"error": str(e), "tab_name": tab_name, "location": self.process_monitor.location_name}
|