computer-use-ootb-internal 0.0.124__py3-none-any.whl → 0.0.126__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.
@@ -1,65 +1,63 @@
1
- # src/computer_use_ootb_internal/preparation/star_rail_prepare.py
2
- import time
3
- import platform
4
- import pyautogui
5
- import webbrowser
6
- import logging # Use logging instead of print for better practice
7
-
8
- # Set up logging for this module if needed, or rely on root logger
9
- log = logging.getLogger(__name__)
10
-
11
- def run_preparation(state):
12
- """
13
- Performs environment preparation specific to Star Rail on Windows.
14
- Opens the specified URL in Edge and performs initial clicks.
15
- """
16
- if platform.system() != "Windows":
17
- log.info("Star Rail preparation skipped: Not running on Windows.")
18
- return
19
-
20
- log.info("Star Rail preparation: Starting environment setup on Windows...")
21
- url = "https://sr.mihoyo.com/cloud/#/" # Consider making this configurable later
22
- browser_opened = False
23
- try:
24
- # Use only webbrowser.open
25
- log.info(f"Attempting to open {url} using webbrowser.open()...")
26
- if webbrowser.open(url):
27
- log.info(f"Successfully requested browser to open {url} via webbrowser.open().")
28
- browser_opened = True
29
- else:
30
- log.warning("webbrowser.open() returned False, indicating potential failure.")
31
-
32
- if not browser_opened:
33
- log.error("Failed to confirm browser opening via webbrowser.open(). Will still attempt clicks.")
34
-
35
- # Add pyautogui click after attempting to open the browser
36
- log.info("Proceeding with pyautogui actions...")
37
- time.sleep(5) # Wait time for the browser to load
38
-
39
- # Get screen size
40
- screen_width, screen_height = pyautogui.size()
41
- log.info(f"Detected screen size: {screen_width}x{screen_height}")
42
-
43
- # Calculate click coordinates based on a reference resolution (e.g., 1280x720)
44
- # TODO: Make these coordinates more robust or configurable
45
- click_x = int(screen_width * (1036 / 1280))
46
- click_y = int(screen_height * (500 / 720))
47
- log.info(f"Calculated click coordinates: ({click_x}, {click_y})")
48
-
49
- # Disable failsafe before clicking
50
- pyautogui.FAILSAFE = False
51
- log.info("PyAutoGUI failsafe temporarily disabled.")
52
-
53
- log.info(f"Clicking at coordinates: ({click_x}, {click_y})")
54
- pyautogui.click(click_x, click_y)
55
- time.sleep(2)
56
- pyautogui.click(click_x, click_y) # Double click?
57
-
58
- log.info("Star Rail preparation clicks completed.")
59
-
60
- except Exception as e:
61
- log.error(f"Error during Star Rail preparation (browser/click): {e}", exc_info=True)
62
- finally:
63
- # Ensure failsafe is re-enabled
64
- pyautogui.FAILSAFE = True
65
- log.info("PyAutoGUI failsafe re-enabled.")
1
+ # src/computer_use_ootb_internal/preparation/star_rail_prepare.py
2
+ import time
3
+ import platform
4
+ import subprocess # Added for taskkill
5
+ import webbrowser
6
+ import logging # Use logging instead of print for better practice
7
+
8
+ # Set up logging for this module if needed, or rely on root logger
9
+ log = logging.getLogger(__name__)
10
+
11
+ def run_preparation(state):
12
+ """
13
+ Performs environment preparation specific to Star Rail on Windows.
14
+ Closes existing Edge browsers and opens the specified URL in a new Edge instance.
15
+ """
16
+ if platform.system() != "Windows":
17
+ log.info("Star Rail preparation skipped: Not running on Windows.")
18
+ return
19
+
20
+ log.info("Star Rail preparation: Starting environment setup on Windows...")
21
+ url = "https://sr.mihoyo.com/cloud/#/" # Consider making this configurable later
22
+ browser_opened = False
23
+ try:
24
+ # Attempt to close existing Microsoft Edge processes
25
+ log.info("Attempting to close existing Microsoft Edge processes...")
26
+ try:
27
+ # /F forces termination, /IM specifies image name
28
+ result = subprocess.run(['taskkill', '/F', '/IM', 'msedge.exe'],
29
+ capture_output=True, text=True, check=False)
30
+ if result.returncode == 0:
31
+ log.info("Successfully sent termination signal to msedge.exe processes.")
32
+ elif "not found" in result.stderr.lower() or "not found" in result.stdout.lower():
33
+ log.info("No running msedge.exe processes found to close.")
34
+ else:
35
+ log.warning(f"taskkill command finished with return code {result.returncode}. Output: {result.stdout} Stderr: {result.stderr}")
36
+ time.sleep(2) # Give processes time to close
37
+ except FileNotFoundError:
38
+ log.error("Error: 'taskkill' command not found. Make sure it's in the system PATH.")
39
+ except Exception as e:
40
+ log.error(f"Error occurred while trying to close Edge: {e}", exc_info=True)
41
+
42
+
43
+ # Use only webbrowser.open
44
+ log.info(f"Attempting to open {url} using webbrowser.open()...")
45
+ if webbrowser.open(url):
46
+ log.info(f"Successfully requested browser to open {url} via webbrowser.open().")
47
+ browser_opened = True
48
+ time.sleep(5) # Wait time for the browser to potentially load the page
49
+ else:
50
+ log.warning("webbrowser.open() returned False, indicating potential failure.")
51
+ # No need to error out completely if browser *request* failed,
52
+ # but it's unlikely the rest of the process would work.
53
+
54
+ if not browser_opened:
55
+ log.error("Failed to confirm browser opening via webbrowser.open().")
56
+
57
+ # Removed pyautogui click logic
58
+
59
+ log.info("Star Rail preparation completed (browser opened).")
60
+
61
+ except Exception as e:
62
+ log.error(f"Error during Star Rail preparation: {e}", exc_info=True)
63
+ # No finally block needed anymore as pyautogui failsafe is removed
@@ -1,195 +1,195 @@
1
- # src/computer_use_ootb_internal/service_manager.py
2
- import sys
3
- import os
4
- import inspect
5
- import subprocess
6
- import ctypes
7
- import platform
8
- import time
9
-
10
- # Constants need to match guard_service.py
11
- _SERVICE_NAME = "OOTBGuardService"
12
- _SERVICE_DISPLAY_NAME = "OOTB Guard Service"
13
- _TASK_NAME_PREFIX = "OOTB_UserLogon_" # Must match guard_service.py
14
-
15
- def is_admin():
16
- """Check if the script is running with administrative privileges."""
17
- if platform.system() != "Windows":
18
- return False # Only applicable on Windows
19
- try:
20
- return ctypes.windll.shell32.IsUserAnAdmin()
21
- except:
22
- return False
23
-
24
- def get_service_module_path():
25
- """Gets the absolute path to the guard_service.py module."""
26
- # Find the path relative to this script's location
27
- # This assumes service_manager.py and guard_service.py are in the same installed package directory
28
- try:
29
- current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
30
- service_module = os.path.join(current_dir, "guard_service.py")
31
- if not os.path.exists(service_module):
32
- raise FileNotFoundError(f"guard_service.py not found adjacent to service_manager.py in {current_dir}")
33
- return service_module
34
- except Exception as e:
35
- # Fallback if inspect fails (e.g., in some frozen environments)
36
- # Try finding it relative to the script itself? Unreliable.
37
- # Let's try sys.prefix - might work in standard venv/conda installs
38
- try:
39
- # sys.prefix points to the environment root (e.g., C:\path\to\env)
40
- # Package likely installed in Lib\site-packages\<package_name>
41
- # This depends heavily on installation layout
42
- package_name = __name__.split('.')[0] # Should be 'computer_use_ootb_internal'
43
- site_packages_path = os.path.join(sys.prefix, 'Lib', 'site-packages')
44
- module_dir = os.path.join(site_packages_path, package_name)
45
- service_module = os.path.join(module_dir, "guard_service.py")
46
- if os.path.exists(service_module):
47
- print(f"Warning: Found service module via sys.prefix fallback: {service_module}")
48
- return service_module
49
- else:
50
- raise FileNotFoundError(f"guard_service.py not found via inspect or sys.prefix fallback (checked {module_dir})")
51
- except Exception as fallback_e:
52
- raise FileNotFoundError(f"Could not find guard_service.py using inspect ({e}) or sys.prefix ({fallback_e}). Check installation.")
53
-
54
-
55
- def run_service_command(command_args, check_errors=True):
56
- """Runs the guard_service.py script with specified command-line args."""
57
- if not is_admin():
58
- print("Error: Administrative privileges are required to manage the service.", file=sys.stderr)
59
- print("Please run this command from an Administrator Command Prompt or PowerShell.", file=sys.stderr)
60
- return False
61
-
62
- try:
63
- python_exe = sys.executable # Use the same python that's running this script
64
- service_script = get_service_module_path()
65
- except FileNotFoundError as e:
66
- print(f"Error: {e}", file=sys.stderr)
67
- return False
68
-
69
- # Quote paths if they contain spaces
70
- if " " in python_exe and not python_exe.startswith('"'):
71
- python_exe = f'"{python_exe}"'
72
- if " " in service_script and not service_script.startswith('"'):
73
- service_script = f'"{service_script}"'
74
-
75
- # Construct command using list to avoid shell quoting issues
76
- cmd = [sys.executable, get_service_module_path()] + command_args
77
- print(f"Executing command: {' '.join(cmd)}")
78
-
79
- try:
80
- # Run the command. Use shell=False with list of args.
81
- # Capture output to check for specific errors if needed, but print it too.
82
- result = subprocess.run(cmd, capture_output=True, text=True, check=check_errors, encoding='utf-8')
83
- if result.stdout:
84
- print("Command STDOUT:")
85
- print(result.stdout)
86
- if result.stderr:
87
- print("Command STDERR:")
88
- print(result.stderr)
89
- print(f"Command {' '.join(command_args)} executed successfully.")
90
- return True
91
- except FileNotFoundError as e:
92
- print(f"Error: Could not find Python executable or service script during execution.", file=sys.stderr)
93
- print(f" Details: {e}", file=sys.stderr)
94
- return False
95
- except subprocess.CalledProcessError as e:
96
- print(f"Error executing service command {' '.join(command_args)} (Exit Code {e.returncode}).", file=sys.stderr)
97
- if e.stdout:
98
- print("Subprocess STDOUT:")
99
- print(e.stdout)
100
- if e.stderr:
101
- print("Subprocess STDERR:")
102
- print(e.stderr)
103
- return False
104
- except Exception as e:
105
- print(f"An unexpected error occurred running service command: {e}", file=sys.stderr)
106
- return False
107
-
108
- # --- Add cleanup helpers ---
109
- def _run_powershell_cleanup_command(command):
110
- """Executes a PowerShell command specifically for cleanup, ignoring most errors."""
111
- if platform.system() != "Windows": return True # Skip on non-windows
112
- print(f"Executing PowerShell Cleanup: {command}")
113
- try:
114
- # Use check=False, don't capture output unless needed for debug
115
- subprocess.run(
116
- ["powershell.exe", "-NoProfile", "-NonInteractive", "-Command", command],
117
- check=False, # Don't throw error if command fails (e.g., no tasks found)
118
- stdout=subprocess.DEVNULL, # Suppress stdout
119
- stderr=subprocess.DEVNULL # Suppress stderr
120
- )
121
- return True # Assume success for cleanup flow
122
- except Exception as e:
123
- print(f"Warning: PowerShell cleanup command failed: {e}", file=sys.stderr)
124
- return False # Indicate potential issue
125
-
126
- def _cleanup_scheduled_tasks():
127
- """Removes all OOTB user logon scheduled tasks."""
128
- print("Attempting to remove any existing OOTB user logon scheduled tasks...")
129
- # Use -like operator and wildcard
130
- # Use try-catch within PowerShell for robustness
131
- command = f"""
132
- $tasks = Get-ScheduledTask | Where-Object {{ $_.TaskName -like '{_TASK_NAME_PREFIX}*' }}
133
- if ($tasks) {{
134
- Write-Host "Found $($tasks.Count) OOTB logon tasks to remove."
135
- $tasks | Unregister-ScheduledTask -Confirm:$false -ErrorAction SilentlyContinue
136
- Write-Host "OOTB logon task removal attempted."
137
- }} else {{
138
- Write-Host "No OOTB logon tasks found to remove."
139
- }}
140
- """
141
- _run_powershell_cleanup_command(command)
142
- # --- End cleanup helpers ---
143
-
144
- def install_and_start():
145
- """Installs and starts the Guard Service."""
146
- print(f"Attempting to install service: '{_SERVICE_NAME}' ('{_SERVICE_DISPLAY_NAME}')")
147
- # Call 'install' command first.
148
- # We pass check_errors=True to stop if installation fails fundamentally.
149
- install_success = run_service_command(['--startup', 'auto', 'install'], check_errors=True)
150
-
151
- if install_success:
152
- # Note: Even if install_success is True, pywin32 might have printed internal errors
153
- # like 'service already installed'. We proceed to start anyway in that case.
154
- print(f"\nInstallation command finished. Attempting to start service: '{_SERVICE_NAME}' (waiting a few seconds first)")
155
- time.sleep(3) # Give SCM time to register the install/update
156
- start_success = run_service_command(['start'], check_errors=True)
157
-
158
- if start_success:
159
- # Similar caveat: start might succeed according to subprocess, but pywin32 could print internal errors.
160
- print(f"\nService '{_SERVICE_NAME}' install command executed and start command executed.")
161
- print(f"Please verify service status in 'services.msc' and check logs.")
162
- else:
163
- # This path is taken if run_service_command returned False (subprocess error occurred)
164
- print(f"\nService '{_SERVICE_NAME}' installed/updated but the 'start' command failed with an error.", file=sys.stderr)
165
- print(f" Check output above, service logs ('C:\ProgramData\OOTBGuardService\guard_post_mode.log'), or Windows Event Viewer.", file=sys.stderr)
166
- else:
167
- # This path is taken if the initial 'install' command failed critically (subprocess error)
168
- print(f"\nService '{_SERVICE_NAME}' installation failed critically. See errors above.", file=sys.stderr)
169
-
170
-
171
- def stop_and_remove():
172
- """Stops and removes the Guard Service and associated scheduled tasks."""
173
- print(f"Attempting to stop service: '{_SERVICE_NAME}' (will ignore errors if not running)")
174
- # Run stop first, ignore errors (check_errors=False)
175
- run_service_command(['stop'], check_errors=False)
176
- time.sleep(2) # Give service time to stop
177
-
178
- print(f"\nAttempting to remove service: '{_SERVICE_NAME}'")
179
- remove_success = run_service_command(['remove']) # Check if removal command itself failed
180
-
181
- # Always attempt task cleanup, even if service removal had issues
182
- _cleanup_scheduled_tasks()
183
-
184
- if remove_success:
185
- print(f"\nService '{_SERVICE_NAME}' stopped (if running) and removed successfully. Associated logon tasks cleanup attempted.")
186
- else:
187
- print(f"\nService '{_SERVICE_NAME}' removal command failed.", file=sys.stderr)
188
- # Make sure to mention cleanup was still attempted
189
- print(f" Associated logon tasks cleanup attempted.", file=sys.stderr)
190
- print(f" Ensure the service was stopped first, or check permissions.", file=sys.stderr)
191
-
192
- if __name__ == '__main__':
193
- # Allow calling functions directly for testing if needed
194
- print("This script provides service management commands.")
1
+ # src/computer_use_ootb_internal/service_manager.py
2
+ import sys
3
+ import os
4
+ import inspect
5
+ import subprocess
6
+ import ctypes
7
+ import platform
8
+ import time
9
+
10
+ # Constants need to match guard_service.py
11
+ _SERVICE_NAME = "OOTBGuardService"
12
+ _SERVICE_DISPLAY_NAME = "OOTB Guard Service"
13
+ _TASK_NAME_PREFIX = "OOTB_UserLogon_" # Must match guard_service.py
14
+
15
+ def is_admin():
16
+ """Check if the script is running with administrative privileges."""
17
+ if platform.system() != "Windows":
18
+ return False # Only applicable on Windows
19
+ try:
20
+ return ctypes.windll.shell32.IsUserAnAdmin()
21
+ except:
22
+ return False
23
+
24
+ def get_service_module_path():
25
+ """Gets the absolute path to the guard_service.py module."""
26
+ # Find the path relative to this script's location
27
+ # This assumes service_manager.py and guard_service.py are in the same installed package directory
28
+ try:
29
+ current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
30
+ service_module = os.path.join(current_dir, "guard_service.py")
31
+ if not os.path.exists(service_module):
32
+ raise FileNotFoundError(f"guard_service.py not found adjacent to service_manager.py in {current_dir}")
33
+ return service_module
34
+ except Exception as e:
35
+ # Fallback if inspect fails (e.g., in some frozen environments)
36
+ # Try finding it relative to the script itself? Unreliable.
37
+ # Let's try sys.prefix - might work in standard venv/conda installs
38
+ try:
39
+ # sys.prefix points to the environment root (e.g., C:\path\to\env)
40
+ # Package likely installed in Lib\site-packages\<package_name>
41
+ # This depends heavily on installation layout
42
+ package_name = __name__.split('.')[0] # Should be 'computer_use_ootb_internal'
43
+ site_packages_path = os.path.join(sys.prefix, 'Lib', 'site-packages')
44
+ module_dir = os.path.join(site_packages_path, package_name)
45
+ service_module = os.path.join(module_dir, "guard_service.py")
46
+ if os.path.exists(service_module):
47
+ print(f"Warning: Found service module via sys.prefix fallback: {service_module}")
48
+ return service_module
49
+ else:
50
+ raise FileNotFoundError(f"guard_service.py not found via inspect or sys.prefix fallback (checked {module_dir})")
51
+ except Exception as fallback_e:
52
+ raise FileNotFoundError(f"Could not find guard_service.py using inspect ({e}) or sys.prefix ({fallback_e}). Check installation.")
53
+
54
+
55
+ def run_service_command(command_args, check_errors=True):
56
+ """Runs the guard_service.py script with specified command-line args."""
57
+ if not is_admin():
58
+ print("Error: Administrative privileges are required to manage the service.", file=sys.stderr)
59
+ print("Please run this command from an Administrator Command Prompt or PowerShell.", file=sys.stderr)
60
+ return False
61
+
62
+ try:
63
+ python_exe = sys.executable # Use the same python that's running this script
64
+ service_script = get_service_module_path()
65
+ except FileNotFoundError as e:
66
+ print(f"Error: {e}", file=sys.stderr)
67
+ return False
68
+
69
+ # Quote paths if they contain spaces
70
+ if " " in python_exe and not python_exe.startswith('"'):
71
+ python_exe = f'"{python_exe}"'
72
+ if " " in service_script and not service_script.startswith('"'):
73
+ service_script = f'"{service_script}"'
74
+
75
+ # Construct command using list to avoid shell quoting issues
76
+ cmd = [sys.executable, get_service_module_path()] + command_args
77
+ print(f"Executing command: {' '.join(cmd)}")
78
+
79
+ try:
80
+ # Run the command. Use shell=False with list of args.
81
+ # Capture output to check for specific errors if needed, but print it too.
82
+ result = subprocess.run(cmd, capture_output=True, text=True, check=check_errors, encoding='utf-8')
83
+ if result.stdout:
84
+ print("Command STDOUT:")
85
+ print(result.stdout)
86
+ if result.stderr:
87
+ print("Command STDERR:")
88
+ print(result.stderr)
89
+ print(f"Command {' '.join(command_args)} executed successfully.")
90
+ return True
91
+ except FileNotFoundError as e:
92
+ print(f"Error: Could not find Python executable or service script during execution.", file=sys.stderr)
93
+ print(f" Details: {e}", file=sys.stderr)
94
+ return False
95
+ except subprocess.CalledProcessError as e:
96
+ print(f"Error executing service command {' '.join(command_args)} (Exit Code {e.returncode}).", file=sys.stderr)
97
+ if e.stdout:
98
+ print("Subprocess STDOUT:")
99
+ print(e.stdout)
100
+ if e.stderr:
101
+ print("Subprocess STDERR:")
102
+ print(e.stderr)
103
+ return False
104
+ except Exception as e:
105
+ print(f"An unexpected error occurred running service command: {e}", file=sys.stderr)
106
+ return False
107
+
108
+ # --- Add cleanup helpers ---
109
+ def _run_powershell_cleanup_command(command):
110
+ """Executes a PowerShell command specifically for cleanup, ignoring most errors."""
111
+ if platform.system() != "Windows": return True # Skip on non-windows
112
+ print(f"Executing PowerShell Cleanup: {command}")
113
+ try:
114
+ # Use check=False, don't capture output unless needed for debug
115
+ subprocess.run(
116
+ ["powershell.exe", "-NoProfile", "-NonInteractive", "-Command", command],
117
+ check=False, # Don't throw error if command fails (e.g., no tasks found)
118
+ stdout=subprocess.DEVNULL, # Suppress stdout
119
+ stderr=subprocess.DEVNULL # Suppress stderr
120
+ )
121
+ return True # Assume success for cleanup flow
122
+ except Exception as e:
123
+ print(f"Warning: PowerShell cleanup command failed: {e}", file=sys.stderr)
124
+ return False # Indicate potential issue
125
+
126
+ def _cleanup_scheduled_tasks():
127
+ """Removes all OOTB user logon scheduled tasks."""
128
+ print("Attempting to remove any existing OOTB user logon scheduled tasks...")
129
+ # Use -like operator and wildcard
130
+ # Use try-catch within PowerShell for robustness
131
+ command = f"""
132
+ $tasks = Get-ScheduledTask | Where-Object {{ $_.TaskName -like '{_TASK_NAME_PREFIX}*' }}
133
+ if ($tasks) {{
134
+ Write-Host "Found $($tasks.Count) OOTB logon tasks to remove."
135
+ $tasks | Unregister-ScheduledTask -Confirm:$false -ErrorAction SilentlyContinue
136
+ Write-Host "OOTB logon task removal attempted."
137
+ }} else {{
138
+ Write-Host "No OOTB logon tasks found to remove."
139
+ }}
140
+ """
141
+ _run_powershell_cleanup_command(command)
142
+ # --- End cleanup helpers ---
143
+
144
+ def install_and_start():
145
+ """Installs and starts the Guard Service."""
146
+ print(f"Attempting to install service: '{_SERVICE_NAME}' ('{_SERVICE_DISPLAY_NAME}')")
147
+ # Call 'install' command first.
148
+ # We pass check_errors=True to stop if installation fails fundamentally.
149
+ install_success = run_service_command(['--startup', 'auto', 'install'], check_errors=True)
150
+
151
+ if install_success:
152
+ # Note: Even if install_success is True, pywin32 might have printed internal errors
153
+ # like 'service already installed'. We proceed to start anyway in that case.
154
+ print(f"\nInstallation command finished. Attempting to start service: '{_SERVICE_NAME}' (waiting a few seconds first)")
155
+ time.sleep(3) # Give SCM time to register the install/update
156
+ start_success = run_service_command(['start'], check_errors=True)
157
+
158
+ if start_success:
159
+ # Similar caveat: start might succeed according to subprocess, but pywin32 could print internal errors.
160
+ print(f"\nService '{_SERVICE_NAME}' install command executed and start command executed.")
161
+ print(f"Please verify service status in 'services.msc' and check logs.")
162
+ else:
163
+ # This path is taken if run_service_command returned False (subprocess error occurred)
164
+ print(f"\nService '{_SERVICE_NAME}' installed/updated but the 'start' command failed with an error.", file=sys.stderr)
165
+ print(f" Check output above, service logs ('C:\ProgramData\OOTBGuardService\guard_post_mode.log'), or Windows Event Viewer.", file=sys.stderr)
166
+ else:
167
+ # This path is taken if the initial 'install' command failed critically (subprocess error)
168
+ print(f"\nService '{_SERVICE_NAME}' installation failed critically. See errors above.", file=sys.stderr)
169
+
170
+
171
+ def stop_and_remove():
172
+ """Stops and removes the Guard Service and associated scheduled tasks."""
173
+ print(f"Attempting to stop service: '{_SERVICE_NAME}' (will ignore errors if not running)")
174
+ # Run stop first, ignore errors (check_errors=False)
175
+ run_service_command(['stop'], check_errors=False)
176
+ time.sleep(2) # Give service time to stop
177
+
178
+ print(f"\nAttempting to remove service: '{_SERVICE_NAME}'")
179
+ remove_success = run_service_command(['remove']) # Check if removal command itself failed
180
+
181
+ # Always attempt task cleanup, even if service removal had issues
182
+ _cleanup_scheduled_tasks()
183
+
184
+ if remove_success:
185
+ print(f"\nService '{_SERVICE_NAME}' stopped (if running) and removed successfully. Associated logon tasks cleanup attempted.")
186
+ else:
187
+ print(f"\nService '{_SERVICE_NAME}' removal command failed.", file=sys.stderr)
188
+ # Make sure to mention cleanup was still attempted
189
+ print(f" Associated logon tasks cleanup attempted.", file=sys.stderr)
190
+ print(f" Ensure the service was stopped first, or check permissions.", file=sys.stderr)
191
+
192
+ if __name__ == '__main__':
193
+ # Allow calling functions directly for testing if needed
194
+ print("This script provides service management commands.")
195
195
  print("Use 'ootb-install-service' or 'ootb-remove-service' as Administrator.")
@@ -1,29 +1,30 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: computer-use-ootb-internal
3
- Version: 0.0.124
3
+ Version: 0.0.126
4
4
  Summary: Computer Use OOTB
5
5
  Author-email: Siyuan Hu <siyuan.hu.sg@gmail.com>
6
6
  Requires-Python: >=3.11
7
7
  Requires-Dist: anthropic[bedrock,vertex]>=0.37.1
8
8
  Requires-Dist: boto3>=1.28.57
9
+ Requires-Dist: flask>=2.0
9
10
  Requires-Dist: google-auth<3,>=2
10
11
  Requires-Dist: gradio>=5.6.0
11
12
  Requires-Dist: jsonschema==4.22.0
12
13
  Requires-Dist: litellm
13
14
  Requires-Dist: matplotlib
14
15
  Requires-Dist: opencv-python
15
- Requires-Dist: pre-commit==3.8.0
16
+ Requires-Dist: psutil>=5.0; sys_platform == 'win32'
16
17
  Requires-Dist: pyautogui==0.9.54
17
- Requires-Dist: pyside6
18
- Requires-Dist: pytest-asyncio==0.23.6
19
- Requires-Dist: pytest==8.3.3
20
- Requires-Dist: pywinauto
21
- Requires-Dist: ruff==0.6.7
18
+ Requires-Dist: pywin32>=306; sys_platform == 'win32'
19
+ Requires-Dist: pywinauto; sys_platform == 'win32'
20
+ Requires-Dist: requests>=2.0
22
21
  Requires-Dist: screeninfo
23
22
  Requires-Dist: streamlit>=1.38.0
24
23
  Requires-Dist: textdistance
25
- Requires-Dist: uiautomation
24
+ Requires-Dist: uiautomation; sys_platform == 'win32'
25
+ Requires-Dist: waitress>=2.0
26
26
  Provides-Extra: dev
27
+ Requires-Dist: pre-commit>=3.8.0; extra == 'dev'
27
28
  Requires-Dist: pytest-asyncio>=0.23.6; extra == 'dev'
28
29
  Requires-Dist: pytest>=8.3.3; extra == 'dev'
29
30
  Requires-Dist: ruff>=0.6.7; extra == 'dev'
@@ -1,14 +1,14 @@
1
1
  computer_use_ootb_internal/README.md,sha256=FxpW95lyub2iX73ZDfK6ML7SdEKg060H5I6Grub7li4,31
2
2
  computer_use_ootb_internal/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
3
- computer_use_ootb_internal/app_teachmode.py,sha256=WEGaAOV3MLb_HMG7p7btjATij7KnpnTr-Mkm9xLt86M,22801
3
+ computer_use_ootb_internal/app_teachmode.py,sha256=ZZW98870QPNK76LN4f4k9RjBELYcF_3hl0w0fvxj3dY,22268
4
4
  computer_use_ootb_internal/dependency_check.py,sha256=y8RMEP6RXQzTgU1MS_1piBLtz4J-Hfn9RjUZg59dyvo,1333
5
- computer_use_ootb_internal/guard_service.py,sha256=lpYts48r91F1Kb1syZzlAshe2ZUuijsrKfBFJ9kmQI8,43599
5
+ computer_use_ootb_internal/guard_service.py,sha256=rxTdjzhcZf-Osohnf9xnKFTiKUr-DJAgFHPEGfmFDVI,42789
6
6
  computer_use_ootb_internal/requirements-lite.txt,sha256=5DAHomz4A_P2BmTIXNkNqkHbnIF0AyZ4_1XAlb1LaYs,290
7
7
  computer_use_ootb_internal/run_teachmode_ootb_args.py,sha256=HB7L9vuIPUXVqeTicyNJKArzTNAfgdpsyO3JEzmByIo,7315
8
- computer_use_ootb_internal/service_manager.py,sha256=_aFUtvSbovX73PY1QE01RkaqGV6swJaStrOwcg_Df94,9928
8
+ computer_use_ootb_internal/service_manager.py,sha256=SD8jzfn0VVXBOr_nP6zmBWSC2TzrU_sp2e5JJkSlQFU,9734
9
9
  computer_use_ootb_internal/computer_use_demo/animation/click_animation.py,sha256=tP1gsayFy-CKk10UlrE9RlexwlHWiHQUe5Ogg4vQvSg,3234
10
10
  computer_use_ootb_internal/computer_use_demo/animation/icons8-select-cursor-transparent-96.gif,sha256=4LfwsfFQnREXrNRs32aJU2jO65JXianJoL_8q7-8elg,30966
11
- computer_use_ootb_internal/computer_use_demo/animation/test_animation.py,sha256=SOJz2yffXTkjuAHqk0IZLcMriR0KQYTo7W1b8wGyRGY,1222
11
+ computer_use_ootb_internal/computer_use_demo/animation/test_animation.py,sha256=2R1u98OLKYalSZ5nt5vvyZ71FL5R5vLv-n8zM8jVdV8,1183
12
12
  computer_use_ootb_internal/computer_use_demo/executor/teachmode_executor.py,sha256=5fbEin5SDpchuCe6lEtRPK9JbO4YRqqIsD6LijJTrD8,16692
13
13
  computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/__init__.py,sha256=h2CNeuACklxVpJC65QR8_6AvSybEZLmeO45hY_-lLBs,61
14
14
  computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/gui_capture.py,sha256=CxFJbsSb68ERKH7-C4RaaZy7FIhhzrzGx5qQJ4C37cA,13907
@@ -32,8 +32,8 @@ computer_use_ootb_internal/computer_use_demo/tools/edit.py,sha256=b0PwUitxckHCQq
32
32
  computer_use_ootb_internal/computer_use_demo/tools/run.py,sha256=xhXdnBK1di9muaO44CEirL9hpGy3NmKbjfMpyeVmn8Y,1595
33
33
  computer_use_ootb_internal/computer_use_demo/tools/screen_capture.py,sha256=L8qfvtUkPPQGt92N-2Zfw5ZTDBzLsDps39uMnX3_uSA,6857
34
34
  computer_use_ootb_internal/preparation/__init__.py,sha256=AgtGHcBpiTkxJjF0xwcs3yyQ6SyUvhL3G0vD2XO-zJw,63
35
- computer_use_ootb_internal/preparation/star_rail_prepare.py,sha256=G0A5JQpQUyt9ir5-t0l3p-Y7ZwRDo8TH-Oa5yTDqPWA,2713
36
- computer_use_ootb_internal-0.0.124.dist-info/METADATA,sha256=6928-baZp3w7Nox-Bqz7MCw9bWpCc7mXm-Chljz2k-M,910
37
- computer_use_ootb_internal-0.0.124.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
38
- computer_use_ootb_internal-0.0.124.dist-info/entry_points.txt,sha256=-AbmawU7IRQuDZihgVMVDrFoY4E6rnXYOUB-5vSeBKs,93
39
- computer_use_ootb_internal-0.0.124.dist-info/RECORD,,
35
+ computer_use_ootb_internal/preparation/star_rail_prepare.py,sha256=2Q1TcXE09F1-W7boTHfuQkGhaFD1YDuiQV8qvG83wOY,3000
36
+ computer_use_ootb_internal-0.0.126.dist-info/METADATA,sha256=COh06SOLvlusAtDfKXDv5Rr_hxHwNgrSSQEI-qlcZW8,1048
37
+ computer_use_ootb_internal-0.0.126.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
38
+ computer_use_ootb_internal-0.0.126.dist-info/entry_points.txt,sha256=bXfyAU_qq-G1EiEgAQEioXvgEdRCFxaTooqdDD9Y4OA,258
39
+ computer_use_ootb_internal-0.0.126.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ computer-use-ootb-internal = computer_use_ootb_internal.app_teachmode:main
3
+ ootb-install-service = computer_use_ootb_internal.service_manager:install_and_start
4
+ ootb-remove-service = computer_use_ootb_internal.service_manager:stop_and_remove
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- computer-use-ootb-internal = computer_use_ootb_internal.app_teachmode:main