computer-use-ootb-internal 0.0.131__tar.gz → 0.0.133__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.
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/PKG-INFO +1 -1
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/pyproject.toml +1 -1
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/guard_service.py +47 -27
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/.gitignore +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/README.md +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/__init__.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/app_teachmode.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/animation/click_animation.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/animation/icons8-select-cursor-transparent-96.gif +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/animation/test_animation.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/executor/teachmode_executor.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/__init__.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/gui_capture.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/utils.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/__init__.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/screenshot_cli.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/screenshot_service.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/llm_utils.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/oai.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_litellm.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_llm.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/tools/__init__.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/tools/aws_request.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/tools/base.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/tools/bash.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/tools/collection.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/tools/colorful_text.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/tools/computer.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/tools/computer_marbot.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/tools/edit.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/tools/run.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/computer_use_demo/tools/screen_capture.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/dependency_check.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/preparation/__init__.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/preparation/star_rail_prepare.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/requirements-lite.txt +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/run_teachmode_ootb_args.py +0 -0
- {computer_use_ootb_internal-0.0.131 → computer_use_ootb_internal-0.0.133}/src/computer_use_ootb_internal/service_manager.py +0 -0
@@ -614,31 +614,24 @@ class GuardService(win32serviceutil.ServiceFramework):
|
|
614
614
|
try:
|
615
615
|
session_id = active_sessions[user]
|
616
616
|
token = win32ts.WTSQueryUserToken(session_id)
|
617
|
-
env = win32profile.CreateEnvironmentBlock(token, False)
|
617
|
+
# env = win32profile.CreateEnvironmentBlock(token, False) # <-- Temporarily disable creating env block
|
618
|
+
env = None # Use default environment provided by CreateProcessAsUser
|
618
619
|
startup = win32process.STARTUPINFO()
|
619
|
-
# No need to hide the window now, cmd /K will keep it open.
|
620
|
-
# startup.dwFlags = win32process.STARTF_USESHOWWINDOW
|
621
|
-
# startup.wShowWindow = win32con.SW_HIDE
|
622
620
|
creation_flags = 0x00000010 # CREATE_NEW_CONSOLE
|
623
621
|
|
624
622
|
# --- Launch via cmd /K ---
|
625
|
-
|
626
|
-
lpApplicationName = None # We specify cmd.exe in the command line
|
627
|
-
# Ensure target path is quoted correctly within the command string
|
628
|
-
# self.target_executable_path should already be quoted if needed
|
623
|
+
lpApplicationName = None
|
629
624
|
lpCommandLine = f'cmd.exe /K "{self.target_executable_path}"'
|
630
|
-
|
631
|
-
# Determine CWD for the cmd process (can be None to use default)
|
632
625
|
cwd = os.path.dirname(self.target_executable_path.strip('"')) if os.path.dirname(self.target_executable_path.strip('"')) != '' else None
|
633
626
|
# --- End Launch via cmd /K ---
|
634
627
|
|
635
|
-
self.log_info(f"Calling CreateProcessAsUser to launch via cmd /K:")
|
628
|
+
self.log_info(f"Calling CreateProcessAsUser to launch via cmd /K (Default Environment Test):") # Added note to log
|
636
629
|
self.log_info(f" lpApplicationName: {lpApplicationName}")
|
637
630
|
self.log_info(f" lpCommandLine: {lpCommandLine}")
|
638
631
|
self.log_info(f" lpCurrentDirectory: {cwd if cwd else 'Default'}")
|
639
632
|
self.log_info(f" dwCreationFlags: {creation_flags} (CREATE_NEW_CONSOLE)")
|
640
633
|
|
641
|
-
# CreateProcessAsUser call
|
634
|
+
# CreateProcessAsUser call with env = None
|
642
635
|
hProcess, hThread, dwPid, dwTid = win32process.CreateProcessAsUser(
|
643
636
|
token, # User token
|
644
637
|
lpApplicationName, # Application name (None)
|
@@ -647,7 +640,7 @@ class GuardService(win32serviceutil.ServiceFramework):
|
|
647
640
|
None, # Thread attributes
|
648
641
|
False, # Inherit handles
|
649
642
|
creation_flags, # Creation flags (CREATE_NEW_CONSOLE)
|
650
|
-
env, # Environment block
|
643
|
+
env, # Environment block (Now None)
|
651
644
|
cwd, # Current directory for cmd.exe
|
652
645
|
startup # Startup info
|
653
646
|
)
|
@@ -711,41 +704,68 @@ class GuardService(win32serviceutil.ServiceFramework):
|
|
711
704
|
return "failed_exception"
|
712
705
|
|
713
706
|
def create_or_update_logon_task(self, username):
|
714
|
-
"""Creates
|
707
|
+
"""Creates/updates task to run OOTB app via cmd /K on session connect (RDP/Console)."""
|
715
708
|
if not self.target_executable_path:
|
716
709
|
self.log_error(f"Cannot create task for {username}: Target executable path is not set.")
|
717
710
|
return False
|
718
711
|
|
719
|
-
task_name = f"
|
720
|
-
# Action: Execute cmd.exe
|
712
|
+
task_name = f"OOTB_UserConnect_{username}" # Renamed task slightly
|
721
713
|
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
714
|
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
715
|
safe_action_executable = action_executable.replace("'", "''")
|
727
716
|
safe_action_arguments = action_arguments.replace("'", "''")
|
717
|
+
|
718
|
+
# Explicitly set the working directory to the executable's location
|
719
|
+
try:
|
720
|
+
executable_dir = os.path.dirname(self.target_executable_path.strip('"'))
|
721
|
+
if not executable_dir: # Handle case where path might be just the exe name
|
722
|
+
executable_dir = "." # Use current directory as fallback?
|
723
|
+
self.log_warning(f"Could not determine directory for {self.target_executable_path}, task WorkingDirectory might be incorrect.")
|
724
|
+
safe_working_directory = executable_dir.replace("'", "''")
|
725
|
+
working_directory_setting = f"$action.WorkingDirectory = '{safe_working_directory}'"
|
726
|
+
except Exception as e:
|
727
|
+
self.log_error(f"Error determining working directory for task: {e}. WorkingDirectory will not be set.")
|
728
|
+
working_directory_setting = "# Could not set WorkingDirectory" # Comment out in PS script
|
728
729
|
|
729
730
|
# PowerShell command construction
|
730
731
|
ps_command = f"""
|
731
732
|
$taskName = "{task_name}"
|
732
733
|
$principal = New-ScheduledTaskPrincipal -UserId "{username}" -LogonType Interactive
|
733
|
-
|
734
|
+
|
735
|
+
# Action: Run cmd.exe with /K, setting the working directory
|
734
736
|
$action = New-ScheduledTaskAction -Execute '{safe_action_executable}' -Argument '{safe_action_arguments}'
|
735
|
-
|
736
|
-
|
737
|
-
#
|
738
|
-
$
|
737
|
+
{working_directory_setting}
|
738
|
+
|
739
|
+
# Trigger: On session connect/reconnect events for Terminal Services
|
740
|
+
$logName = 'Microsoft-Windows-TerminalServices-LocalSessionManager/Operational'
|
741
|
+
$source = 'Microsoft-Windows-TerminalServices-LocalSessionManager'
|
742
|
+
$eventIDs = @(21, 25) # 21=SessionLogon, 25=SessionReconnect
|
743
|
+
# The Principal -UserId should ensure this only runs for the target user when they connect
|
744
|
+
$trigger = New-ScheduledTaskTrigger -AtLogOn # Keep AtLogOn as a fallback?
|
745
|
+
# --- Let's stick to ONE trigger type first. Replacing AtLogOn with Event ---
|
746
|
+
# $trigger = New-ScheduledTaskTrigger -AtLogOn -User "{username}"
|
747
|
+
$trigger = New-ScheduledTaskTrigger -Event -LogName $logName -Source $source -EventId $eventIDs[0] # Primary trigger
|
748
|
+
# Register additional triggers if needed, or handle logic differently.
|
749
|
+
# For simplicity, let's try one event trigger first (ID 21). If reconnect (25) is needed, we can add it.
|
750
|
+
# Consider adding delay: -Delay 'PT15S' # Delay 15 seconds after event?
|
751
|
+
|
739
752
|
$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
|
753
|
+
$description = "Runs OOTB Application (via cmd) for user {username} upon session connect (Event Trigger)." # Updated description
|
741
754
|
|
742
|
-
# Unregister existing task first (force)
|
755
|
+
# Unregister existing task first (force) - Use the NEW task name
|
743
756
|
Unregister-ScheduledTask -TaskName $taskName -Confirm:$false -ErrorAction SilentlyContinue
|
744
757
|
|
745
758
|
# Register the new task
|
746
759
|
Register-ScheduledTask -TaskName $taskName -Principal $principal -Action $action -Trigger $trigger -Settings $settings -Description $description -Force
|
760
|
+
|
761
|
+
# Optional: Add second trigger for event ID 25 (Reconnect)
|
762
|
+
# Requires creating a separate trigger object and adding it.
|
763
|
+
# $trigger2 = New-ScheduledTaskTrigger -Event -LogName $logName -Source $source -EventId $eventIDs[1]
|
764
|
+
# Set-ScheduledTask -TaskName $taskName -Trigger $trigger, $trigger2 # This replaces existing triggers
|
765
|
+
# Append trigger is more complex via PowerShell cmdlets, often easier via XML or COM
|
766
|
+
|
747
767
|
"""
|
748
|
-
self.log_info(f"Attempting to create/update task '{task_name}' for user '{username}' to run '{action_executable} {action_arguments}'")
|
768
|
+
self.log_info(f"Attempting to create/update task '{task_name}' for user '{username}' to run '{action_executable} {action_arguments}' on session connect.")
|
749
769
|
try:
|
750
770
|
# Need to actually run the powershell command here!
|
751
771
|
success = self.run_powershell_command(ps_command)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|