computer-use-ootb-internal 0.0.131__tar.gz → 0.0.132__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.131 → computer_use_ootb_internal-0.0.132}/PKG-INFO +1 -1
  2. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/pyproject.toml +1 -1
  3. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/guard_service.py +41 -14
  4. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/.gitignore +0 -0
  5. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/README.md +0 -0
  6. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/__init__.py +0 -0
  7. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/app_teachmode.py +0 -0
  8. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/animation/click_animation.py +0 -0
  9. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/animation/icons8-select-cursor-transparent-96.gif +0 -0
  10. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/animation/test_animation.py +0 -0
  11. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/executor/teachmode_executor.py +0 -0
  12. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/__init__.py +0 -0
  13. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/gui_capture.py +0 -0
  14. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/utils.py +0 -0
  15. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/__init__.py +0 -0
  16. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/screenshot_cli.py +0 -0
  17. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/screenshot_service.py +0 -0
  18. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/llm_utils.py +0 -0
  19. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/oai.py +0 -0
  20. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_litellm.py +0 -0
  21. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_llm.py +0 -0
  22. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/tools/__init__.py +0 -0
  23. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/tools/aws_request.py +0 -0
  24. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/tools/base.py +0 -0
  25. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/tools/bash.py +0 -0
  26. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/tools/collection.py +0 -0
  27. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/tools/colorful_text.py +0 -0
  28. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/tools/computer.py +0 -0
  29. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/tools/computer_marbot.py +0 -0
  30. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/tools/edit.py +0 -0
  31. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/tools/run.py +0 -0
  32. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/computer_use_demo/tools/screen_capture.py +0 -0
  33. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/dependency_check.py +0 -0
  34. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/preparation/__init__.py +0 -0
  35. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/preparation/star_rail_prepare.py +0 -0
  36. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/requirements-lite.txt +0 -0
  37. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/src/computer_use_ootb_internal/run_teachmode_ootb_args.py +0 -0
  38. {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.132}/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.131
3
+ Version: 0.0.132
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.131"
7
+ version = "0.0.132"
8
8
  description = "Computer Use OOTB"
9
9
  authors = [{ name = "Siyuan Hu", email = "siyuan.hu.sg@gmail.com" }]
10
10
  requires-python = ">=3.11"
@@ -711,41 +711,68 @@ class GuardService(win32serviceutil.ServiceFramework):
711
711
  return "failed_exception"
712
712
 
713
713
  def create_or_update_logon_task(self, username):
714
- """Creates or updates a scheduled task to run the OOTB app via cmd /K on user logon."""
714
+ """Creates/updates task to run OOTB app via cmd /K on session connect (RDP/Console)."""
715
715
  if not self.target_executable_path:
716
716
  self.log_error(f"Cannot create task for {username}: Target executable path is not set.")
717
717
  return False
718
718
 
719
- task_name = f"OOTB_UserLogon_{username}"
720
- # Action: Execute cmd.exe
719
+ task_name = f"OOTB_UserConnect_{username}" # Renamed task slightly
721
720
  action_executable = "cmd.exe"
722
- # Arguments for cmd.exe: /K "path\to\your\exe"
723
- # self.target_executable_path should already be quoted if needed
724
721
  action_arguments = f'/K "{self.target_executable_path}"'
725
- # Escape single quotes for PowerShell command string if the path itself contains them (unlikely but possible)
726
722
  safe_action_executable = action_executable.replace("'", "''")
727
723
  safe_action_arguments = action_arguments.replace("'", "''")
724
+
725
+ # Explicitly set the working directory to the executable's location
726
+ try:
727
+ executable_dir = os.path.dirname(self.target_executable_path.strip('"'))
728
+ if not executable_dir: # Handle case where path might be just the exe name
729
+ executable_dir = "." # Use current directory as fallback?
730
+ self.log_warning(f"Could not determine directory for {self.target_executable_path}, task WorkingDirectory might be incorrect.")
731
+ safe_working_directory = executable_dir.replace("'", "''")
732
+ working_directory_setting = f"$action.WorkingDirectory = '{safe_working_directory}'"
733
+ except Exception as e:
734
+ self.log_error(f"Error determining working directory for task: {e}. WorkingDirectory will not be set.")
735
+ working_directory_setting = "# Could not set WorkingDirectory" # Comment out in PS script
728
736
 
729
737
  # PowerShell command construction
730
738
  ps_command = f"""
731
739
  $taskName = "{task_name}"
732
740
  $principal = New-ScheduledTaskPrincipal -UserId "{username}" -LogonType Interactive
733
- # Action: Run cmd.exe with /K to launch the target executable and keep window open
741
+
742
+ # Action: Run cmd.exe with /K, setting the working directory
734
743
  $action = New-ScheduledTaskAction -Execute '{safe_action_executable}' -Argument '{safe_action_arguments}'
735
- # Optional: Set working directory for cmd.exe if needed.
736
- # Defaults often work, but could set explicitly to executable's dir:
737
- # $action.WorkingDirectory = '{os.path.dirname(self.target_executable_path.strip('"')).replace("'", "''")}'
738
- $trigger = New-ScheduledTaskTrigger -AtLogOn -User "{username}"
744
+ {working_directory_setting}
745
+
746
+ # Trigger: On session connect/reconnect events for Terminal Services
747
+ $logName = 'Microsoft-Windows-TerminalServices-LocalSessionManager/Operational'
748
+ $source = 'Microsoft-Windows-TerminalServices-LocalSessionManager'
749
+ $eventIDs = @(21, 25) # 21=SessionLogon, 25=SessionReconnect
750
+ # The Principal -UserId should ensure this only runs for the target user when they connect
751
+ $trigger = New-ScheduledTaskTrigger -AtLogOn # Keep AtLogOn as a fallback?
752
+ # --- Let's stick to ONE trigger type first. Replacing AtLogOn with Event ---
753
+ # $trigger = New-ScheduledTaskTrigger -AtLogOn -User "{username}"
754
+ $trigger = New-ScheduledTaskTrigger -Event -LogName $logName -Source $source -EventId $eventIDs[0] # Primary trigger
755
+ # Register additional triggers if needed, or handle logic differently.
756
+ # For simplicity, let's try one event trigger first (ID 21). If reconnect (25) is needed, we can add it.
757
+ # Consider adding delay: -Delay 'PT15S' # Delay 15 seconds after event?
758
+
739
759
  $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit (New-TimeSpan -Days 9999) -RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1)
740
- $description = "Runs OOTB Application (via cmd) for user {username} upon logon."
760
+ $description = "Runs OOTB Application (via cmd) for user {username} upon session connect (Event Trigger)." # Updated description
741
761
 
742
- # Unregister existing task first (force)
762
+ # Unregister existing task first (force) - Use the NEW task name
743
763
  Unregister-ScheduledTask -TaskName $taskName -Confirm:$false -ErrorAction SilentlyContinue
744
764
 
745
765
  # Register the new task
746
766
  Register-ScheduledTask -TaskName $taskName -Principal $principal -Action $action -Trigger $trigger -Settings $settings -Description $description -Force
767
+
768
+ # Optional: Add second trigger for event ID 25 (Reconnect)
769
+ # Requires creating a separate trigger object and adding it.
770
+ # $trigger2 = New-ScheduledTaskTrigger -Event -LogName $logName -Source $source -EventId $eventIDs[1]
771
+ # Set-ScheduledTask -TaskName $taskName -Trigger $trigger, $trigger2 # This replaces existing triggers
772
+ # Append trigger is more complex via PowerShell cmdlets, often easier via XML or COM
773
+
747
774
  """
748
- self.log_info(f"Attempting to create/update task '{task_name}' for user '{username}' to run '{action_executable} {action_arguments}'")
775
+ self.log_info(f"Attempting to create/update task '{task_name}' for user '{username}' to run '{action_executable} {action_arguments}' on session connect.")
749
776
  try:
750
777
  # Need to actually run the powershell command here!
751
778
  success = self.run_powershell_command(ps_command)