Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[project]
name = "uipath-dev"
version = "0.0.7"
version = "0.0.8"
description = "UiPath Developer Console"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
dependencies = [
"uipath-runtime>=0.0.21, <0.1.0",
"uipath-runtime>=0.1.0, <0.2.0",
"textual>=6.6.0, <7.0.0",
"pyperclip>=1.11.0, <2.0.0",
]
Expand Down
2 changes: 1 addition & 1 deletion src/uipath/dev/models/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(
self.conversational = conversational
self.debug = debug
self.resume_data: dict[str, Any] | None = None
self.output_data: dict[str, Any] | None = None
self.output_data: dict[str, Any] | str | None = None
self.start_time = datetime.now()
self.end_time: datetime | None = None
self.status = "pending" # pending, running, completed, failed, suspended
Expand Down
12 changes: 8 additions & 4 deletions src/uipath/dev/services/debug_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self):
"""Initialize the debug bridge."""
self._connected = False
self._resume_event = asyncio.Event()
self._quit_requested = False
self._terminate_event = asyncio.Event()
self._breakpoints: list[str] | Literal["*"] = "*" # Default: step mode

# Callbacks to UI
Expand All @@ -31,13 +31,13 @@ def __init__(self):
async def connect(self) -> None:
"""Establish connection to debugger."""
self._connected = True
self._quit_requested = False
logger.debug("Debug bridge connected")

async def disconnect(self) -> None:
"""Close connection to debugger."""
self._connected = False
self._resume_event.set() # Unblock any waiting tasks
self._terminate_event.set()
logger.debug("Debug bridge disconnected")

async def emit_execution_started(self, **kwargs: Any) -> None:
Expand Down Expand Up @@ -83,16 +83,20 @@ async def wait_for_resume(self) -> Any:
self._resume_event.clear()
await self._resume_event.wait()

if self._quit_requested:
if self._terminate_event.is_set():
raise UiPathDebugQuitError("Debug session quit requested")

async def wait_for_terminate(self) -> None:
"""Wait for terminate command from debugger."""
await self._terminate_event.wait()

def resume(self) -> None:
"""Signal that execution should resume (called from UI buttons)."""
self._resume_event.set()

def quit(self) -> None:
"""Signal that execution should quit (called from UI stop button)."""
self._quit_requested = True
self._terminate_event.set()
self._resume_event.set()

def get_breakpoints(self) -> list[str] | Literal["*"]:
Expand Down
13 changes: 8 additions & 5 deletions src/uipath/dev/services/run_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import json
import traceback
from datetime import datetime
from typing import Any, Callable
Expand All @@ -17,6 +18,7 @@
)
from uipath.runtime.debug import UiPathDebugRuntime
from uipath.runtime.errors import UiPathErrorContract, UiPathRuntimeError
from uipath.runtime.events import UiPathRuntimeStateEvent

from uipath.dev.infrastructure import RunContextExporter, RunContextLogHandler
from uipath.dev.models import ExecutionRun, LogMessage, TraceMessage
Expand Down Expand Up @@ -111,8 +113,8 @@ async def execute(self, run: ExecutionRun) -> None:
debug_bridge = TextualDebugBridge()

# Connect callbacks
debug_bridge.on_state_update = lambda event: self._handle_state_update(
run.id, event
debug_bridge.on_state_update = lambda state: self._handle_state_update(
run.id, state
)
debug_bridge.on_breakpoint_hit = lambda bp: self._handle_breakpoint_hit(
run.id, bp
Expand Down Expand Up @@ -248,10 +250,11 @@ def get_debug_bridge(self, run_id: str) -> TextualDebugBridge | None:
"""Get the debug bridge for a run."""
return self.debug_bridges.get(run_id)

def _handle_state_update(self, run_id: str, event) -> None:
def _handle_state_update(self, run_id: str, state: UiPathRuntimeStateEvent) -> None:
"""Handle state update from debug runtime."""
# You can add more logic here later if needed
pass
run = self.runs.get(run_id)
if run:
self._add_info_log(run, json.dumps(state.payload))

def _handle_debug_started(self, run_id: str) -> None:
"""Handle debug started event."""
Expand Down
10 changes: 5 additions & 5 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.