computer-use-ootb-internal 0.0.182__tar.gz → 0.0.184__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 (44) hide show
  1. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/PKG-INFO +1 -1
  2. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/pyproject.toml +1 -1
  3. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/guard_service.py +26 -18
  4. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/preparation/excel_prepare.py +16 -13
  5. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/preparation/powerpoint_prepare.py +11 -7
  6. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/preparation/pr_prepare.py +17 -14
  7. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/preparation/word_prepare.py +16 -13
  8. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/.gitignore +0 -0
  9. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/README.md +0 -0
  10. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/__init__.py +0 -0
  11. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/app_teachmode.py +0 -0
  12. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/animation/click_animation.py +0 -0
  13. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/animation/icons8-select-cursor-transparent-96.gif +0 -0
  14. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/animation/test_animation.py +0 -0
  15. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/executor/teachmode_executor.py +0 -0
  16. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/__init__.py +0 -0
  17. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/gui_capture.py +0 -0
  18. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/utils.py +0 -0
  19. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/__init__.py +0 -0
  20. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/screenshot_cli.py +0 -0
  21. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/screenshot_service.py +0 -0
  22. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/llm_utils.py +0 -0
  23. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/oai.py +0 -0
  24. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_litellm.py +0 -0
  25. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_llm.py +0 -0
  26. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/tools/__init__.py +0 -0
  27. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/tools/aws_request.py +0 -0
  28. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/tools/base.py +0 -0
  29. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/tools/bash.py +0 -0
  30. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/tools/collection.py +0 -0
  31. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/tools/colorful_text.py +0 -0
  32. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/tools/computer.py +0 -0
  33. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/tools/computer_marbot.py +0 -0
  34. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/tools/edit.py +0 -0
  35. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/tools/run.py +0 -0
  36. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/computer_use_demo/tools/screen_capture.py +0 -0
  37. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/dependency_check.py +0 -0
  38. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/preparation/__init__.py +0 -0
  39. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/preparation/star_rail_prepare.py +0 -0
  40. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/requirements-lite.txt +0 -0
  41. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/run_teachmode_ootb_args.py +0 -0
  42. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/service_manager.py +0 -0
  43. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/signal_connection.py +0 -0
  44. {computer_use_ootb_internal-0.0.182 → computer_use_ootb_internal-0.0.184}/src/computer_use_ootb_internal/test_autogui.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: computer-use-ootb-internal
3
- Version: 0.0.182
3
+ Version: 0.0.184
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.182"
7
+ version = "0.0.184"
8
8
  description = "Computer Use OOTB"
9
9
  authors = [{ name = "Siyuan Hu", email = "siyuan.hu.sg@gmail.com" }]
10
10
  requires-python = ">=3.11"
@@ -822,39 +822,47 @@ class GuardService(win32serviceutil.ServiceFramework):
822
822
  self.log_error(f"Cannot create task for {username}: sys.executable is not found.")
823
823
  return False
824
824
 
825
- # Use the python executable that the service itself is running under
826
- python_exe = sys.executable
827
- if ' ' in python_exe and not python_exe.startswith('"'):
828
- python_exe = f'"{python_exe}"'
825
+ # Find the correct python.exe/pythonw.exe from the environment
826
+ python_exe = self._get_python_executable_from_target_exe()
827
+ if not python_exe:
828
+ self.log_error(f"Cannot create task for {username}: Failed to find associated python executable via _get_python_executable_from_target_exe.")
829
+ return False
829
830
 
830
- task_name = f"OOTB_UserConnect_{username}"
831
- # Action: Run python.exe with the signal script and username argument
832
- action_executable = python_exe
831
+ # Prepare paths and arguments carefully for PowerShell
832
+ action_executable_path = python_exe.strip("'\"") # Remove potential existing quotes
833
+ script_path = self.signal_script_path.strip("'\"")
834
+ user_arg = username # Assuming username has no special chars needing escape within PS
835
+
833
836
  # Ensure script path is quoted if needed
834
- script_arg = self.signal_script_path # Should be quoted already by _find_signal_script
837
+ quoted_script_path = f'""{script_path}""' if ' ' in script_path else script_path # Use "" for literal quotes inside PS string
835
838
  # Username might need quoting if it contains spaces, though unlikely
836
- user_arg = username # Keep simple for now
837
- action_arguments = f'{script_arg} "{user_arg}"' # Pass username as quoted arg
838
- safe_action_executable = action_executable.replace("'", "''") # Escape for PS
839
- safe_action_arguments = action_arguments.replace("'", "''") # Escape for PS
839
+ # Construct the argument string passed TO python.exe: "script_path" username
840
+ python_arguments = f'{quoted_script_path} {user_arg}'
840
841
 
841
842
  # Working directory for the script (likely its own directory)
842
843
  try:
843
- script_dir = os.path.dirname(self.signal_script_path.strip('"'))
844
+ script_dir = os.path.dirname(script_path)
844
845
  if not script_dir: script_dir = "."
845
- safe_working_directory = script_dir.replace("'", "''")
846
- working_directory_setting = f"$action.WorkingDirectory = '{safe_working_directory}'"
846
+ # Escape single quotes for PowerShell string literal
847
+ ps_escaped_working_directory = script_dir.replace("'", "''")
848
+ working_directory_setting = f"$action.WorkingDirectory = '{ps_escaped_working_directory}'"
847
849
  except Exception as e:
848
850
  self.log_error(f"Error determining working directory for signal script task: {e}. WD will not be set.")
849
851
  working_directory_setting = "# Could not set WorkingDirectory"
850
852
 
853
+ # Escape paths and args for embedding in PowerShell command string
854
+ ps_escaped_executable = action_executable_path.replace("'", "''")
855
+ ps_escaped_arguments = python_arguments.replace("'", "''")
856
+ ps_escaped_username = username.replace("'", "''")
857
+ task_name = f"OOTB_UserConnect_{username}"
858
+
851
859
  # PowerShell command construction
852
860
  ps_command = f"""
853
- $taskName = "{task_name}"
854
- $principal = New-ScheduledTaskPrincipal -UserId "{username}" -LogonType Interactive
861
+ $taskName = \"{task_name}\"
862
+ $principal = New-ScheduledTaskPrincipal -UserId '{ps_escaped_username}' -LogonType Interactive
855
863
 
856
864
  # Action: Run python signal script
857
- $action = New-ScheduledTaskAction -Execute '{safe_action_executable}' -Argument '{safe_action_arguments}'
865
+ $action = New-ScheduledTaskAction -Execute '{ps_escaped_executable}' -Argument '{ps_escaped_arguments}'
858
866
  {working_directory_setting}
859
867
 
860
868
  # Trigger: At Logon for the specified user
@@ -75,21 +75,24 @@ def run_preparation(state):
75
75
  # --- End of kill process ---
76
76
 
77
77
  # Open the file with Excel maximized on Windows
78
- log.info(f"Attempting to open {template_file} with Excel maximized on Windows...")
79
78
  try:
80
- # Use start command with /max flag on Windows
81
- cmd = ['cmd', '/c', 'start', '/max', 'excel', str(template_file)] # Changed app name
82
- # Temporarily commented out file opening
83
- # result = subprocess.run(cmd, check=False, capture_output=True, text=True)
84
- log.info(f"(Skipped) Would open file with command: {' '.join(cmd)}")
85
- result = None # Set result to None or mock success if needed elsewhere
79
+ # Check if template exists and construct command accordingly
80
+ if template_file.exists():
81
+ log.info(f"Template file found. Attempting to open {template_file} with Excel maximized...")
82
+ cmd = ['cmd', '/c', 'start', '/max', 'excel', str(template_file)]
83
+ else:
84
+ log.info(f"Template file not found. Attempting to launch Excel maximized...")
85
+ cmd = ['cmd', '/c', 'start', '/max', 'excel']
86
+
87
+ log.info(f"Executing command: {' '.join(cmd)}")
88
+ result = subprocess.run(cmd, check=False, capture_output=True, text=True, creationflags=subprocess.CREATE_NO_WINDOW) # Add CREATE_NO_WINDOW
86
89
 
87
- # if result and result.returncode == 0:
88
- # log.info(f"Successfully launched Excel maximized with {template_file}")
89
- # else:
90
- # log.error(f"Error opening Excel: {result.stderr.strip() if result else 'Command not run'}")
91
- # if result and result.stdout:
92
- # log.error(f"Stdout from start command: {result.stdout.strip()}")
90
+ if result.returncode == 0:
91
+ log.info(f"Successfully executed command for Excel.")
92
+ else:
93
+ log.error(f"Error opening Excel: {result.stderr.strip()}")
94
+ if result.stdout:
95
+ log.error(f"Stdout from start command: {result.stdout.strip()}")
93
96
  except FileNotFoundError:
94
97
  log.error("Error: 'cmd' or 'start' command not found. Ensure system PATH is configured correctly.")
95
98
  except Exception as e:
@@ -77,18 +77,22 @@ def run_preparation(state):
77
77
  # --- End of kill process ---
78
78
 
79
79
  # Open the file with PowerPoint maximized on Windows
80
- log.info(f"Attempting to open {template_file} with PowerPoint maximized on Windows...")
81
80
  try:
82
- # Use start command with /max flag on Windows
83
- cmd = ['cmd', '/c', 'start', '/max', 'powerpnt', str(template_file)]
84
- result = subprocess.run(cmd, check=False, capture_output=True, text=True)
81
+ # Check if template exists and construct command accordingly
82
+ if template_file.exists():
83
+ log.info(f"Template file found. Attempting to open {template_file} with PowerPoint maximized...")
84
+ cmd = ['cmd', '/c', 'start', '/max', 'powerpnt', str(template_file)]
85
+ else:
86
+ log.info(f"Template file not found. Attempting to launch PowerPoint maximized...")
87
+ cmd = ['cmd', '/c', 'start', '/max', 'powerpnt']
88
+
89
+ log.info(f"Executing command: {' '.join(cmd)}")
90
+ result = subprocess.run(cmd, check=False, capture_output=True, text=True, creationflags=subprocess.CREATE_NO_WINDOW) # Add CREATE_NO_WINDOW
85
91
 
86
92
  if result.returncode == 0:
87
- log.info(f"Successfully launched PowerPoint maximized with {template_file}")
93
+ log.info(f"Successfully executed command for PowerPoint.")
88
94
  else:
89
- # Log stderr for debugging potential start command issues
90
95
  log.error(f"Error opening PowerPoint: {result.stderr.strip()}")
91
- # Also log stdout as start command might output info there
92
96
  if result.stdout:
93
97
  log.error(f"Stdout from start command: {result.stdout.strip()}")
94
98
  except FileNotFoundError:
@@ -76,22 +76,25 @@ def run_preparation(state):
76
76
  # --- End of kill process ---
77
77
 
78
78
  # Open the file with Premiere Pro maximized on Windows
79
- log.info(f"Attempting to open {template_file} with Premiere Pro maximized on Windows...")
80
79
  try:
81
- # Use start command with /max flag on Windows.
82
- # Assuming the application name for start command includes the year.
83
- cmd = ['cmd', '/c', 'start', '/max', '"Adobe Premiere Pro 2024"', str(template_file)] # Updated app name, kept quotes
84
- # Temporarily commented out file opening
85
- # result = subprocess.run(cmd, check=False, capture_output=True, text=True)
86
- log.info(f"(Skipped) Would open file with command: {' '.join(cmd)}")
87
- result = None # Set result to None or mock success if needed elsewhere
80
+ # Check if template exists and construct command accordingly
81
+ if template_file.exists():
82
+ log.info(f"Template file found. Attempting to open {template_file} with Premiere Pro maximized...")
83
+ # Keep quotes around app name if it contains spaces
84
+ cmd = ['cmd', '/c', 'start', '/max', '"Adobe Premiere Pro 2024"', str(template_file)]
85
+ else:
86
+ log.info(f"Template file not found. Attempting to launch Premiere Pro maximized...")
87
+ cmd = ['cmd', '/c', 'start', '/max', '"Adobe Premiere Pro 2024"']
88
+
89
+ log.info(f"Executing command: {' '.join(cmd)}")
90
+ result = subprocess.run(cmd, check=False, capture_output=True, text=True, creationflags=subprocess.CREATE_NO_WINDOW) # Add CREATE_NO_WINDOW
88
91
 
89
- # if result and result.returncode == 0:
90
- # log.info(f"Successfully launched Premiere Pro maximized with {template_file}")
91
- # else:
92
- # log.error(f"Error opening Premiere Pro: {result.stderr.strip() if result else 'Command not run'}")
93
- # if result and result.stdout:
94
- # log.error(f"Stdout from start command: {result.stdout.strip()}")
92
+ if result.returncode == 0:
93
+ log.info(f"Successfully executed command for Premiere Pro.")
94
+ else:
95
+ log.error(f"Error opening Premiere Pro: {result.stderr.strip()}")
96
+ if result.stdout:
97
+ log.error(f"Stdout from start command: {result.stdout.strip()}")
95
98
  except FileNotFoundError:
96
99
  log.error("Error: 'cmd' or 'start' command not found. Ensure system PATH is configured correctly.")
97
100
  except Exception as e:
@@ -75,21 +75,24 @@ def run_preparation(state):
75
75
  # --- End of kill process ---
76
76
 
77
77
  # Open the file with Word maximized on Windows
78
- log.info(f"Attempting to open {template_file} with Word maximized on Windows...")
79
78
  try:
80
- # Use start command with /max flag on Windows
81
- cmd = ['cmd', '/c', 'start', '/max', 'winword', str(template_file)] # Changed app name
82
- # Temporarily commented out file opening
83
- # result = subprocess.run(cmd, check=False, capture_output=True, text=True)
84
- log.info(f"(Skipped) Would open file with command: {' '.join(cmd)}")
85
- result = None # Set result to None or mock success if needed elsewhere
79
+ # Check if template exists and construct command accordingly
80
+ if template_file.exists():
81
+ log.info(f"Template file found. Attempting to open {template_file} with Word maximized...")
82
+ cmd = ['cmd', '/c', 'start', '/max', 'winword', str(template_file)]
83
+ else:
84
+ log.info(f"Template file not found. Attempting to launch Word maximized...")
85
+ cmd = ['cmd', '/c', 'start', '/max', 'winword']
86
+
87
+ log.info(f"Executing command: {' '.join(cmd)}")
88
+ result = subprocess.run(cmd, check=False, capture_output=True, text=True, creationflags=subprocess.CREATE_NO_WINDOW) # Add CREATE_NO_WINDOW
86
89
 
87
- # if result and result.returncode == 0:
88
- # log.info(f"Successfully launched Word maximized with {template_file}")
89
- # else:
90
- # log.error(f"Error opening Word: {result.stderr.strip() if result else 'Command not run'}")
91
- # if result and result.stdout:
92
- # log.error(f"Stdout from start command: {result.stdout.strip()}")
90
+ if result.returncode == 0:
91
+ log.info(f"Successfully executed command for Word.")
92
+ else:
93
+ log.error(f"Error opening Word: {result.stderr.strip()}")
94
+ if result.stdout:
95
+ log.error(f"Stdout from start command: {result.stdout.strip()}")
93
96
  except FileNotFoundError:
94
97
  log.error("Error: 'cmd' or 'start' command not found. Ensure system PATH is configured correctly.")
95
98
  except Exception as e: