computer-use-ootb-internal 0.0.117__tar.gz → 0.0.119__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.117 → computer_use_ootb_internal-0.0.119}/PKG-INFO +1 -1
  2. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/pyproject.toml +1 -1
  3. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/app_teachmode.py +43 -25
  4. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/guard_service.py +32 -15
  5. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/.gitignore +0 -0
  6. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/deploy.sh +0 -0
  7. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/README.md +0 -0
  8. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/__init__.py +0 -0
  9. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/app_teachmode_gradio.py +0 -0
  10. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/animation/click_animation.py +0 -0
  11. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/animation/icons8-select-cursor-transparent-96.gif +0 -0
  12. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/animation/test_animation.py +0 -0
  13. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/executor/teachmode_executor.py +0 -0
  14. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/__init__.py +0 -0
  15. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/gui_capture.py +0 -0
  16. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/utils.py +0 -0
  17. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/__init__.py +0 -0
  18. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/screenshot_cli.py +0 -0
  19. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/screenshot_service.py +0 -0
  20. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/llm_utils.py +0 -0
  21. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/oai.py +0 -0
  22. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_litellm.py +0 -0
  23. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_llm.py +0 -0
  24. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/tools/__init__.py +0 -0
  25. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/tools/aws_request.py +0 -0
  26. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/tools/base.py +0 -0
  27. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/tools/bash.py +0 -0
  28. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/tools/collection.py +0 -0
  29. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/tools/colorful_text.py +0 -0
  30. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/tools/computer.py +0 -0
  31. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/tools/computer_marbot.py +0 -0
  32. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/tools/edit.py +0 -0
  33. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/tools/run.py +0 -0
  34. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/computer_use_demo/tools/screen_capture.py +0 -0
  35. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/dependency_check.py +0 -0
  36. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/preparation/__init__.py +0 -0
  37. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/preparation/star_rail_prepare.py +0 -0
  38. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/requirements-lite.txt +0 -0
  39. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/src/computer_use_ootb_internal/run_teachmode_ootb_args.py +0 -0
  40. {computer_use_ootb_internal-0.0.117 → computer_use_ootb_internal-0.0.119}/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.117
3
+ Version: 0.0.119
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.117"
7
+ version = "0.0.119"
8
8
  description = "Computer Use OOTB"
9
9
  authors = [{ name = "Siyuan Hu", email = "siyuan.hu.sg@gmail.com" }]
10
10
  requires-python = ">=3.11"
@@ -467,31 +467,20 @@ def process_input():
467
467
  def main():
468
468
  # Logging is set up at the top level now
469
469
  logging.info("App main() function starting setup.")
470
- global app, shared_state, rate_limiter
471
-
472
- parser = argparse.ArgumentParser(
473
- description="Run a synchronous sampling loop for assistant/tool interactions in teach-mode."
474
- )
475
- parser.add_argument("--model", default="teach-mode-gpt-4o")
476
- parser.add_argument("--task", default="Create a claim on the SAP system, using Receipt.pdf as attachment.")
477
- parser.add_argument("--selected_screen", type=int, default=0)
478
- parser.add_argument("--user_id", default="star_rail_dev")
479
- parser.add_argument("--trace_id", default="scroll")
480
- parser.add_argument("--api_key_file", default="api_key.json")
481
- parser.add_argument("--api_keys", default="")
482
- parser.add_argument(
483
- "--server_url",
484
- default="http://ec2-44-234-43-86.us-west-2.compute.amazonaws.com",
485
- help="Server URL for the session"
486
- )
487
- parser.add_argument("--host", type=str, default="127.0.0.1", help="Host to bind the server to")
488
- parser.add_argument("--port", type=int, default=8000, help="Port to bind the server to") # Default port
470
+ global app, shared_state, rate_limiter # Ensure app is global if needed by uvicorn
471
+ parser = argparse.ArgumentParser()
472
+ # Add arguments, but NOT host and port
473
+ parser.add_argument("--model", type=str, default="teach-mode-gpt-4o", help="Model name")
474
+ parser.add_argument("--task", type=str, default="Following the instructions to complete the task.", help="Initial task description")
475
+ parser.add_argument("--selected_screen", type=int, default=0, help="Selected screen index")
476
+ parser.add_argument("--user_id", type=str, default="hero_cases", help="User ID for the session")
477
+ parser.add_argument("--trace_id", type=str, default="build_scroll_combat", help="Trace ID for the session")
478
+ parser.add_argument("--api_keys", type=str, default="sk-proj-1234567890", help="API keys")
479
+ parser.add_argument("--server_url", type=str, default="http://ec2-44-234-43-86.us-west-2.compute.amazonaws.com", help="Server URL for the session")
489
480
 
490
481
  args = parser.parse_args()
491
- shared_state = SharedState(args)
492
- rate_limiter = RateLimiter(interval_seconds=2)
493
482
 
494
- # Validate args or set defaults if needed
483
+ # Validate args or set defaults if needed (keep these)
495
484
  if not hasattr(args, 'model'): args.model = "default_model"
496
485
  if not hasattr(args, 'task'): args.task = "default_task"
497
486
  if not hasattr(args, 'selected_screen'): args.selected_screen = 0
@@ -500,11 +489,40 @@ def main():
500
489
  if not hasattr(args, 'api_keys'): args.api_keys = "none"
501
490
  if not hasattr(args, 'server_url'): args.server_url = "none"
502
491
 
503
- logging.info(f"Shared state initialized. Host={args.host}, Port={args.port}")
492
+ shared_state = SharedState(args)
493
+ rate_limiter = RateLimiter(interval_seconds=2) # Re-initialize rate limiter
494
+ logging.info(f"Shared state initialized for user: {args.user_id}")
495
+
496
+ # --- Restore original port calculation logic ---
497
+ port = 7888 # Default port
498
+ host = "0.0.0.0" # Listen on all interfaces
499
+
500
+ if platform.system() == "Windows":
501
+ try:
502
+ username = os.environ["USERNAME"].lower()
503
+ logging.info(f"Determining port based on Windows username: {username}")
504
+ if username == "altair":
505
+ port = 14000
506
+ elif username.startswith("guest") and username[5:].isdigit():
507
+ num = int(username[5:])
508
+ if 1 <= num <= 10: # Assuming max 10 guests for this range
509
+ port = 14000 + num
510
+ else:
511
+ logging.warning(f"Guest user number {num} out of range (1-10), using default port {port}.")
512
+ else:
513
+ logging.info(f"Username '{username}' doesn't match specific rules, using default port {port}.")
514
+ except Exception as e:
515
+ logging.error(f"Error determining port from username: {e}. Using default port {port}.", exc_info=True)
516
+ else:
517
+ logging.info(f"Not running on Windows, using default port {port}.")
518
+ # --- End of restored port calculation ---
519
+
520
+ logging.info(f"Final Host={host}, Port={port}")
504
521
 
505
522
  try:
506
- logging.info(f"Starting Uvicorn server on {args.host}:{args.port}")
507
- uvicorn.run(app, host=args.host, port=args.port)
523
+ logging.info(f"Starting Uvicorn server on {host}:{port}")
524
+ # Use the calculated port and specific host
525
+ uvicorn.run(app, host=host, port=port)
508
526
  logging.info("Uvicorn server stopped.")
509
527
  except Exception as main_e:
510
528
  logging.error("Error in main execution:", exc_info=True)
@@ -93,16 +93,33 @@ def get_python_executable():
93
93
  return python_exe
94
94
 
95
95
  def get_pip_executable():
96
- python_path = pathlib.Path(sys.executable)
97
- pip_path = python_path.parent / "Scripts" / "pip.exe"
98
- if pip_path.exists():
99
- pip_exe = str(pip_path)
100
- if " " in pip_exe and not pip_exe.startswith('"'):
101
- pip_exe = f'"{pip_exe}"'
102
- return pip_exe
103
- else:
104
- logging.warning("pip.exe not found in Scripts directory. Falling back to 'python -m pip'.")
105
- return f"{get_python_executable()} -m pip"
96
+ """Tries to locate the pip executable in the same environment."""
97
+ try:
98
+ current_python = sys.executable
99
+ log_info(f"get_pip_executable: sys.executable = {current_python}")
100
+ python_path = pathlib.Path(current_python)
101
+ # Common location is ../Scripts/pip.exe relative to python.exe
102
+ pip_path = python_path.parent / "Scripts" / "pip.exe"
103
+ log_info(f"get_pip_executable: Checking for pip at {pip_path}")
104
+
105
+ if pip_path.exists():
106
+ log_info(f"get_pip_executable: pip.exe found at {pip_path}")
107
+ # Quote if necessary
108
+ pip_exe = str(pip_path)
109
+ if " " in pip_exe and not pip_exe.startswith('"'):
110
+ pip_exe = f'"{pip_exe}"'
111
+ return pip_exe
112
+ else:
113
+ log_error(f"get_pip_executable: pip.exe NOT found at {pip_path}. Falling back to 'python -m pip'.")
114
+ # Fallback is intended here
115
+ pass # Explicitly pass to reach the fallback return outside the else
116
+
117
+ except Exception as e:
118
+ log_error(f"get_pip_executable: Error determining pip path: {e}", exc_info=True)
119
+ log_error("get_pip_executable: Falling back to 'python -m pip' due to error.")
120
+
121
+ # Fallback return statement if 'exists' is false or an exception occurred
122
+ return f"{get_python_executable()} -m pip"
106
123
 
107
124
  def log_info(msg):
108
125
  thread_name = threading.current_thread().name
@@ -250,7 +267,7 @@ class GuardService(win32serviceutil.ServiceFramework):
250
267
  def report_command_status(self, command_id, status, details=""):
251
268
  """Sends command status back to the server."""
252
269
  if not _SERVER_STATUS_REPORT_URL:
253
- log_warning("No server status report URL configured. Skipping report.")
270
+ log_error("No server status report URL configured. Skipping report.")
254
271
  return
255
272
 
256
273
  payload = {
@@ -352,7 +369,7 @@ class GuardService(win32serviceutil.ServiceFramework):
352
369
  log_info(f"Process PID={proc.pid} terminated successfully.")
353
370
  stopped_count += 1
354
371
  except psutil.TimeoutExpired:
355
- log_warning(f"Process PID={proc.pid} did not terminate gracefully, killing.")
372
+ log_error(f"Process PID={proc.pid} did not terminate gracefully, killing.")
356
373
  proc.kill()
357
374
  stopped_count += 1
358
375
  except psutil.NoSuchProcess:
@@ -385,7 +402,7 @@ class GuardService(win32serviceutil.ServiceFramework):
385
402
  normalized_user = user.lower()
386
403
  active_sessions[normalized_user] = session['SessionId']
387
404
  except Exception as query_err:
388
- log_warning(f"Could not query session {session['SessionId']}: {query_err}")
405
+ log_error(f"Could not query session {session['SessionId']}: {query_err}")
389
406
 
390
407
  log_info(f"Found active user sessions: {active_sessions}")
391
408
 
@@ -397,7 +414,7 @@ class GuardService(win32serviceutil.ServiceFramework):
397
414
  if normalized_target in active_sessions:
398
415
  target_session_map[normalized_target] = active_sessions[normalized_target]
399
416
  else:
400
- log_warning(f"Target user '{target_user}' not found in active sessions.")
417
+ log_error(f"Target user '{target_user}' not found in active sessions.")
401
418
  return "failed_user_not_active"
402
419
 
403
420
  if not target_session_map:
@@ -451,7 +468,7 @@ class GuardService(win32serviceutil.ServiceFramework):
451
468
  started_count += 1
452
469
  target_users_started.add(user)
453
470
  else:
454
- log_warning(f"Process PID {dwPid} reported by CreateProcessAsUser does NOT exist shortly after creation. It likely exited immediately.")
471
+ log_error(f"Process PID {dwPid} reported by CreateProcessAsUser does NOT exist shortly after creation. It likely exited immediately.")
455
472
  users_failed_to_start.add(user)
456
473
  # Attempt to get exit code? Difficult without waiting.
457
474