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
14 changes: 10 additions & 4 deletions src/uipath/dev/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any
from typing import Any, Optional

import pyperclip # type: ignore[import-untyped]
from pydantic import BaseModel
from rich.traceback import Traceback
from textual import on
from textual.app import App, ComposeResult
Expand Down Expand Up @@ -128,7 +129,7 @@ async def handle_chat_input(self, event: Input.Submitted) -> None:
)
return
if details_panel.current_run.status == "suspended":
details_panel.current_run.resume_data = user_text
details_panel.current_run.resume_data = {"message": user_text}
asyncio.create_task(self._execute_runtime(details_panel.current_run))
event.input.clear()

Expand Down Expand Up @@ -190,7 +191,7 @@ def action_copy(self) -> None:
async def _execute_runtime(self, run: ExecutionRun):
"""Execute the script using UiPath runtime."""
try:
execution_input: dict[str, Any] = {}
execution_input: Optional[dict[str, Any]] = {}
execution_options: UiPathExecuteOptions = UiPathExecuteOptions()
if run.status == "suspended":
execution_input = run.resume_data
Expand All @@ -216,7 +217,12 @@ async def _execute_runtime(self, run: ExecutionRun):
):
run.status = "suspended"
else:
run.output_data = result.output
if result.output is None:
run.output_data = {}
elif isinstance(result.output, BaseModel):
run.output_data = result.output.model_dump()
else:
run.output_data = result.output
run.status = "completed"
if run.output_data:
self._add_info_log(run, f"Execution result: {run.output_data}")
Expand Down
3 changes: 3 additions & 0 deletions src/uipath/dev/_demo/mock_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class MockRuntime(UiPathBaseRuntime):

async def get_schema(self) -> UiPathRuntimeSchema:
return UiPathRuntimeSchema(
filePath="default",
uniqueId="mock-runtime",
type="agent",
input={
"type": "object",
"properties": {"message": {"type": "string"}},
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 @@ -25,7 +25,7 @@ def __init__(
self.entrypoint = entrypoint
self.input_data = input_data
self.conversational = conversational
self.resume_data: Optional[Any] = None
self.resume_data: Optional[dict[str, Any]] = None
self.output_data: Optional[dict[str, Any]] = None
self.start_time = datetime.now()
self.end_time: Optional[datetime] = None
Expand Down
4 changes: 4 additions & 0 deletions src/uipath/dev/models/messages.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Messages used for inter-component communication in the UiPath Developer Console."""

from datetime import datetime
from typing import Any, Optional, Union

Expand All @@ -15,6 +17,7 @@ def __init__(
message: Union[str, RenderableType],
timestamp: Optional[datetime] = None,
):
"""Initialize a LogMessage instance."""
self.run_id = run_id
self.level = level
self.message = message
Expand All @@ -37,6 +40,7 @@ def __init__(
timestamp: Optional[datetime] = None,
attributes: Optional[dict[str, Any]] = None,
):
"""Initialize a TraceMessage instance."""
self.run_id = run_id
self.span_name = span_name
self.span_id = span_id
Expand Down
2 changes: 0 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
"""Shared pytest fixtures for all tests."""

import pytest
4 changes: 4 additions & 0 deletions tests/test_smoke.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
def test_uipath_dev_has_developer_console() -> None:
from uipath.dev import UiPathDeveloperConsole

assert UiPathDeveloperConsole is not None