uipath 2.1.30__py3-none-any.whl → 2.1.31__py3-none-any.whl

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.
@@ -1,5 +1,6 @@
1
1
  import asyncio
2
2
  import json
3
+ import traceback
3
4
  from datetime import datetime
4
5
  from os import environ as env
5
6
  from pathlib import Path
@@ -12,7 +13,9 @@ from textual.containers import Container, Horizontal
12
13
  from textual.widgets import Button, ListView
13
14
 
14
15
  from ..._runtime._contracts import (
16
+ UiPathErrorContract,
15
17
  UiPathRuntimeContext,
18
+ UiPathRuntimeError,
16
19
  UiPathRuntimeFactory,
17
20
  )
18
21
  from ._components._details import RunDetailsPanel
@@ -159,11 +162,23 @@ class UiPathDevTerminal(App[Any]):
159
162
  run.status = "completed"
160
163
  run.end_time = datetime.now()
161
164
 
165
+ except UiPathRuntimeError as e:
166
+ error_msg = (
167
+ f"{e.error_info.code}: {e.error_info.title}\n{e.error_info.detail}"
168
+ )
169
+ self._add_error_log(run, error_msg)
170
+ run.status = "failed"
171
+ run.end_time = datetime.now()
172
+ run.error = e.error_info
173
+
162
174
  except Exception as e:
163
175
  error_msg = f"Execution failed: {str(e)}"
164
176
  self._add_error_log(run, error_msg)
165
177
  run.status = "failed"
166
178
  run.end_time = datetime.now()
179
+ run.error = UiPathErrorContract(
180
+ code="Unknown", title=str(e), detail=traceback.format_exc()
181
+ )
167
182
 
168
183
  self._update_run_in_history(run)
169
184
  self._update_run_details(run)
@@ -229,7 +229,10 @@ class RunDetailsPanel(Container):
229
229
  if hasattr(run, "error") and run.error:
230
230
  run_details_log.write("[bold red]ERROR:[/bold red]")
231
231
  run_details_log.write("[dim]" + "=" * 50 + "[/dim]")
232
- run_details_log.write(f"[red]{run.error}[/red]")
232
+ if run.error.code:
233
+ run_details_log.write(f"[red]Code: {run.error.code}[/red]")
234
+ run_details_log.write(f"[red]Title: {run.error.title}[/red]")
235
+ run_details_log.write(f"[red]\n{run.error.detail}[/red]")
233
236
  run_details_log.write("")
234
237
 
235
238
  # Additional metadata
@@ -272,34 +275,38 @@ class RunDetailsPanel(Container):
272
275
  spans_tree = self.query_one("#spans-tree", Tree)
273
276
  root = spans_tree.root
274
277
 
275
- # Group spans by parent relationship
276
- root_spans = []
277
- child_spans: Dict[str, List[TraceMessage]] = {}
278
-
279
- for trace_msg in trace_messages:
280
- if not trace_msg.parent_span_id:
281
- root_spans.append(trace_msg)
282
- else:
283
- if trace_msg.parent_span_id not in child_spans:
284
- child_spans[trace_msg.parent_span_id] = []
285
- child_spans[trace_msg.parent_span_id].append(trace_msg)
278
+ # Filter out spans without parents (artificial root spans)
279
+ spans_by_id = {
280
+ msg.span_id: msg for msg in trace_messages if msg.parent_span_id is not None
281
+ }
286
282
 
287
- # Build tree recursively
283
+ # Build parent-to-children mapping once upfront
284
+ children_by_parent: Dict[str, List[TraceMessage]] = {}
285
+ for msg in spans_by_id.values():
286
+ if msg.parent_span_id:
287
+ if msg.parent_span_id not in children_by_parent:
288
+ children_by_parent[msg.parent_span_id] = []
289
+ children_by_parent[msg.parent_span_id].append(msg)
290
+
291
+ # Find root spans (parent doesn't exist in our filtered data)
292
+ root_spans = [
293
+ msg
294
+ for msg in trace_messages
295
+ if msg.parent_span_id and msg.parent_span_id not in spans_by_id
296
+ ]
297
+
298
+ # Build tree recursively for each root span
288
299
  for root_span in sorted(root_spans, key=lambda x: x.timestamp):
289
- if root_span.span_id in child_spans:
290
- for child in sorted(
291
- child_spans[root_span.span_id], key=lambda x: x.timestamp
292
- ):
293
- self._add_span_node(root, child, child_spans)
300
+ self._add_span_with_children(root, root_span, children_by_parent)
294
301
 
295
- def _add_span_node(
302
+ def _add_span_with_children(
296
303
  self,
297
304
  parent_node: TreeNode[str],
298
305
  trace_msg: TraceMessage,
299
- child_spans: Dict[str, List[TraceMessage]],
306
+ children_by_parent: Dict[str, List[TraceMessage]],
300
307
  ):
301
- """Recursively add span nodes to the tree."""
302
- # Create display label for the span
308
+ """Recursively add a span and all its children."""
309
+ # Create the node for this span
303
310
  color_map = {
304
311
  "started": "🔵",
305
312
  "running": "🟡",
@@ -308,26 +315,20 @@ class RunDetailsPanel(Container):
308
315
  "error": "🔴",
309
316
  }
310
317
  status_icon = color_map.get(trace_msg.status.lower(), "⚪")
311
-
312
318
  duration_str = (
313
319
  f" ({trace_msg.duration_ms:.1f}ms)" if trace_msg.duration_ms else ""
314
320
  )
315
321
  label = f"{status_icon} {trace_msg.span_name}{duration_str}"
316
322
 
317
- # Add node to tree
318
323
  node = parent_node.add(label)
319
- node.data = trace_msg.span_id # Store span_id for reference
324
+ node.data = trace_msg.span_id
320
325
  self.span_tree_nodes[trace_msg.span_id] = node
321
-
322
326
  node.expand()
323
327
 
324
- # Add child spans (sorted by timestamp)
325
- if trace_msg.span_id in child_spans:
326
- sorted_children = sorted(
327
- child_spans[trace_msg.span_id], key=lambda x: x.timestamp
328
- )
329
- for child_span in sorted_children:
330
- self._add_span_node(node, child_span, child_spans)
328
+ # Get children from prebuilt mapping - O(1) lookup
329
+ children = children_by_parent.get(trace_msg.span_id, [])
330
+ for child in sorted(children, key=lambda x: x.timestamp):
331
+ self._add_span_with_children(node, child, children_by_parent)
331
332
 
332
333
  def on_tree_node_selected(self, event: Tree.NodeSelected[str]) -> None:
333
334
  """Handle span selection in the tree."""
@@ -3,6 +3,7 @@ from datetime import datetime
3
3
  from typing import List, Optional
4
4
  from uuid import uuid4
5
5
 
6
+ from ...._runtime._contracts import UiPathErrorContract
6
7
  from ._messages import LogMessage, TraceMessage
7
8
 
8
9
 
@@ -19,6 +20,7 @@ class ExecutionRun:
19
20
  self.status = "running" # running, completed, failed
20
21
  self.traces: List[TraceMessage] = []
21
22
  self.logs: List[LogMessage] = []
23
+ self.error: Optional[UiPathErrorContract] = None
22
24
 
23
25
  @property
24
26
  def duration(self) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uipath
3
- Version: 2.1.30
3
+ Version: 2.1.31
4
4
  Summary: Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools.
5
5
  Project-URL: Homepage, https://uipath.com
6
6
  Project-URL: Repository, https://github.com/UiPath/uipath-python
@@ -31,11 +31,11 @@ uipath/_cli/_auth/auth_config.json,sha256=UnAhdum8phjuZaZKE5KLp0IcPCbIltDEU1M_G8
31
31
  uipath/_cli/_auth/index.html,sha256=uGK0CDTP8Rys_p4O_Pbd2x4tz0frKNVcumjrXnal5Nc,22814
32
32
  uipath/_cli/_auth/localhost.crt,sha256=oGl9oLLOiouHubAt39B4zEfylFvKEtbtr_43SIliXJc,1226
33
33
  uipath/_cli/_auth/localhost.key,sha256=X31VYXD8scZtmGA837dGX5l6G-LXHLo5ItWJhZXaz3c,1679
34
- uipath/_cli/_dev/_terminal/__init__.py,sha256=lKmYSkiHivGPHa70dVktkZ4o0gX4ijnLMOVoT6Q2AtQ,8263
35
- uipath/_cli/_dev/_terminal/_components/_details.py,sha256=7tK7EpeInALfpkbhuQudbEZAavZ2ZnRESFcslzpUXWE,15208
34
+ uipath/_cli/_dev/_terminal/__init__.py,sha256=3dodd1MH9iIQG1timRtkuuMCk1QidDEjs3OWuPkLg3s,8790
35
+ uipath/_cli/_dev/_terminal/_components/_details.py,sha256=IR76fZn20ST2Cc7LonRGlWldL2dJl3QWSrS-QBWEOgQ,15476
36
36
  uipath/_cli/_dev/_terminal/_components/_history.py,sha256=bpIm2uLP9sIP6v4meN0i4Pk2xOwVwXI4iPrWpQIzlDc,1807
37
37
  uipath/_cli/_dev/_terminal/_components/_new.py,sha256=81FVClAl_ou8B861PsgwU5flXFfxYVOLEr5gCdKia8c,4450
38
- uipath/_cli/_dev/_terminal/_models/_execution.py,sha256=ZjlBQ0AiArHPkDQZr-2P-AYnadN7wuy1F2Xb7Jsu9Ek,1386
38
+ uipath/_cli/_dev/_terminal/_models/_execution.py,sha256=XbU5b3IJ3Y-XIlTxUd1cRbZUfSJw28XxpUWSRRZ69p8,1499
39
39
  uipath/_cli/_dev/_terminal/_models/_messages.py,sha256=TR7D1yLL0PNYGUMts_cGLgF8zj67urNwuX-5xSGqWgM,1762
40
40
  uipath/_cli/_dev/_terminal/_styles/terminal.tcss,sha256=k455ZxeB54hzPyH3CAj8VNLUtQPCCHr0IbTU1mqhD3U,5012
41
41
  uipath/_cli/_dev/_terminal/_traces/_exporter.py,sha256=oI6D_eMwrh_2aqDYUh4GrJg8VLGrLYhDahR-_o0uJns,4144
@@ -126,8 +126,8 @@ uipath/tracing/_traced.py,sha256=qeVDrds2OUnpdUIA0RhtF0kg2dlAZhyC1RRkI-qivTM,185
126
126
  uipath/tracing/_utils.py,sha256=wJRELaPu69iY0AhV432Dk5QYf_N_ViRU4kAUG1BI1ew,10384
127
127
  uipath/utils/__init__.py,sha256=VD-KXFpF_oWexFg6zyiWMkxl2HM4hYJMIUDZ1UEtGx0,105
128
128
  uipath/utils/_endpoints_manager.py,sha256=iRTl5Q0XAm_YgcnMcJOXtj-8052sr6jpWuPNz6CgT0Q,8408
129
- uipath-2.1.30.dist-info/METADATA,sha256=cdYoQSTtuOZwpUqBNnllIyY0sZ5sdI6upc7x9X7a8RM,6450
130
- uipath-2.1.30.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
131
- uipath-2.1.30.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
132
- uipath-2.1.30.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
133
- uipath-2.1.30.dist-info/RECORD,,
129
+ uipath-2.1.31.dist-info/METADATA,sha256=FNf2u5VRm05BzVqs-z97iBkeOsH_Y78fGNozWYXekxo,6450
130
+ uipath-2.1.31.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
131
+ uipath-2.1.31.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
132
+ uipath-2.1.31.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
133
+ uipath-2.1.31.dist-info/RECORD,,