computer-use-ootb-internal 0.0.126__tar.gz → 0.0.127__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.
Files changed (40) hide show
  1. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/PKG-INFO +1 -1
  2. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/pyproject.toml +1 -1
  3. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/guard_service.py +22 -22
  4. computer_use_ootb_internal-0.0.127/src/computer_use_ootb_internal/preparation/star_rail_prepare.py +65 -0
  5. computer_use_ootb_internal-0.0.126/deploy.sh +0 -10
  6. computer_use_ootb_internal-0.0.126/src/computer_use_ootb_internal/preparation/star_rail_prepare.py +0 -63
  7. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/.gitignore +0 -0
  8. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/README.md +0 -0
  9. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/__init__.py +0 -0
  10. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/app_teachmode.py +0 -0
  11. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/animation/click_animation.py +0 -0
  12. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/animation/icons8-select-cursor-transparent-96.gif +0 -0
  13. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/animation/test_animation.py +0 -0
  14. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/executor/teachmode_executor.py +0 -0
  15. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/__init__.py +0 -0
  16. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/gui_capture.py +0 -0
  17. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/utils.py +0 -0
  18. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/__init__.py +0 -0
  19. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/screenshot_cli.py +0 -0
  20. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/screenshot_service.py +0 -0
  21. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/llm_utils.py +0 -0
  22. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/oai.py +0 -0
  23. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_litellm.py +0 -0
  24. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_llm.py +0 -0
  25. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/tools/__init__.py +0 -0
  26. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/tools/aws_request.py +0 -0
  27. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/tools/base.py +0 -0
  28. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/tools/bash.py +0 -0
  29. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/tools/collection.py +0 -0
  30. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/tools/colorful_text.py +0 -0
  31. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/tools/computer.py +0 -0
  32. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/tools/computer_marbot.py +0 -0
  33. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/tools/edit.py +0 -0
  34. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/tools/run.py +0 -0
  35. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/computer_use_demo/tools/screen_capture.py +0 -0
  36. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/dependency_check.py +0 -0
  37. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/preparation/__init__.py +0 -0
  38. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/requirements-lite.txt +0 -0
  39. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/run_teachmode_ootb_args.py +0 -0
  40. {computer_use_ootb_internal-0.0.126 → computer_use_ootb_internal-0.0.127}/src/computer_use_ootb_internal/service_manager.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: computer-use-ootb-internal
3
- Version: 0.0.126
3
+ Version: 0.0.127
4
4
  Summary: Computer Use OOTB
5
5
  Author-email: Siyuan Hu <siyuan.hu.sg@gmail.com>
6
6
  Requires-Python: >=3.11
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "computer-use-ootb-internal"
7
- version = "0.0.126"
7
+ version = "0.0.127"
8
8
  description = "Computer Use OOTB"
9
9
  authors = [{ name = "Siyuan Hu", email = "siyuan.hu.sg@gmail.com" }]
10
10
  requires-python = ">=3.11"
@@ -135,37 +135,37 @@ class GuardService(win32serviceutil.ServiceFramework):
135
135
 
136
136
  # --- Instance Helper Methods (Moved from module level) ---
137
137
  def get_base_python_executable(self):
138
- """Tries to find python.exe instead of pythonservice.exe if running as service."""
138
+ """Tries to find pythonw.exe or python.exe instead of pythonservice.exe if running as service."""
139
139
  service_exe = sys.executable
140
140
  self.log_info(f"get_base_python_executable: sys.executable is {service_exe}")
141
- # Normalize path for comparison
142
141
  service_exe_lower = service_exe.lower()
143
-
144
- # Check if running as pythonservice.exe
142
+ final_exe_to_use = service_exe # Default to sys.executable
143
+
145
144
  if 'pythonservice.exe' in os.path.basename(service_exe_lower):
146
- # Construct expected python.exe path in the same directory
147
145
  dir_name = os.path.dirname(service_exe)
146
+ potential_pythonw_exe = os.path.join(dir_name, 'pythonw.exe')
148
147
  potential_python_exe = os.path.join(dir_name, 'python.exe')
149
- self.log_info(f"get_base_python_executable: Checking for python.exe at {potential_python_exe}")
150
148
 
151
- if os.path.exists(potential_python_exe):
152
- self.log_info(f"get_base_python_executable: Found python.exe at {potential_python_exe}")
153
- # Quote if necessary
154
- final_exe = potential_python_exe
155
- if " " in final_exe and not final_exe.startswith('"'):
156
- return f'"{final_exe}"'
157
- return final_exe
149
+ self.log_info(f"get_base_python_executable: Checking for pythonw.exe at {potential_pythonw_exe}")
150
+ if os.path.exists(potential_pythonw_exe):
151
+ self.log_info(f"get_base_python_executable: Found pythonw.exe, preferring it.")
152
+ final_exe_to_use = potential_pythonw_exe
158
153
  else:
159
- self.log_error(f"get_base_python_executable: Could not find python.exe near pythonservice.exe (checked {potential_python_exe}). Falling back to using {service_exe}.")
160
- # Fallback to original sys.executable (quoted if needed)
161
- if " " in service_exe and not service_exe.startswith('"'):
162
- return f'"{service_exe}"'
163
- return service_exe
164
- else: # Not running as pythonservice.exe, assume sys.executable is correct
154
+ self.log_info(f"get_base_python_executable: pythonw.exe not found. Checking for python.exe at {potential_python_exe}")
155
+ if os.path.exists(potential_python_exe):
156
+ self.log_info(f"get_base_python_executable: Found python.exe.")
157
+ final_exe_to_use = potential_python_exe
158
+ else:
159
+ self.log_error(f"get_base_python_executable: Could not find pythonw.exe or python.exe near pythonservice.exe. Falling back to using {service_exe}.")
160
+ # Keep final_exe_to_use as service_exe (default)
161
+ else:
165
162
  self.log_info(f"get_base_python_executable: sys.executable is not pythonservice.exe, using it directly.")
166
- if " " in service_exe and not service_exe.startswith('"'):
167
- return f'"{service_exe}"'
168
- return service_exe
163
+ # Keep final_exe_to_use as service_exe (default)
164
+
165
+ # Quote the final selected path if necessary
166
+ if " " in final_exe_to_use and not final_exe_to_use.startswith('"'):
167
+ return f'"{final_exe_to_use}"'
168
+ return final_exe_to_use
169
169
 
170
170
  def get_python_executable(self):
171
171
  # This method is now just an alias for clarity if needed elsewhere,
@@ -0,0 +1,65 @@
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,10 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Clean previous builds
4
- rm -rf dist
5
-
6
- # Build the package
7
- python -m build
8
-
9
- # Upload to PyPI using API key
10
- python -m twine upload dist/* -u __token__ -p pypi-AgEIcHlwaS5vcmcCJDkwMTlkNmE2LWFkZmYtNGU2ZC1hYzUwLWFiYmRjYTg4YTNkYgACIlsxLFsiY29tcHV0ZXItdXNlLW9vdGItaW50ZXJuYWwiXV0AAixbMixbIjllNmQ5NTRjLTgxZGEtNGRkNy05Yjk5LWVjYzMzOGUwN2NlZSJdXQAABiBFIKbytGELyFb1-i20Cu4tSo8cAUlX1DCLmUALq0mcPA
@@ -1,63 +0,0 @@
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