Skip to content

Commit 82f8e54

Browse files
authored
fix: restore interrupt event compat shims in uipath-core (#1599) (#1600)
1 parent 97fb1a4 commit 82f8e54

6 files changed

Lines changed: 153 additions & 4 deletions

File tree

packages/uipath-core/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-core"
3-
version = "0.5.13"
3+
version = "0.5.14"
44
description = "UiPath Core abstractions"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

packages/uipath-core/src/uipath/core/chat/__init__.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,20 @@
7777
UiPathConversationExchangeEvent,
7878
UiPathConversationExchangeStartEvent,
7979
)
80+
from .interrupt import (
81+
InterruptTypeEnum,
82+
UiPathConversationGenericInterruptEndEvent,
83+
UiPathConversationGenericInterruptStartEvent,
84+
UiPathConversationInterrupt,
85+
UiPathConversationInterruptData,
86+
UiPathConversationInterruptEndEvent,
87+
UiPathConversationInterruptEvent,
88+
UiPathConversationInterruptStartEvent,
89+
UiPathConversationToolCallConfirmationEndValue,
90+
UiPathConversationToolCallConfirmationInterruptEndEvent,
91+
UiPathConversationToolCallConfirmationInterruptStartEvent,
92+
UiPathConversationToolCallConfirmationValue,
93+
)
8094
from .message import (
8195
UiPathConversationMessage,
8296
UiPathConversationMessageData,
@@ -177,4 +191,17 @@
177191
"UiPathVoiceToolCallRequest",
178192
"UiPathVoiceToolCallMessage",
179193
"UiPathVoiceToolCallResult",
194+
# Interrupt (compat shims — deprecated, see interrupt.py)
195+
"InterruptTypeEnum",
196+
"UiPathConversationInterruptStartEvent",
197+
"UiPathConversationInterruptEndEvent",
198+
"UiPathConversationInterruptEvent",
199+
"UiPathConversationInterruptData",
200+
"UiPathConversationInterrupt",
201+
"UiPathConversationGenericInterruptStartEvent",
202+
"UiPathConversationGenericInterruptEndEvent",
203+
"UiPathConversationToolCallConfirmationValue",
204+
"UiPathConversationToolCallConfirmationEndValue",
205+
"UiPathConversationToolCallConfirmationInterruptStartEvent",
206+
"UiPathConversationToolCallConfirmationInterruptEndEvent",
180207
]
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
"""Compatibility shims for legacy interrupt event types.
2+
3+
The interrupt-based tool-call confirmation flow was replaced by `confirmToolCall`
4+
on the tool call event itself (see PR #1558). The original `interrupt.py` was
5+
removed in `uipath-core` 0.5.13, but published `uipath-runtime` versions still
6+
import these names at module load time, breaking installs that pull the new
7+
`uipath-core` alongside an older runtime.
8+
9+
These shims keep those imports working. They are not used by current code paths
10+
and should be removed in the next minor bump of `uipath-core`.
11+
"""
12+
13+
from enum import Enum
14+
from typing import Any, Literal, Union
15+
16+
from pydantic import BaseModel, ConfigDict, Field
17+
18+
19+
class InterruptTypeEnum(str, Enum):
20+
"""Enum of known interrupt types."""
21+
22+
TOOL_CALL_CONFIRMATION = "uipath_cas_tool_call_confirmation"
23+
24+
25+
class UiPathConversationToolCallConfirmationValue(BaseModel):
26+
"""Schema for tool call confirmation interrupt value."""
27+
28+
tool_call_id: str = Field(..., alias="toolCallId")
29+
tool_name: str = Field(..., alias="toolName")
30+
input_schema: Any = Field(..., alias="inputSchema")
31+
input_value: Any | None = Field(None, alias="inputValue")
32+
33+
model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)
34+
35+
36+
class UiPathConversationToolCallConfirmationInterruptStartEvent(BaseModel):
37+
"""Tool call confirmation interrupt start event with strong typing."""
38+
39+
type: Literal["uipath_cas_tool_call_confirmation"]
40+
value: UiPathConversationToolCallConfirmationValue
41+
42+
model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)
43+
44+
45+
class UiPathConversationGenericInterruptStartEvent(BaseModel):
46+
"""Generic interrupt start event for custom interrupt types."""
47+
48+
type: str
49+
value: Any
50+
51+
model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)
52+
53+
54+
UiPathConversationInterruptStartEvent = Union[
55+
UiPathConversationToolCallConfirmationInterruptStartEvent,
56+
UiPathConversationGenericInterruptStartEvent,
57+
]
58+
59+
60+
class UiPathConversationToolCallConfirmationEndValue(BaseModel):
61+
"""Schema for tool call confirmation end value."""
62+
63+
approved: bool
64+
input: Any | None = None
65+
66+
model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)
67+
68+
69+
class UiPathConversationToolCallConfirmationInterruptEndEvent(BaseModel):
70+
"""Tool call confirmation interrupt end event with strong typing."""
71+
72+
type: Literal["uipath_cas_tool_call_confirmation"]
73+
value: UiPathConversationToolCallConfirmationEndValue
74+
75+
model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)
76+
77+
78+
class UiPathConversationGenericInterruptEndEvent(BaseModel):
79+
"""Generic interrupt end event for custom interrupt types."""
80+
81+
type: str
82+
value: Any
83+
84+
model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)
85+
86+
87+
UiPathConversationInterruptEndEvent = Union[
88+
UiPathConversationToolCallConfirmationInterruptEndEvent,
89+
UiPathConversationGenericInterruptEndEvent,
90+
]
91+
92+
93+
class UiPathConversationInterruptEvent(BaseModel):
94+
"""Encapsulates interrupt-related events within a message."""
95+
96+
interrupt_id: str = Field(..., alias="interruptId")
97+
start: UiPathConversationInterruptStartEvent | None = Field(
98+
None, alias="startInterrupt"
99+
)
100+
end: UiPathConversationInterruptEndEvent | None = Field(None, alias="endInterrupt")
101+
102+
model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)
103+
104+
105+
class UiPathConversationInterruptData(BaseModel):
106+
"""Core data of an interrupt within a message."""
107+
108+
type: str
109+
interrupt_value: Any = Field(..., alias="interruptValue")
110+
end_value: Any | None = Field(None, alias="endValue")
111+
112+
model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)
113+
114+
115+
class UiPathConversationInterrupt(UiPathConversationInterruptData):
116+
"""An interrupt within a message — a pause point where the agent needs external input."""
117+
118+
interrupt_id: str = Field(..., alias="interruptId")
119+
created_at: str = Field(..., alias="createdAt")
120+
updated_at: str = Field(..., alias="updatedAt")
121+
122+
model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)

packages/uipath-core/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uipath-platform/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uipath/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)