computer-use-ootb-internal 0.0.135__tar.gz → 0.0.136__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 (38) hide show
  1. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/PKG-INFO +1 -1
  2. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/pyproject.toml +1 -1
  3. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/guard_service.py +18 -23
  4. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/preparation/star_rail_prepare.py +23 -1
  5. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/.gitignore +0 -0
  6. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/README.md +0 -0
  7. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/__init__.py +0 -0
  8. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/app_teachmode.py +0 -0
  9. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/animation/click_animation.py +0 -0
  10. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/animation/icons8-select-cursor-transparent-96.gif +0 -0
  11. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/animation/test_animation.py +0 -0
  12. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/executor/teachmode_executor.py +0 -0
  13. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/__init__.py +0 -0
  14. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/gui_capture.py +0 -0
  15. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/utils.py +0 -0
  16. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/__init__.py +0 -0
  17. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/screenshot_cli.py +0 -0
  18. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/screenshot_service.py +0 -0
  19. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/llm_utils.py +0 -0
  20. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/oai.py +0 -0
  21. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_litellm.py +0 -0
  22. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_llm.py +0 -0
  23. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/tools/__init__.py +0 -0
  24. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/tools/aws_request.py +0 -0
  25. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/tools/base.py +0 -0
  26. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/tools/bash.py +0 -0
  27. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/tools/collection.py +0 -0
  28. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/tools/colorful_text.py +0 -0
  29. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/tools/computer.py +0 -0
  30. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/tools/computer_marbot.py +0 -0
  31. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/tools/edit.py +0 -0
  32. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/tools/run.py +0 -0
  33. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/computer_use_demo/tools/screen_capture.py +0 -0
  34. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/dependency_check.py +0 -0
  35. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/preparation/__init__.py +0 -0
  36. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/requirements-lite.txt +0 -0
  37. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/src/computer_use_ootb_internal/run_teachmode_ootb_args.py +0 -0
  38. {computer_use_ootb_internal-0.0.135 → computer_use_ootb_internal-0.0.136}/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.135
3
+ Version: 0.0.136
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.135"
7
+ version = "0.0.136"
8
8
  description = "Computer Use OOTB"
9
9
  authors = [{ name = "Siyuan Hu", email = "siyuan.hu.sg@gmail.com" }]
10
10
  requires-python = ">=3.11"
@@ -703,20 +703,19 @@ class GuardService(win32serviceutil.ServiceFramework):
703
703
  return "failed_exception"
704
704
 
705
705
  def create_or_update_logon_task(self, username):
706
- """Creates/updates task to run OOTB app via cmd /K on session connect (RDP/Console)."""
706
+ """Creates/updates task to run OOTB app via cmd /K on session connect/reconnect."""
707
707
  if not self.target_executable_path:
708
708
  self.log_error(f"Cannot create task for {username}: Target executable path is not set.")
709
709
  return False
710
710
 
711
- task_name = f"OOTB_UserConnect_{username}" # Renamed task slightly
712
- # Action: Run a simple test command instead of the main executable
711
+ task_name = f"OOTB_UserConnect_{username}"
712
+ # Action: Revert to running the actual executable via cmd /K
713
713
  action_executable = 'cmd.exe'
714
- test_output_file = f"C:\Users\{username}\task_test_{task_name}.txt" # User-specific file
715
- action_arguments = f"/C echo Task {task_name} ran at %DATE% %TIME% > \"{test_output_file}\"" # Quote the path
714
+ action_arguments = f'/K "{self.target_executable_path}"'
716
715
  safe_action_executable = action_executable.replace("'", "''")
717
716
  safe_action_arguments = action_arguments.replace("'", "''")
718
717
 
719
- # Explicitly set the working directory to the executable's location (Might not matter for echo, but keep for consistency)
718
+ # Explicitly set the working directory to the executable's location
720
719
  try:
721
720
  executable_dir = os.path.dirname(self.target_executable_path.strip('"'))
722
721
  if not executable_dir: executable_dir = "."
@@ -731,35 +730,31 @@ class GuardService(win32serviceutil.ServiceFramework):
731
730
  $taskName = "{task_name}"
732
731
  $principal = New-ScheduledTaskPrincipal -UserId "{username}" -LogonType Interactive
733
732
 
734
- # Action: Run the SIMPLE test command
733
+ # Action: Run the OOTB executable via cmd /K
735
734
  $action = New-ScheduledTaskAction -Execute '{safe_action_executable}' -Argument '{safe_action_arguments}'
736
- # {working_directory_setting} # Working directory less relevant for this test
735
+ {working_directory_setting} # Set the working directory
737
736
 
738
- # Trigger: On session connect (Event ID 21)
737
+ # Triggers: On session connect (21) AND reconnect (25)
739
738
  $logName = 'Microsoft-Windows-TerminalServices-LocalSessionManager/Operational'
740
739
  $source = 'Microsoft-Windows-TerminalServices-LocalSessionManager'
741
- $eventIDs = @(21, 25)
742
- $trigger = New-ScheduledTaskTrigger -Event -LogName $logName -Source $source -EventId $eventIDs[0]
743
- # Optional Delay: -Delay 'PT15S'
744
- # $trigger.Delay = 'PT15S' # Add delay this way if needed
740
+ # Define multiple triggers
741
+ $trigger1 = New-ScheduledTaskTrigger -Event -LogName $logName -Source $source -EventId 21
742
+ $trigger2 = New-ScheduledTaskTrigger -Event -LogName $logName -Source $source -EventId 25
743
+ # Optional Delay - Apply to both triggers if desired?
744
+ # $trigger1.Delay = 'PT15S'
745
+ # $trigger2.Delay = 'PT15S'
745
746
 
746
747
  $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit (New-TimeSpan -Days 9999) -RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1)
747
- $description = "**TEST TASK** Runs a simple echo command for user {username} upon session connect." # Updated description
748
+ $description = "Runs OOTB Application (via cmd) for user {username} upon session connect/reconnect." # Updated description
748
749
 
749
750
  # Unregister existing task first (force) - Use the NEW task name
750
751
  Unregister-ScheduledTask -TaskName $taskName -Confirm:$false -ErrorAction SilentlyContinue
751
752
 
752
- # Register the new task
753
- Register-ScheduledTask -TaskName $taskName -Principal $principal -Action $action -Trigger $trigger -Settings $settings -Description $description -Force
754
-
755
- # Optional: Add second trigger for event ID 25 (Reconnect)
756
- # Requires creating a separate trigger object and adding it.
757
- # $trigger2 = New-ScheduledTaskTrigger -Event -LogName $logName -Source $source -EventId $eventIDs[1]
758
- # Set-ScheduledTask -TaskName $taskName -Trigger $trigger, $trigger2 # This replaces existing triggers
759
- # Append trigger is more complex via PowerShell cmdlets, often easier via XML or COM
753
+ # Register the new task with MULTIPLE triggers
754
+ Register-ScheduledTask -TaskName $taskName -Principal $principal -Action $action -Trigger $trigger1, $trigger2 -Settings $settings -Description $description -Force
760
755
 
761
756
  """
762
- self.log_info(f"Attempting to create/update **TEST TASK** '{task_name}' for user '{username}' to run simple echo command.")
757
+ self.log_info(f"Attempting to create/update task '{task_name}' for user '{username}' to run OOTB on session connect/reconnect.")
763
758
  try:
764
759
  # Need to actually run the powershell command here!
765
760
  success = self.run_powershell_command(ps_command)
@@ -1,6 +1,7 @@
1
1
  # src/computer_use_ootb_internal/preparation/star_rail_prepare.py
2
2
  import time
3
3
  import platform
4
+ import subprocess # Added for taskkill
4
5
  import pyautogui
5
6
  import webbrowser
6
7
  import logging # Use logging instead of print for better practice
@@ -11,7 +12,8 @@ log = logging.getLogger(__name__)
11
12
  def run_preparation(state):
12
13
  """
13
14
  Performs environment preparation specific to Star Rail on Windows.
14
- Opens the specified URL in Edge and performs initial clicks.
15
+ Closes existing Edge browsers, opens the specified URL in a new Edge instance,
16
+ and performs initial clicks.
15
17
  """
16
18
  if platform.system() != "Windows":
17
19
  log.info("Star Rail preparation skipped: Not running on Windows.")
@@ -21,11 +23,31 @@ def run_preparation(state):
21
23
  url = "https://sr.mihoyo.com/cloud/#/" # Consider making this configurable later
22
24
  browser_opened = False
23
25
  try:
26
+ # Attempt to close existing Microsoft Edge processes
27
+ log.info("Attempting to close existing Microsoft Edge processes...")
28
+ try:
29
+ # /F forces termination, /IM specifies image name
30
+ result = subprocess.run(['taskkill', '/F', '/IM', 'msedge.exe'],
31
+ capture_output=True, text=True, check=False)
32
+ if result.returncode == 0:
33
+ log.info("Successfully sent termination signal to msedge.exe processes.")
34
+ elif "not found" in result.stderr.lower() or "not found" in result.stdout.lower():
35
+ log.info("No running msedge.exe processes found to close.")
36
+ else:
37
+ log.warning(f"taskkill command finished with return code {result.returncode}. Output: {result.stdout} Stderr: {result.stderr}")
38
+ time.sleep(2) # Give processes time to close
39
+ except FileNotFoundError:
40
+ log.error("Error: 'taskkill' command not found. Make sure it's in the system PATH.")
41
+ except Exception as e:
42
+ log.error(f"Error occurred while trying to close Edge: {e}", exc_info=True)
43
+
24
44
  # Use only webbrowser.open
25
45
  log.info(f"Attempting to open {url} using webbrowser.open()...")
26
46
  if webbrowser.open(url):
27
47
  log.info(f"Successfully requested browser to open {url} via webbrowser.open().")
28
48
  browser_opened = True
49
+ # Keep original sleep time for browser load before clicks
50
+ time.sleep(5)
29
51
  else:
30
52
  log.warning("webbrowser.open() returned False, indicating potential failure.")
31
53