uipath 2.1.86__py3-none-any.whl → 2.1.88__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.

Potentially problematic release.


This version of uipath might be problematic. Click here for more details.

uipath/_cli/__init__.py CHANGED
@@ -3,12 +3,11 @@ import sys
3
3
 
4
4
  import click
5
5
 
6
- from ._utils._common import load_environment_variables
6
+ from ._utils._common import add_cwd_to_path, load_environment_variables
7
7
  from .cli_auth import auth as auth
8
8
  from .cli_deploy import deploy as deploy # type: ignore
9
9
  from .cli_dev import dev as dev
10
10
  from .cli_eval import eval as eval # type: ignore
11
- from .cli_init import generate_agents_md as generate_agents_md # type: ignore
12
11
  from .cli_init import init as init # type: ignore
13
12
  from .cli_invoke import invoke as invoke # type: ignore
14
13
  from .cli_new import new as new # type: ignore
@@ -46,6 +45,7 @@ def _get_safe_version() -> str:
46
45
  )
47
46
  def cli(lv: bool, v: bool) -> None:
48
47
  load_environment_variables()
48
+ add_cwd_to_path()
49
49
  if lv:
50
50
  try:
51
51
  version = importlib.metadata.version("uipath-langchain")
@@ -9,6 +9,14 @@ from ..._utils.constants import DOTENV_FILE
9
9
  from ..spinner import Spinner
10
10
 
11
11
 
12
+ def add_cwd_to_path():
13
+ import sys
14
+
15
+ cwd = os.getcwd()
16
+ if cwd not in sys.path:
17
+ sys.path.insert(0, cwd)
18
+
19
+
12
20
  def environment_options(function):
13
21
  function = click.option(
14
22
  "--alpha",
@@ -2,6 +2,7 @@ import importlib.util
2
2
  import inspect
3
3
  import sys
4
4
  from dataclasses import fields, is_dataclass
5
+ from enum import Enum
5
6
  from types import ModuleType
6
7
  from typing import (
7
8
  Any,
@@ -16,11 +17,11 @@ from typing import (
16
17
 
17
18
  from pydantic import BaseModel
18
19
 
19
- SchemaType = Literal["object", "integer", "double", "string", "boolean", "array"]
20
+ SchemaType = Literal["object", "integer", "number", "string", "boolean", "array"]
20
21
 
21
22
  TYPE_MAP: Dict[str, SchemaType] = {
22
23
  "int": "integer",
23
- "float": "double",
24
+ "float": "number",
24
25
  "str": "string",
25
26
  "bool": "boolean",
26
27
  "list": "array",
@@ -52,7 +53,25 @@ def get_type_schema(type_hint: Any) -> Dict[str, Any]:
52
53
  return {"type": "object"}
53
54
 
54
55
  if inspect.isclass(type_hint):
55
- # Handle Pydantic models
56
+ if issubclass(type_hint, Enum):
57
+ enum_values = [member.value for member in type_hint]
58
+ if not enum_values:
59
+ return {"type": "string", "enum": []}
60
+
61
+ first_value = enum_values[0]
62
+ if isinstance(first_value, str):
63
+ enum_type = "string"
64
+ elif isinstance(first_value, int):
65
+ enum_type = "integer"
66
+ elif isinstance(first_value, float):
67
+ enum_type = "number"
68
+ elif isinstance(first_value, bool):
69
+ enum_type = "boolean"
70
+ else:
71
+ enum_type = "string"
72
+
73
+ return {"type": enum_type, "enum": enum_values}
74
+
56
75
  if issubclass(type_hint, BaseModel):
57
76
  properties = {}
58
77
  required = []
uipath/_cli/cli_init.py CHANGED
@@ -1,6 +1,7 @@
1
1
  # type: ignore
2
2
  import importlib.resources
3
3
  import json
4
+ import logging
4
5
  import os
5
6
  import shutil
6
7
  import uuid
@@ -18,6 +19,7 @@ from ._utils._parse_ast import generate_bindings_json
18
19
  from .middlewares import Middlewares
19
20
 
20
21
  console = ConsoleLogger()
22
+ logger = logging.getLogger(__name__)
21
23
 
22
24
  CONFIG_PATH = "uipath.json"
23
25
 
@@ -55,35 +57,34 @@ def generate_env_file(target_directory):
55
57
  relative_path = os.path.relpath(env_path, target_directory)
56
58
  with open(env_path, "w"):
57
59
  pass
58
- console.success(f" Created '{relative_path}' file.")
60
+ console.success(f"Created '{relative_path}' file.")
59
61
 
60
62
 
61
- def generate_agents_md(target_directory: str) -> None:
62
- """Generate AGENTS.md file from the packaged resource.
63
+ def generate_agent_specific_file_md(target_directory: str, file_name: str) -> None:
64
+ """Generate an agent-specific file from the packaged resource.
63
65
 
64
66
  Args:
65
- target_directory: The directory where AGENTS.md should be created.
67
+ target_directory: The directory where the file should be created.
68
+ file_name: The name of the file should be created.
66
69
  """
67
- target_path = os.path.join(target_directory, "AGENTS.md")
70
+ agent_dir = os.path.join(target_directory, ".agent")
71
+ os.makedirs(agent_dir, exist_ok=True)
72
+
73
+ target_path = os.path.join(agent_dir, file_name)
68
74
 
69
- # Skip if file already exists
70
75
  if os.path.exists(target_path):
71
- console.info("Skipping 'AGENTS.md' creation as it already exists.")
76
+ logger.debug(f"File '.agent/{target_path}' already exists.")
72
77
  return
73
78
 
74
79
  try:
75
- # Get the resource path using importlib.resources
76
- source_path = importlib.resources.files("uipath._resources").joinpath(
77
- "AGENTS.md"
78
- )
80
+ source_path = importlib.resources.files("uipath._resources").joinpath(file_name)
79
81
 
80
- # Copy the file to the target directory
81
82
  with importlib.resources.as_file(source_path) as s_path:
82
83
  shutil.copy(s_path, target_path)
83
84
 
84
- console.success(" Created 'AGENTS.md' file.")
85
+ console.success(f"Created '{f'.agent/{file_name}'}' file.")
85
86
  except Exception as e:
86
- console.warning(f"Could not create AGENTS.md: {e}")
87
+ console.warning(f"Could not create {file_name}: {e}")
87
88
 
88
89
 
89
90
  def get_existing_settings(config_path: str) -> Optional[Dict[str, Any]]:
@@ -160,7 +161,11 @@ def init(entrypoint: str, infer_bindings: bool) -> None:
160
161
  current_directory = os.getcwd()
161
162
  generate_env_file(current_directory)
162
163
  create_telemetry_config_file(current_directory)
163
- generate_agents_md(current_directory)
164
+ generate_agent_specific_file_md(current_directory, "AGENTS.md")
165
+ generate_agent_specific_file_md(current_directory, "CLI_REFERENCE.md")
166
+ generate_agent_specific_file_md(current_directory, "REQUIRED_STRUCTURE.md")
167
+ generate_agent_specific_file_md(current_directory, "SDK_REFERENCE.md")
168
+ generate_agent_specific_file_md(current_directory, "CLAUDE.md")
164
169
 
165
170
  result = Middlewares.next(
166
171
  "init",