computer-use-ootb-internal 0.0.169__tar.gz → 0.0.171__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.169 → computer_use_ootb_internal-0.0.171}/PKG-INFO +1 -1
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/pyproject.toml +1 -1
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/app_teachmode.py +66 -14
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/executor/teachmode_executor.py +5 -45
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/tools/computer.py +1 -1
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/guard_service.py +19 -67
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/run_teachmode_ootb_args.py +9 -5
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/.gitignore +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/README.md +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/__init__.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/animation/click_animation.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/animation/icons8-select-cursor-transparent-96.gif +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/animation/test_animation.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/__init__.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/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.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/utils.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/__init__.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/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.169 → computer_use_ootb_internal-0.0.171}/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.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/llm_utils.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/oai.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_litellm.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_llm.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/tools/__init__.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/tools/aws_request.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/tools/base.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/tools/bash.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/tools/collection.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/tools/colorful_text.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/tools/computer_marbot.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/tools/edit.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/tools/run.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/computer_use_demo/tools/screen_capture.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/dependency_check.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/preparation/__init__.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/preparation/star_rail_prepare.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/requirements-lite.txt +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/service_manager.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/signal_connection.py +0 -0
- {computer_use_ootb_internal-0.0.169 → computer_use_ootb_internal-0.0.171}/src/computer_use_ootb_internal/test_click_0425.py +0 -0
@@ -19,7 +19,10 @@ from fastapi.responses import JSONResponse
|
|
19
19
|
from fastapi.middleware.cors import CORSMiddleware
|
20
20
|
from computer_use_ootb_internal.computer_use_demo.tools.computer import get_screen_details
|
21
21
|
from computer_use_ootb_internal.run_teachmode_ootb_args import simple_teachmode_sampling_loop
|
22
|
+
from computer_use_ootb_internal.computer_use_demo.executor.teachmode_executor import TeachmodeExecutor
|
22
23
|
import uvicorn # Assuming uvicorn is used to run FastAPI
|
24
|
+
import concurrent.futures
|
25
|
+
import asyncio
|
23
26
|
|
24
27
|
# --- App Logging Setup ---
|
25
28
|
try:
|
@@ -395,6 +398,62 @@ async def get_status(request: Request):
|
|
395
398
|
status_code=200
|
396
399
|
)
|
397
400
|
|
401
|
+
@app.post("/exec_computer_tool")
|
402
|
+
async def exec_computer_tool(request: Request):
|
403
|
+
logging.info("Received request to /exec_computer_tool")
|
404
|
+
try:
|
405
|
+
data = await request.json()
|
406
|
+
|
407
|
+
# Extract parameters from the request
|
408
|
+
selected_screen = data.get('selected_screen', 0)
|
409
|
+
full_screen_game_mode = data.get('full_screen_game_mode', 0)
|
410
|
+
response = data.get('response', {})
|
411
|
+
|
412
|
+
logging.info(f"Executing TeachmodeExecutor with: screen={selected_screen}, mode={full_screen_game_mode}, response={response}")
|
413
|
+
|
414
|
+
# Create TeachmodeExecutor in a separate process to avoid event loop conflicts
|
415
|
+
# Since TeachmodeExecutor uses asyncio.run() internally, we need to run it in a way
|
416
|
+
# that doesn't conflict with FastAPI's event loop
|
417
|
+
|
418
|
+
def run_executor():
|
419
|
+
executor = TeachmodeExecutor(
|
420
|
+
selected_screen=selected_screen,
|
421
|
+
full_screen_game_mode=full_screen_game_mode
|
422
|
+
)
|
423
|
+
|
424
|
+
results = []
|
425
|
+
try:
|
426
|
+
for action_result in executor(response):
|
427
|
+
results.append(action_result)
|
428
|
+
except Exception as exec_error:
|
429
|
+
logging.error(f"Error executing action: {exec_error}", exc_info=True)
|
430
|
+
return {"error": str(exec_error)}
|
431
|
+
|
432
|
+
return results
|
433
|
+
|
434
|
+
# Execute in a thread pool to avoid blocking the event loop
|
435
|
+
with concurrent.futures.ThreadPoolExecutor() as pool:
|
436
|
+
results = await asyncio.get_event_loop().run_in_executor(pool, run_executor)
|
437
|
+
|
438
|
+
if isinstance(results, dict) and "error" in results:
|
439
|
+
return JSONResponse(
|
440
|
+
content={"status": "error", "message": results["error"]},
|
441
|
+
status_code=500
|
442
|
+
)
|
443
|
+
|
444
|
+
logging.info(f"Action results: {results}")
|
445
|
+
|
446
|
+
return JSONResponse(
|
447
|
+
content={"status": "success", "results": results},
|
448
|
+
status_code=200
|
449
|
+
)
|
450
|
+
except Exception as e:
|
451
|
+
logging.error("Error processing /exec_computer_tool:", exc_info=True)
|
452
|
+
return JSONResponse(
|
453
|
+
content={"status": "error", "message": f"Internal server error: {str(e)}"},
|
454
|
+
status_code=500
|
455
|
+
)
|
456
|
+
|
398
457
|
def process_input():
|
399
458
|
global shared_state
|
400
459
|
logging.info("process_input thread started.")
|
@@ -493,9 +552,6 @@ def main():
|
|
493
552
|
parser.add_argument("--trace_id", type=str, default="build_scroll_combat", help="Trace ID for the session")
|
494
553
|
parser.add_argument("--api_keys", type=str, default="sk-proj-1234567890", help="API keys")
|
495
554
|
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")
|
496
|
-
# Add arguments for port override and target user
|
497
|
-
parser.add_argument("-p", "--port", type=int, default=None, help="Specify the port to run the server on, overriding user-based calculation.")
|
498
|
-
parser.add_argument("--target_user", type=str, default=None, help="Specify the target username for port calculation if --port is not given.")
|
499
555
|
|
500
556
|
args = parser.parse_args()
|
501
557
|
|
@@ -512,18 +568,14 @@ def main():
|
|
512
568
|
rate_limiter = RateLimiter(interval_seconds=2) # Re-initialize rate limiter
|
513
569
|
logging.info(f"Shared state initialized for user: {args.user_id}")
|
514
570
|
|
515
|
-
# ---
|
571
|
+
# --- Restore original port calculation logic ---
|
516
572
|
port = 7888 # Default port
|
517
573
|
host = "0.0.0.0" # Listen on all interfaces
|
518
574
|
|
519
|
-
if
|
520
|
-
port = args.port
|
521
|
-
logging.info(f"Using specified port from --port argument: {port}")
|
522
|
-
elif platform.system() == "Windows" and args.target_user is not None:
|
575
|
+
if platform.system() == "Windows":
|
523
576
|
try:
|
524
|
-
|
525
|
-
username
|
526
|
-
logging.info(f"Determining port based on Windows username from --target_user: {username}")
|
577
|
+
username = os.environ["USERNAME"].lower()
|
578
|
+
logging.info(f"Determining port based on Windows username: {username}")
|
527
579
|
if username == "altair":
|
528
580
|
port = 14000
|
529
581
|
elif username.startswith("guest") and username[5:].isdigit():
|
@@ -535,10 +587,10 @@ def main():
|
|
535
587
|
else:
|
536
588
|
logging.info(f"Username '{username}' doesn't match specific rules, using default port {port}.")
|
537
589
|
except Exception as e:
|
538
|
-
logging.error(f"Error determining port from
|
590
|
+
logging.error(f"Error determining port from username: {e}. Using default port {port}.", exc_info=True)
|
539
591
|
else:
|
540
|
-
logging.info(f"
|
541
|
-
# --- End
|
592
|
+
logging.info(f"Not running on Windows, using default port {port}.")
|
593
|
+
# --- End of restored port calculation ---
|
542
594
|
|
543
595
|
logging.info(f"Final Host={host}, Port={port}")
|
544
596
|
|
@@ -115,20 +115,21 @@ class TeachmodeExecutor:
|
|
115
115
|
print(f"Error parsing action output: {e}")
|
116
116
|
return None
|
117
117
|
|
118
|
-
def _parse_actor_output(self,
|
118
|
+
def _parse_actor_output(self, action_item: str | dict) -> Union[List[Dict[str, Any]], None]:
|
119
119
|
try:
|
120
120
|
# refine key: value pairs, mapping to the Anthropic's format
|
121
121
|
refined_output = []
|
122
122
|
|
123
|
-
action_item
|
124
|
-
|
123
|
+
if type(action_item) == str:
|
124
|
+
action_item = ast.literal_eval(action_item)
|
125
|
+
|
125
126
|
print("[_parse_actor_output] Action Item:", action_item)
|
126
127
|
|
127
128
|
# sometime showui returns lower case action names
|
128
129
|
action_item["action"] = action_item["action"].upper()
|
129
130
|
|
130
131
|
if action_item["action"] not in self.supported_action_type:
|
131
|
-
raise ValueError(f"Action {action_item['action']} not supported. Check the output from
|
132
|
+
raise ValueError(f"Action {action_item['action']} not supported. Check the output from Actor: {action_item}")
|
132
133
|
# continue
|
133
134
|
|
134
135
|
elif action_item["action"] == "CLICK": # 1. click -> mouse_move + left_click
|
@@ -314,44 +315,3 @@ class TeachmodeExecutor:
|
|
314
315
|
return bbox
|
315
316
|
|
316
317
|
|
317
|
-
|
318
|
-
# def _make_api_tool_result(
|
319
|
-
# result: ToolResult, tool_use_id: str
|
320
|
-
# ) -> BetaToolResultBlockParam:
|
321
|
-
# """Convert an agent ToolResult to an API ToolResultBlockParam."""
|
322
|
-
# tool_result_content: list[BetaTextBlockParam | BetaImageBlockParam] | str = []
|
323
|
-
# is_error = False
|
324
|
-
# if result.error:
|
325
|
-
# is_error = True
|
326
|
-
# tool_result_content = _maybe_prepend_system_tool_result(result, result.error)
|
327
|
-
# else:
|
328
|
-
# if result.output:
|
329
|
-
# tool_result_content.append(
|
330
|
-
# {
|
331
|
-
# "type": "text",
|
332
|
-
# "text": _maybe_prepend_system_tool_result(result, result.output),
|
333
|
-
# }
|
334
|
-
# )
|
335
|
-
# if result.base64_image:
|
336
|
-
# tool_result_content.append(
|
337
|
-
# {
|
338
|
-
# "type": "image",
|
339
|
-
# "source": {
|
340
|
-
# "type": "base64",
|
341
|
-
# "media_type": "image/png",
|
342
|
-
# "data": result.base64_image,
|
343
|
-
# },
|
344
|
-
# }
|
345
|
-
# )
|
346
|
-
# return {
|
347
|
-
# "type": "tool_result",
|
348
|
-
# "content": tool_result_content,
|
349
|
-
# "tool_use_id": tool_use_id,
|
350
|
-
# "is_error": is_error,
|
351
|
-
# }
|
352
|
-
|
353
|
-
|
354
|
-
# def _maybe_prepend_system_tool_result(result: ToolResult, result_text: str):
|
355
|
-
# if result.system:
|
356
|
-
# result_text = f"<system>{result.system}</system>\n{result_text}"
|
357
|
-
# return result_text
|
@@ -384,7 +384,7 @@ class ComputerTool(BaseAnthropicTool):
|
|
384
384
|
show_click(x, y)
|
385
385
|
time.sleep(0.25)
|
386
386
|
self.marbot_auto_gui.click(x=x, y=y)
|
387
|
-
self.marbot_auto_gui.click(x=x, y=y)
|
387
|
+
# self.marbot_auto_gui.click(x=x, y=y)
|
388
388
|
return ToolResult(output=f"Left click", action_base_type="click")
|
389
389
|
|
390
390
|
elif action == "mouse_move_windll":
|
@@ -688,24 +688,6 @@ class GuardService(win32serviceutil.ServiceFramework):
|
|
688
688
|
task_created_status = "task_unknown"
|
689
689
|
immediate_start_status = "start_not_attempted"
|
690
690
|
final_status = "failed_unknown"
|
691
|
-
calculated_port = 7888 # Default port
|
692
|
-
|
693
|
-
# --- Calculate Port based on username (mirroring app_teachmode logic) ---
|
694
|
-
try:
|
695
|
-
if user == "altair":
|
696
|
-
calculated_port = 14000
|
697
|
-
elif user.startswith("guest") and user[5:].isdigit():
|
698
|
-
num = int(user[5:])
|
699
|
-
if 1 <= num <= 10:
|
700
|
-
calculated_port = 14000 + num
|
701
|
-
else:
|
702
|
-
self.log_warning(f"Internal trigger: User 'guest{num}' out of range (1-10), using default port {calculated_port} for launch.")
|
703
|
-
# else: use default 7888
|
704
|
-
self.log_info(f"Internal trigger: Calculated port {calculated_port} for user '{user}'.")
|
705
|
-
except Exception as port_calc_e:
|
706
|
-
self.log_error(f"Internal trigger: Error calculating port for user '{user}': {port_calc_e}. Using default port {calculated_port}.")
|
707
|
-
# --- End Port Calculation ---
|
708
|
-
|
709
691
|
|
710
692
|
try:
|
711
693
|
# 1. Ensure scheduled task exists (still useful fallback/persistence)
|
@@ -760,77 +742,47 @@ class GuardService(win32serviceutil.ServiceFramework):
|
|
760
742
|
|
761
743
|
# 4. Attempt immediate start (User is active and not running)
|
762
744
|
immediate_start_status = "start_attempted"
|
763
|
-
self.log_info(f"Internal trigger: User '{user}' is active and not running. Attempting immediate start via
|
764
|
-
|
765
|
-
if not self.target_executable_path:
|
766
|
-
self.log_error("Internal trigger: Cannot start process - target executable path not found.")
|
767
|
-
final_status = "failed_exe_not_found"
|
768
|
-
return final_status # Exit early if executable missing
|
769
|
-
|
745
|
+
self.log_info(f"Internal trigger: User '{user}' is active and not running. Attempting immediate start via CreateProcessAsUser...")
|
770
746
|
try:
|
771
747
|
token = win32ts.WTSQueryUserToken(session_id)
|
772
748
|
env = win32profile.CreateEnvironmentBlock(token, False)
|
773
749
|
startup = win32process.STARTUPINFO()
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
target_exe_unquoted = self.target_executable_path.strip('"')
|
779
|
-
target_exe_for_ps = target_exe_unquoted.replace("'", "''") # Escape single quotes for PS
|
780
|
-
target_exe_dir_for_ps = os.path.dirname(target_exe_unquoted).replace("'", "''")
|
781
|
-
|
782
|
-
# Build the second argument for cmd.exe /K, as used in the successful test command
|
783
|
-
# Format: "<target_exe>" --port <port> --target_user ''<user>''
|
784
|
-
cmd_k_second_arg_content = f'""{target_exe_for_ps}"" --port {calculated_port} --target_user ''{user}'''
|
785
|
-
# Escape single quotes within this second arg for the outer PowerShell command string
|
786
|
-
cmd_k_second_arg_for_ps_command = cmd_k_second_arg_content.replace("'", "''")
|
787
|
-
|
788
|
-
# Build the full Start-Process command string matching the working test command
|
789
|
-
start_process_cmd = (
|
790
|
-
f"Start-Process -FilePath cmd.exe "
|
791
|
-
f"-ArgumentList @('/K', '{cmd_k_second_arg_for_ps_command}') "
|
792
|
-
f"-WorkingDirectory '{target_exe_dir_for_ps}' "
|
793
|
-
f"-Verb RunAs"
|
794
|
-
)
|
795
|
-
|
796
|
-
# Launch powershell.exe directly, tell it to run the Start-Process command, and keep window open
|
797
|
-
# Use outer single quotes for -Command argument value to simplify inner quoting
|
798
|
-
# No need to escape inner double quotes when using outer single quotes
|
799
|
-
# Escape any literal single quotes within start_process_cmd itself (shouldn't be needed here but good practice)
|
800
|
-
start_process_cmd_escaped_for_single_quotes = start_process_cmd.replace("'", "''")
|
801
|
-
lpCommandLine = f'powershell.exe -NoProfile -ExecutionPolicy Bypass -NoExit -Command \'{start_process_cmd_escaped_for_single_quotes}\''
|
802
|
-
|
803
|
-
lpApplicationName = None # Must be None if using lpCommandLine
|
804
|
-
cwd = os.path.dirname(target_exe_unquoted) if os.path.dirname(target_exe_unquoted) else None
|
750
|
+
creation_flags = 0x00000010 # CREATE_NEW_CONSOLE
|
751
|
+
lpApplicationName = None
|
752
|
+
lpCommandLine = f'cmd.exe /K "{self.target_executable_path}"'
|
753
|
+
cwd = os.path.dirname(self.target_executable_path.strip('"')) if os.path.dirname(self.target_executable_path.strip('"')) != '' else None
|
805
754
|
|
806
755
|
# Log details before call
|
807
|
-
self.log_info(f"Internal trigger:
|
756
|
+
self.log_info(f"Internal trigger: Calling CreateProcessAsUser:")
|
808
757
|
self.log_info(f" lpCommandLine: {lpCommandLine}")
|
809
758
|
self.log_info(f" lpCurrentDirectory: {cwd if cwd else 'Default'}")
|
810
|
-
|
759
|
+
|
811
760
|
hProcess, hThread, dwPid, dwTid = win32process.CreateProcessAsUser(
|
812
761
|
token, lpApplicationName, lpCommandLine, None, None, False,
|
813
762
|
creation_flags, env, cwd, startup
|
814
763
|
)
|
815
|
-
|
816
|
-
# We can't easily track the elevated process PID across the UAC boundary.
|
817
|
-
self.log_info(f"Internal trigger: CreateProcessAsUser call to initiate elevation succeeded for user '{user}' (Launcher PID: {dwPid}). UAC prompt expected if needed.")
|
764
|
+
self.log_info(f"Internal trigger: CreateProcessAsUser call succeeded for user '{user}' (PID: {dwPid}). Checking existence...")
|
818
765
|
win32api.CloseHandle(hProcess)
|
819
766
|
win32api.CloseHandle(hThread)
|
820
767
|
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
768
|
+
time.sleep(1)
|
769
|
+
if psutil.pid_exists(dwPid):
|
770
|
+
self.log_info(f"Internal trigger: Immediate start succeeded for user '{user}' (PID {dwPid}).")
|
771
|
+
immediate_start_status = "start_success"
|
772
|
+
final_status = "success" # Overall success
|
773
|
+
else:
|
774
|
+
self.log_error(f"Internal trigger: Immediate start failed for user '{user}': Process {dwPid} exited immediately.")
|
775
|
+
immediate_start_status = "start_failed_exited"
|
776
|
+
final_status = "failed_start_exited"
|
825
777
|
|
826
778
|
except Exception as proc_err:
|
827
|
-
self.log_error(f"Internal trigger: Exception during CreateProcessAsUser for
|
779
|
+
self.log_error(f"Internal trigger: Exception during CreateProcessAsUser for user '{user}': {proc_err}", exc_info=True)
|
828
780
|
immediate_start_status = "start_failed_exception"
|
829
781
|
final_status = "failed_start_exception"
|
830
782
|
finally:
|
831
783
|
if token: win32api.CloseHandle(token)
|
832
784
|
|
833
|
-
# Combine results (mostly determined by start attempt now)
|
785
|
+
# Combine results (though mostly determined by start attempt now)
|
834
786
|
# Example: final_status = f"{task_created_status}_{immediate_start_status}"
|
835
787
|
return final_status
|
836
788
|
|
@@ -119,17 +119,21 @@ def simple_teachmode_sampling_loop(
|
|
119
119
|
|
120
120
|
try:
|
121
121
|
step_plan = infer_server_response["generated_plan"]
|
122
|
-
|
123
|
-
|
122
|
+
step_plan_observation = step_plan["observation"]
|
123
|
+
step_plan_reasoning = step_plan["reasoning"]
|
124
|
+
step_plan_info = step_plan["step_info"]
|
124
125
|
step_action = infer_server_response["generated_action"]["content"]
|
125
126
|
step_traj_idx = infer_server_response["current_traj_step"]
|
126
127
|
|
128
|
+
# chat_visable_content = f"{step_plan_observation}{step_plan_reasoning}"
|
129
|
+
|
127
130
|
except Exception as e:
|
128
131
|
print("Error parsing generated_action content:", e)
|
129
132
|
yield {"role": "assistant", "content": "Error parsing response from Marbot Run server. Exiting.", "type": "error"}
|
130
133
|
break
|
131
|
-
|
132
|
-
yield {"role": "assistant", "content":
|
134
|
+
|
135
|
+
yield {"role": "assistant", "content": step_plan_observation, "type": "text"}
|
136
|
+
yield {"role": "assistant", "content": step_plan_reasoning, "type": "text"}
|
133
137
|
|
134
138
|
if step_action.get("action") == "STOP":
|
135
139
|
final_sc, final_sc_path = get_screenshot_external_cmd(selected_screen=selected_screen)
|
@@ -141,7 +145,7 @@ def simple_teachmode_sampling_loop(
|
|
141
145
|
action_history = []
|
142
146
|
break
|
143
147
|
|
144
|
-
action_history.append(f"Executing guidance trajectory step [{step_traj_idx}]: {{Plan: {
|
148
|
+
action_history.append(f"Executing guidance trajectory step [{step_traj_idx}]: {{Plan: {step_plan_info}, Action: {step_action}}}\n")
|
145
149
|
|
146
150
|
for exec_message in executor({"role": "assistant", "content": step_action}):
|
147
151
|
yield exec_message
|
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
|