Skip to content
Open
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath"
version = "2.8.31"
version = "2.8.32"
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
Expand Down
36 changes: 30 additions & 6 deletions src/uipath/_cli/_chat/_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
from typing import Any
from urllib.parse import urlparse

from pydantic import ValidationError

from uipath.core.chat import (
UiPathConversationEvent,
UiPathConversationExchangeEndEvent,
UiPathConversationExchangeEvent,
UiPathConversationGenericInterruptStartEvent,
UiPathConversationInterruptEndEvent,
UiPathConversationInterruptEvent,
UiPathConversationMessageEvent,
Expand Down Expand Up @@ -264,6 +267,32 @@ async def emit_interrupt_event(self, resume_trigger: UiPathResumeTrigger):
"Cannot emit interrupt event: api_resume is None"
)

# Try to parse as tool call confirmation first
try:
start_event = UiPathConversationToolCallConfirmationInterruptStartEvent(
type="uipath_cas_tool_call_confirmation",
value=UiPathConversationToolCallConfirmationValue(
**resume_trigger.api_resume.request
),
)
except Exception:
logger.info(
"Failed to parse as tool call confirmation, using generic interrupt"
)

# Wrap request in JSON if it's not already a dict
request_value = resume_trigger.api_resume.request
if not isinstance(request_value, dict):
request_value = {"value": request_value}

# Extract type from request
interrupt_type = request_value.get("type", "uipath_cas_generic")

start_event = UiPathConversationGenericInterruptStartEvent(
type=interrupt_type,
value=request_value,
)

interrupt_event = UiPathConversationEvent(
conversation_id=self.conversation_id,
exchange=UiPathConversationExchangeEvent(
Expand All @@ -272,12 +301,7 @@ async def emit_interrupt_event(self, resume_trigger: UiPathResumeTrigger):
message_id=self._current_message_id,
interrupt=UiPathConversationInterruptEvent(
interrupt_id=self._interrupt_id,
start=UiPathConversationToolCallConfirmationInterruptStartEvent(
type="uipath_cas_tool_call_confirmation",
value=UiPathConversationToolCallConfirmationValue(
**resume_trigger.api_resume.request
),
),
start=start_event,
),
),
),
Expand Down
Loading