alita-sdk 0.3.192__py3-none-any.whl → 0.3.194__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.
- alita_sdk/runtime/llms/alita.py +1 -1
- alita_sdk/tools/ado/test_plan/__init__.py +2 -0
- alita_sdk/tools/ado/wiki/__init__.py +11 -3
- alita_sdk/tools/ado/work_item/__init__.py +10 -3
- alita_sdk/tools/memory/__init__.py +1 -0
- alita_sdk/tools/slack/__init__.py +30 -10
- alita_sdk/tools/slack/api_wrapper.py +7 -14
- alita_sdk/tools/zephyr_squad/__init__.py +5 -6
- alita_sdk/tools/zephyr_squad/api_wrapper.py +186 -2
- alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py +57 -17
- {alita_sdk-0.3.192.dist-info → alita_sdk-0.3.194.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.192.dist-info → alita_sdk-0.3.194.dist-info}/RECORD +15 -15
- {alita_sdk-0.3.192.dist-info → alita_sdk-0.3.194.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.192.dist-info → alita_sdk-0.3.194.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.192.dist-info → alita_sdk-0.3.194.dist-info}/top_level.txt +0 -0
alita_sdk/runtime/llms/alita.py
CHANGED
@@ -139,7 +139,7 @@ class AlitaChatModel(BaseChatModel):
|
|
139
139
|
else:
|
140
140
|
message = _convert_delta_to_message_chunk(chunk, default_chunk_class)
|
141
141
|
finish_reason = None
|
142
|
-
generation_info = ()
|
142
|
+
generation_info = dict()
|
143
143
|
if stop:
|
144
144
|
for stop_word in stop:
|
145
145
|
if stop_word in message.content:
|
@@ -26,9 +26,17 @@ class AzureDevOpsWikiToolkit(BaseToolkit):
|
|
26
26
|
'max_toolkit_length': AzureDevOpsWikiToolkit.toolkit_max_length})
|
27
27
|
),
|
28
28
|
organization_url=(str, Field(title="Organization URL",
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
description="ADO organization url", json_schema_extra={
|
30
|
+
'configuration': True,
|
31
|
+
})),
|
32
|
+
project=(str, Field(description="ADO project",
|
33
|
+
json_schema_extra={
|
34
|
+
'configuration': True
|
35
|
+
})),
|
36
|
+
token=(SecretStr,
|
37
|
+
Field(description="ADO token",
|
38
|
+
json_schema_extra={'secret': True, 'configuration': True }
|
39
|
+
)),
|
32
40
|
selected_tools=(List[Literal[tuple(selected_tools)]],
|
33
41
|
Field(default=[], json_schema_extra={'args_schemas': selected_tools})),
|
34
42
|
__config__={
|
@@ -25,9 +25,16 @@ class AzureDevOpsWorkItemsToolkit(BaseToolkit):
|
|
25
25
|
'max_toolkit_length': AzureDevOpsWorkItemsToolkit.toolkit_max_length})
|
26
26
|
),
|
27
27
|
organization_url=(str, Field(title="Organization URL",
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
description="ADO organization url",
|
29
|
+
json_schema_extra={
|
30
|
+
'configuration': True
|
31
|
+
})),
|
32
|
+
project=(str, Field(description="ADO project",
|
33
|
+
json_schema_extra={
|
34
|
+
'configuration': True
|
35
|
+
}
|
36
|
+
)),
|
37
|
+
token=(SecretStr, Field(description="ADO token", json_schema_extra={'secret': True, 'configuration': True})),
|
31
38
|
limit=(Optional[int], Field(description="ADO plans limit used for limitation of the list with results", default=5)),
|
32
39
|
selected_tools=(List[Literal[tuple(selected_tools)]], Field(default=[], json_schema_extra={'args_schemas': selected_tools})),
|
33
40
|
__config__={
|
@@ -1,11 +1,17 @@
|
|
1
1
|
from typing import List, Optional, Literal
|
2
2
|
|
3
|
+
import logging
|
4
|
+
|
5
|
+
logger = logging.getLogger(__name__)
|
6
|
+
|
3
7
|
from langchain_core.tools import BaseToolkit, BaseTool
|
4
8
|
from pydantic import create_model, BaseModel, Field, SecretStr
|
5
9
|
from ..base.tool import BaseAction
|
6
10
|
|
7
11
|
from .api_wrapper import SlackApiWrapper
|
8
|
-
from ..utils import TOOLKIT_SPLITTER, clean_string, get_max_toolkit_length
|
12
|
+
from ..utils import TOOLKIT_SPLITTER, clean_string, get_max_toolkit_length, check_connection_response
|
13
|
+
from slack_sdk.errors import SlackApiError
|
14
|
+
from slack_sdk import WebClient
|
9
15
|
|
10
16
|
name = "slack"
|
11
17
|
|
@@ -24,15 +30,30 @@ class SlackToolkit(BaseToolkit):
|
|
24
30
|
def toolkit_config_schema() -> BaseModel:
|
25
31
|
selected_tools = {x['name']: x['args_schema'].schema() for x in SlackApiWrapper.model_construct().get_available_tools()}
|
26
32
|
SlackToolkit.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
27
|
-
|
33
|
+
|
34
|
+
@check_connection_response
|
35
|
+
def check_connection(self):
|
36
|
+
"""
|
37
|
+
Checks the connection to Slack using the provided token.
|
38
|
+
Returns the response from Slack's auth.test endpoint.
|
39
|
+
"""
|
40
|
+
try:
|
41
|
+
response = WebClient(token=self.slack_token.get_secret_value()).auth_test()
|
42
|
+
logger.info("Slack connection successful: %s", response)
|
43
|
+
return {"success": True, "response": response}
|
44
|
+
except SlackApiError as e:
|
45
|
+
logger.error(f"Slack connection failed: {e.response['error']}")
|
46
|
+
return {"success": False, "error": e.response['error']}
|
47
|
+
|
48
|
+
model = create_model(
|
28
49
|
name,
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
50
|
+
slack_token=(SecretStr, Field(description="Slack Token like XOXB-*****-*****-*****-*****", json_schema_extra={'secret': True, 'configuration': True})),
|
51
|
+
channel_id=(str, Field( description="Channel ID", json_schema_extra={'configuration': True})),
|
52
|
+
selected_tools=(list[str], Field( description="List of tools to enable", default=[],json_schema_extra={'args_schemas': selected_tools})),
|
53
|
+
__config__={'json_schema_extra': {'metadata': {"label": "Slack", "icon_url": None}}}
|
54
|
+
)
|
55
|
+
model.check_connection = check_connection
|
56
|
+
return model
|
36
57
|
|
37
58
|
@classmethod
|
38
59
|
def get_toolkit(cls, selected_tools: Optional[List[str]] = None, toolkit_name: Optional[str] = None, **kwargs):
|
@@ -50,7 +71,6 @@ class SlackToolkit(BaseToolkit):
|
|
50
71
|
name=prefix + tool["name"],
|
51
72
|
description=tool["description"],
|
52
73
|
args_schema=tool["args_schema"],
|
53
|
-
func=tool["ref"]
|
54
74
|
))
|
55
75
|
return cls(tools=tools)
|
56
76
|
|
@@ -38,27 +38,19 @@ class SlackApiWrapper(BaseToolApiWrapper):
|
|
38
38
|
slack_token: Optional[SecretStr] = Field(default=None,description="Slack Bot/User OAuth Token like XOXB-*****-*****-*****-*****")
|
39
39
|
channel_id: Optional[str] = Field(default=None, description="Channel ID, user ID, or conversation ID to send the message to. (like C12345678 for public channels, D12345678 for DMs)")
|
40
40
|
|
41
|
-
@model_validator(mode="
|
41
|
+
@model_validator(mode="before")
|
42
42
|
@classmethod
|
43
43
|
def validate_toolkit(cls, values):
|
44
|
-
token = values.slack_token
|
44
|
+
token = values.get("slack_token")
|
45
45
|
if not token:
|
46
|
-
|
47
|
-
raise ValueError("Slack token is required.")
|
48
|
-
try:
|
49
|
-
cls._client = WebClient(token=token)
|
50
|
-
logging.info("Authenticated with Slack token.")
|
51
|
-
except Exception as e:
|
52
|
-
logging.error(f"Failed to authenticate with Slack: {str(e)}")
|
53
|
-
raise ValueError(f"Failed to authenticate with Slack: {str(e)}")
|
46
|
+
logger.error("Slack token is required for authentication.")
|
47
|
+
raise ValueError("Slack token is required for authentication.")
|
54
48
|
return values
|
55
|
-
|
56
49
|
def _get_client(self):
|
57
|
-
if not self._client:
|
50
|
+
if not hasattr(self, "_client") or self._client is None:
|
58
51
|
self._client = WebClient(token=self.slack_token.get_secret_value())
|
59
52
|
return self._client
|
60
|
-
|
61
|
-
|
53
|
+
|
62
54
|
def send_message(self, message: str):
|
63
55
|
"""
|
64
56
|
Sends a message to a specified Slack channel, user, or conversation.
|
@@ -85,6 +77,7 @@ class SlackApiWrapper(BaseToolApiWrapper):
|
|
85
77
|
try:
|
86
78
|
|
87
79
|
client = self._get_client()
|
80
|
+
logger.info(f"auth test: {client.auth_test()}")
|
88
81
|
# Fetch conversation history
|
89
82
|
response = client.conversations_history(
|
90
83
|
channel=self.channel_id,
|
@@ -1,14 +1,13 @@
|
|
1
1
|
from typing import List, Literal, Optional
|
2
2
|
|
3
|
-
from
|
4
|
-
from langchain_core.tools import BaseTool
|
3
|
+
from langchain_core.tools import BaseToolkit, BaseTool
|
5
4
|
from pydantic import create_model, BaseModel, Field, SecretStr
|
6
5
|
|
7
6
|
from .api_wrapper import ZephyrSquadApiWrapper
|
8
7
|
from ..base.tool import BaseAction
|
9
8
|
from ..utils import clean_string, TOOLKIT_SPLITTER, get_max_toolkit_length
|
10
9
|
|
11
|
-
name = "
|
10
|
+
name = "zephyr_squad"
|
12
11
|
|
13
12
|
def get_tools(tool):
|
14
13
|
return ZephyrSquadToolkit().get_toolkit(
|
@@ -28,10 +27,10 @@ class ZephyrSquadToolkit(BaseToolkit):
|
|
28
27
|
selected_tools = {x['name']: x['args_schema'].schema() for x in ZephyrSquadApiWrapper.model_construct().get_available_tools()}
|
29
28
|
ZephyrSquadToolkit.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
30
29
|
return create_model(
|
31
|
-
|
30
|
+
name,
|
32
31
|
account_id=(str, Field(description="AccountID for the user that is going to be authenticating")),
|
33
|
-
access_key=(
|
34
|
-
secret_key=(SecretStr, Field(description="Generated secret key")),
|
32
|
+
access_key=(SecretStr, Field(description="Generated access key", json_schema_extra={'secret': True})),
|
33
|
+
secret_key=(SecretStr, Field(description="Generated secret key", json_schema_extra={'secret': True})),
|
35
34
|
selected_tools=(List[Literal[tuple(selected_tools)]], Field(default=[], json_schema_extra={'args_schemas': selected_tools})),
|
36
35
|
__config__={'json_schema_extra': {'metadata': {"label": "Zephyr Squad", "icon_url": "zephyr.svg",
|
37
36
|
"categories": ["test management"],
|
@@ -55,6 +55,42 @@ class ZephyrSquadApiWrapper(BaseToolApiWrapper):
|
|
55
55
|
"""Retrieve all possible statuses for test steps in Jira."""
|
56
56
|
return self._client.get_all_test_step_statuses()
|
57
57
|
|
58
|
+
def get_bdd_content(self, issue_id):
|
59
|
+
"""Retrieve BDD (Gherkin) content of an issue (feature or scenario)."""
|
60
|
+
return self._client.get_bdd_content(issue_id)
|
61
|
+
|
62
|
+
def update_bdd_content(self, issue_id, new_content):
|
63
|
+
"""Replace BDD (Gherkin) content of an issue (feature or scenario)."""
|
64
|
+
return self._client.update_bdd_content(issue_id, new_content)
|
65
|
+
|
66
|
+
def delete_bdd_content(self, issue_id):
|
67
|
+
"""Remove BDD (Gherkin) content of an issue (feature or scenario)."""
|
68
|
+
return self._client.delete_bdd_content(issue_id)
|
69
|
+
|
70
|
+
def create_new_cycle(self, json):
|
71
|
+
"""Creates a Cycle from a JSON representation. If no VersionId is passed in the request, it will be defaulted to an unscheduled version"""
|
72
|
+
return self._client.create_new_cycle(json)
|
73
|
+
|
74
|
+
def create_folder(self, json):
|
75
|
+
"""Creates a Folder from a JSON representation. Folder names within a cycle needs to be unique."""
|
76
|
+
return self._client.create_folder(json)
|
77
|
+
|
78
|
+
def add_test_to_cycle(self, cycle_id, json):
|
79
|
+
"""Adds Tests(s) to a Cycle."""
|
80
|
+
return self._client.add_test_to_cycle(cycle_id, json)
|
81
|
+
|
82
|
+
def add_test_to_folder(self, folder_id, json):
|
83
|
+
"""Adds Tests(s) to a Folder."""
|
84
|
+
return self._client.add_test_to_folder(folder_id, json)
|
85
|
+
|
86
|
+
def create_execution(self, json):
|
87
|
+
"""Creates an execution from a JSON representation."""
|
88
|
+
return self._client.create_execution(json)
|
89
|
+
|
90
|
+
def get_execution(self, execution_id, issue_id, project_id):
|
91
|
+
"""Retrieves Execution and ExecutionStatus by ExecutionId"""
|
92
|
+
return self._client.get_execution(execution_id, issue_id, project_id)
|
93
|
+
|
58
94
|
def get_available_tools(self):
|
59
95
|
return [
|
60
96
|
{
|
@@ -92,14 +128,73 @@ class ZephyrSquadApiWrapper(BaseToolApiWrapper):
|
|
92
128
|
"description": self.get_all_test_step_statuses.__doc__,
|
93
129
|
"args_schema": create_model("NoInput"),
|
94
130
|
"ref": self.get_all_test_step_statuses,
|
131
|
+
},
|
132
|
+
{
|
133
|
+
"name": "get_bdd_content",
|
134
|
+
"description": self.get_bdd_content.__doc__,
|
135
|
+
"args_schema": Issue,
|
136
|
+
"ref": self.get_bdd_content,
|
137
|
+
},
|
138
|
+
{
|
139
|
+
"name": "update_bdd_content",
|
140
|
+
"description": self.update_bdd_content.__doc__,
|
141
|
+
"args_schema": UpdateBddContent,
|
142
|
+
"ref": self.update_bdd_content,
|
143
|
+
},
|
144
|
+
{
|
145
|
+
"name": "delete_bdd_content",
|
146
|
+
"description": self.delete_bdd_content.__doc__,
|
147
|
+
"args_schema": Issue,
|
148
|
+
"ref": self.delete_bdd_content,
|
149
|
+
},
|
150
|
+
{
|
151
|
+
"name": "create_new_cycle",
|
152
|
+
"description": self.create_new_cycle.__doc__,
|
153
|
+
"args_schema": CycleJson,
|
154
|
+
"ref": self.create_new_cycle,
|
155
|
+
},
|
156
|
+
{
|
157
|
+
"name": "create_folder",
|
158
|
+
"description": self.create_folder.__doc__,
|
159
|
+
"args_schema": FolderJson,
|
160
|
+
"ref": self.create_folder,
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"name": "add_test_to_cycle",
|
164
|
+
"description": self.add_test_to_cycle.__doc__,
|
165
|
+
"args_schema": TestToCycle,
|
166
|
+
"ref": self.add_test_to_cycle,
|
167
|
+
},
|
168
|
+
{
|
169
|
+
"name": "add_test_to_folder",
|
170
|
+
"description": self.add_test_to_folder.__doc__,
|
171
|
+
"args_schema": TestToFolder,
|
172
|
+
"ref": self.add_test_to_folder,
|
173
|
+
},
|
174
|
+
{
|
175
|
+
"name": "create_execution",
|
176
|
+
"description": self.create_execution.__doc__,
|
177
|
+
"args_schema": ExecutionJson,
|
178
|
+
"ref": self.create_execution,
|
179
|
+
},
|
180
|
+
{
|
181
|
+
"name": "get_execution",
|
182
|
+
"description": self.get_execution.__doc__,
|
183
|
+
"args_schema": GetExecution,
|
184
|
+
"ref": self.get_execution,
|
95
185
|
}
|
96
186
|
]
|
97
187
|
|
98
188
|
|
189
|
+
Issue = create_model(
|
190
|
+
"Issue",
|
191
|
+
issue_id=(int, Field(description="Jira ticket id of test case."))
|
192
|
+
)
|
193
|
+
|
99
194
|
ProjectIssue = create_model(
|
100
195
|
"ProjectIssue",
|
101
|
-
|
102
|
-
|
196
|
+
project_id=(int, Field(description="Jira project id to which test case belongs.")),
|
197
|
+
__base__=Issue
|
103
198
|
)
|
104
199
|
|
105
200
|
ProjectIssueStep = create_model(
|
@@ -133,3 +228,92 @@ CreateNewTestStep = create_model(
|
|
133
228
|
"*IMPORTANT*: Use double quotes for all field names and string values."))),
|
134
229
|
__base__=ProjectIssue
|
135
230
|
)
|
231
|
+
|
232
|
+
UpdateBddContent = create_model(
|
233
|
+
"UpdateTestStep",
|
234
|
+
new_content=(str, Field(description=(
|
235
|
+
"String containing a Gherkin scenario or a feature background.\n"
|
236
|
+
"New lines must be encoded as \\n or \\r\\n, and other characters that have special meaning in JSON strings must be escaped accordingly"))),
|
237
|
+
__base__=Issue
|
238
|
+
)
|
239
|
+
|
240
|
+
CycleJson = create_model(
|
241
|
+
"CycleJson",
|
242
|
+
json=(str, Field(description=(
|
243
|
+
"JSON body to create a Zephyr test cycle. Fields:\n"
|
244
|
+
"- name (string, required): Test cycle name. Example: \"Test Cycle\"\n"
|
245
|
+
"- build (string, optional): Build name. Example: \"build 1.0\"\n"
|
246
|
+
"- environment (string, optional): Environment name. Example: \"Bug Fix\"\n"
|
247
|
+
"- description (string, optional): Cycle description. Example: \"This contains the zephyr tests for a version\"\n"
|
248
|
+
"- startDate (long, optional): Start date as a Unix timestamp. Example: 1485278607\n"
|
249
|
+
"- endDate (long, optional): End date as a Unix timestamp. Example: 1485302400\n"
|
250
|
+
"- projectId (integer, required): Project ID. Example: 10100\n"
|
251
|
+
"- versionId (integer, required): Version ID. Example: 10000\n"
|
252
|
+
"*IMPORTANT*: Use double quotes for all field names and string values.")))
|
253
|
+
)
|
254
|
+
|
255
|
+
FolderJson = create_model(
|
256
|
+
"FolderJson",
|
257
|
+
json=(str, Field(description=(
|
258
|
+
"JSON body to create a Zephyr folder. Fields:\n"
|
259
|
+
"- name (string, required): Folder name. Example: \"Folder 01\"\n"
|
260
|
+
"- description (string, optional): Folder description. Example: \"Create New Folder\"\n"
|
261
|
+
"- cycleId (string, required): Cycle ID. Example: \"0001513838430954-242ac112-0001\"\n"
|
262
|
+
"- projectId (integer, required): Project ID. Example: 10100\n"
|
263
|
+
"- versionId (integer, required): Version ID. Example: 10000\n"
|
264
|
+
"*IMPORTANT*: Use double quotes for all field names and string values.")))
|
265
|
+
)
|
266
|
+
|
267
|
+
ExecutionJson = create_model(
|
268
|
+
"ExecutionJson",
|
269
|
+
json=(str, Field(description=(
|
270
|
+
"JSON body for Zephyr operation. Fields:\n"
|
271
|
+
"- status (object, optional): Status object. Example: {\"id\": 1}\n"
|
272
|
+
"- id (string, optional): Unique identifier. Example: \"0001456664462103-5aoee13a3fob-0001\"\n"
|
273
|
+
"- projectId (integer, required): Project ID. Example: 10000\n"
|
274
|
+
"- issueId (integer, required): Issue ID. Example: 10000\n"
|
275
|
+
"- cycleId (string, optional): Cycle ID. Example: \"0001456664262308-5a6ee13a3f6b-0001\"\n"
|
276
|
+
"- versionId (integer, required): Version ID. Example: -1\n"
|
277
|
+
"- assigneeType (string, optional): \"currentUser\" or \"assignee\". Example: \"assignee\"\n"
|
278
|
+
"- assignee (string, optional): Assignee name if assigneeType is \"assignee\". Example: \"jiraUserKey\"\n"
|
279
|
+
"*IMPORTANT*: Use double quotes for all field names and string values.")))
|
280
|
+
)
|
281
|
+
|
282
|
+
TestToCycle = create_model(
|
283
|
+
"TestToCycle",
|
284
|
+
step_id=(str, Field(description="Test step id to operate.")),
|
285
|
+
json=(str, Field(description=(
|
286
|
+
"JSON body for Zephyr operation. Fields:\n"
|
287
|
+
"- issues (array[string], required if method=1): List of Jira issue keys. Example: [\"TEST-1\"]\n"
|
288
|
+
"- jql (string, required if method=2): JQL query string. Example: \"project = DEMO AND type = Test AND reporter = admin\"\n"
|
289
|
+
"- versionId (integer, required): Version ID. Example: -1\n"
|
290
|
+
"- projectId (integer, required): Project ID. Example: 10000\n"
|
291
|
+
"- fromVersionId (integer, required if method=3): Source Version ID. Example: -1\n"
|
292
|
+
"- fromCycleId (string, required if method=3): Source Cycle ID. Example: \"-0001484006184518-242ac112-0001\"\n"
|
293
|
+
"- statuses (string, optional, used when method=3): Statuses. Example: \"-1\"\n"
|
294
|
+
"- priorities (string, optional, used when method=3): Priorities (comma-separated). Example: \"1,4\"\n"
|
295
|
+
"- labels (string, optional, used when method=3): Labels (comma-separated). Example: \"-High,dock\"\n"
|
296
|
+
"- method (string, required): Operation method. Example: \"1\"\n"
|
297
|
+
"*IMPORTANT*: Use double quotes for all field names and string values.")))
|
298
|
+
)
|
299
|
+
|
300
|
+
TestToFolder = create_model(
|
301
|
+
"TestToFolder",
|
302
|
+
step_id=(str, Field(description="folderId of Execution.")),
|
303
|
+
json=(str, Field(description=(
|
304
|
+
"JSON body to update a Zephyr test step. Fields:\n"
|
305
|
+
"- issues (array[string], required): List of Jira issue keys. Example: [\"FSC-2\", \"FSC-3\"]\n"
|
306
|
+
"- assigneeType (string, required): Type of assignee. Example: \"currentUser\"\n"
|
307
|
+
"- method (integer, required): Method identifier. Example: 1\n"
|
308
|
+
"- versionId (integer, required): Version ID. Example: 12829\n"
|
309
|
+
"- projectId (integer, required): Project ID. Example: 10930\n"
|
310
|
+
"- cycleId (string, required): Cycle ID. Example: \"0001513838430954-242ac112-0001\"\n"
|
311
|
+
"*IMPORTANT*: Use double quotes for all field names and string values.")))
|
312
|
+
)
|
313
|
+
|
314
|
+
GetExecution = create_model(
|
315
|
+
"GetExecution",
|
316
|
+
execution_id=(str, Field(description="executionId of Execution.")),
|
317
|
+
issue_id=(int, Field(description="issueId of Execution.")),
|
318
|
+
project_id=(int, Field(description="projectId of Execution."))
|
319
|
+
)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import hashlib
|
2
|
+
import json
|
2
3
|
import time
|
3
4
|
|
4
5
|
import jwt
|
@@ -18,44 +19,79 @@ class ZephyrSquadCloud(object):
|
|
18
19
|
self.base_url = "https://prod-api.zephyr4jiracloud.com/connect"
|
19
20
|
|
20
21
|
def get_test_step(self, issue_id, step_id, project_id):
|
21
|
-
canonical_path = "/public/rest/api/1.0/teststep/issueId/id?projectId="
|
22
22
|
api_path = f"/public/rest/api/1.0/teststep/{issue_id}/{step_id}?projectId={project_id}"
|
23
|
-
return self._do_request(method="GET", api_path=api_path
|
23
|
+
return self._do_request(method="GET", api_path=api_path)
|
24
24
|
|
25
25
|
def update_test_step(self, issue_id, step_id, project_id, json):
|
26
|
-
canonical_path = "/public/rest/api/1.0/teststep/issueId/id?projectId="
|
27
26
|
api_path = f"/public/rest/api/1.0/teststep/{issue_id}/{step_id}?projectId={project_id}"
|
28
|
-
return self._do_request(method="PUT", api_path=api_path,
|
27
|
+
return self._do_request(method="PUT", api_path=api_path, json=json)
|
29
28
|
|
30
29
|
def delete_test_step(self, issue_id, step_id, project_id):
|
31
|
-
canonical_path = "/public/rest/api/1.0/teststep/issueId/id?projectId="
|
32
30
|
api_path = f"/public/rest/api/1.0/teststep/{issue_id}/{step_id}?projectId={project_id}"
|
33
|
-
return self._do_request(method="DELETE", api_path=api_path
|
31
|
+
return self._do_request(method="DELETE", api_path=api_path)
|
34
32
|
|
35
33
|
def create_new_test_step(self, issue_id, project_id, json):
|
36
|
-
canonical_path = "/public/rest/api/1.0/teststep/issueId?projectId="
|
37
34
|
api_path = f"/public/rest/api/1.0/teststep/{issue_id}?projectId={project_id}"
|
38
|
-
return self._do_request(method="POST", api_path=api_path,
|
35
|
+
return self._do_request(method="POST", api_path=api_path, json=json)
|
39
36
|
|
40
37
|
def get_all_test_steps(self, issue_id, project_id):
|
41
|
-
canonical_path = "/public/rest/api/2.0/teststep/issueId?projectId="
|
42
38
|
api_path = f"/public/rest/api/2.0/teststep/{issue_id}?projectId={project_id}"
|
43
|
-
return self._do_request(method='GET', api_path=api_path
|
39
|
+
return self._do_request(method='GET', api_path=api_path)
|
44
40
|
|
45
41
|
def get_all_test_step_statuses(self):
|
46
42
|
api_path = "/public/rest/api/1.0/teststep/statuses"
|
47
43
|
return self._do_request(method='GET', api_path=api_path)
|
48
44
|
|
49
|
-
def
|
45
|
+
def get_bdd_content(self, issue_id):
|
46
|
+
api_path = f"/public/rest/api/1.0/integration/bddcontent/{issue_id}"
|
47
|
+
return self._do_request(method='GET', api_path=api_path)
|
48
|
+
|
49
|
+
def update_bdd_content(self, issue_id, new_content: str):
|
50
|
+
api_path = f"/public/rest/api/1.0/integration/bddcontent/{issue_id}"
|
51
|
+
return self._do_request(method='POST', api_path=api_path, json=json.dumps({"content": new_content}))
|
52
|
+
|
53
|
+
def delete_bdd_content(self, issue_id):
|
54
|
+
api_path = f"/public/rest/api/1.0/integration/bddcontent/{issue_id}"
|
55
|
+
return self._do_request(method='DELETE', api_path=api_path, json="[]")
|
56
|
+
|
57
|
+
def create_new_cycle(self, json):
|
58
|
+
api_path = f"public/rest/api/1.0/cycle"
|
59
|
+
return self._do_request(method='POST', api_path=api_path, json=json)
|
60
|
+
|
61
|
+
def create_folder(self, json):
|
62
|
+
api_path = f"/public/rest/api/1.0/folder"
|
63
|
+
return self._do_request(method='POST', api_path=api_path, json=json)
|
64
|
+
|
65
|
+
def add_test_to_cycle(self, cycle_id, json):
|
66
|
+
api_path = f"/public/rest/api/1.0/executions/add/cycle/{cycle_id}"
|
67
|
+
return self._do_request(method='POST', api_path=api_path, json=json)
|
68
|
+
|
69
|
+
def add_test_to_folder(self, folder_id, json):
|
70
|
+
api_path = f"/public/rest/api/1.0/executions/add/folder/{folder_id}"
|
71
|
+
return self._do_request(method='POST', api_path=api_path, json=json)
|
72
|
+
|
73
|
+
def create_execution(self, json):
|
74
|
+
api_path = f"/public/rest/api/1.0/execution"
|
75
|
+
return self._do_request(method='POST', api_path=api_path, json=json)
|
76
|
+
|
77
|
+
def get_execution(self, execution_id, issue_id, project_id):
|
78
|
+
api_path = f"/public/rest/api/1.0/execution/{execution_id}?issueId={issue_id}&projectId={project_id}"
|
79
|
+
return self._do_request(method='GET', api_path=api_path)
|
80
|
+
|
81
|
+
def _do_request(self, method, api_path, json=None):
|
50
82
|
url = f"{self.base_url}{api_path}"
|
51
83
|
headers = {
|
52
|
-
"Authorization": f"JWT {self._generate_jwt_token(method,
|
53
|
-
"zapiAccessKey": self.access_key
|
54
|
-
"Content-Type": "application/json"
|
84
|
+
"Authorization": f"JWT {self._generate_jwt_token(method, api_path)}",
|
85
|
+
"zapiAccessKey": self.access_key
|
55
86
|
}
|
87
|
+
if json is not None:
|
88
|
+
headers["Content-Type"] = "application/json"
|
89
|
+
params = {"method": method, "url": url, "headers": headers}
|
90
|
+
if json is not None:
|
91
|
+
params["data"] = json
|
56
92
|
|
57
93
|
try:
|
58
|
-
resp = requests.request(
|
94
|
+
resp = requests.request(**params)
|
59
95
|
|
60
96
|
if resp.ok:
|
61
97
|
if resp.headers.get("Content-Type", "").startswith("application/json"):
|
@@ -68,12 +104,16 @@ class ZephyrSquadCloud(object):
|
|
68
104
|
raise ToolException(f"Error performing request {method}:{api_path}: {e}")
|
69
105
|
|
70
106
|
def _generate_jwt_token(self, method, path):
|
71
|
-
canonical_path = f"{method}&{path}&
|
107
|
+
canonical_path = f"{method}&{path}".replace('?', '&')
|
108
|
+
|
109
|
+
if '&' not in path and '?' not in path:
|
110
|
+
canonical_path += '&'
|
111
|
+
|
72
112
|
payload_token = {
|
73
113
|
'sub': self.account_id,
|
74
114
|
'qsh': hashlib.sha256(canonical_path.encode('utf-8')).hexdigest(),
|
75
115
|
'iss': self.access_key,
|
76
|
-
'exp': int(time.time()) +
|
116
|
+
'exp': int(time.time()) + 300,
|
77
117
|
'iat': int(time.time())
|
78
118
|
}
|
79
119
|
return jwt.encode(payload_token, self.secret_key, algorithm='HS256').strip()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: alita_sdk
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.194
|
4
4
|
Summary: SDK for building langchain agents using resources from Alita
|
5
5
|
Author-email: Artem Rozumenko <artyom.rozumenko@gmail.com>, Mikalai Biazruchka <mikalai_biazruchka@epam.com>, Roman Mitusov <roman_mitusov@epam.com>, Ivan Krakhmaliuk <lifedjik@gmail.com>, Artem Dubrovskiy <ad13box@gmail.com>
|
6
6
|
License-Expression: Apache-2.0
|
@@ -63,7 +63,7 @@ alita_sdk/runtime/langchain/tools/bdd_parser/bdd_parser.py,sha256=DiEEOqDef2Xo3x
|
|
63
63
|
alita_sdk/runtime/langchain/tools/bdd_parser/feature_types.py,sha256=l3AdjSQnNv1CE1NuHi7wts6h6AsCiK-iPu0PnPf3jf0,399
|
64
64
|
alita_sdk/runtime/langchain/tools/bdd_parser/parser.py,sha256=1H1Nd_OH5Wx8A5YV1zUghBxo613yPptZ7fqNo8Eg48M,17289
|
65
65
|
alita_sdk/runtime/llms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
66
|
-
alita_sdk/runtime/llms/alita.py,sha256=
|
66
|
+
alita_sdk/runtime/llms/alita.py,sha256=SHKlQ3LVrzISHbDl3BLinvTjPu28EMHuOtvwSYtuQ6c,10130
|
67
67
|
alita_sdk/runtime/llms/preloaded.py,sha256=3AaUbZK3d8fvxAQMjR3ftOoYa0SnkCOL1EvdvDCXIHE,11321
|
68
68
|
alita_sdk/runtime/toolkits/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
69
69
|
alita_sdk/runtime/toolkits/application.py,sha256=akqUuaIL9u7-SsUmS-XgN4qxDEnXFhsK9do4n8inpSo,2432
|
@@ -104,11 +104,11 @@ alita_sdk/tools/ado/__init__.py,sha256=mD6GHcYMTtffPJkJvFPe2rzvye_IRmXmWfI7xYuZh
|
|
104
104
|
alita_sdk/tools/ado/utils.py,sha256=PTCludvaQmPLakF2EbCGy66Mro4-rjDtavVP-xcB2Wc,1252
|
105
105
|
alita_sdk/tools/ado/repos/__init__.py,sha256=saNovhnawWFY3xwKA6FssR7cakPQzTNp_UjkpgCnyF0,6462
|
106
106
|
alita_sdk/tools/ado/repos/repos_wrapper.py,sha256=_OWKAls7VFfFtEPTwqj_DxE1MSvpC0ivxdTIULEz3Tk,48206
|
107
|
-
alita_sdk/tools/ado/test_plan/__init__.py,sha256=
|
107
|
+
alita_sdk/tools/ado/test_plan/__init__.py,sha256=bVywTYTvdm1rUeP2krVVMRN-xDCY--ze7NFdTxJP9ow,4708
|
108
108
|
alita_sdk/tools/ado/test_plan/test_plan_wrapper.py,sha256=p1Mptd_1J6bmkyrvf2M-FB79s8THzEesBlfgaOnRXb8,18152
|
109
|
-
alita_sdk/tools/ado/wiki/__init__.py,sha256=
|
109
|
+
alita_sdk/tools/ado/wiki/__init__.py,sha256=WCIKOisU2h3E4SNDvGfWCMZ3nRMxfH_ZhIffmSHH3XI,4576
|
110
110
|
alita_sdk/tools/ado/wiki/ado_wrapper.py,sha256=l4bc2QoKSUXg9UqNcx0ylv7YL9JPPQd35Ti5MXyEgC4,12690
|
111
|
-
alita_sdk/tools/ado/work_item/__init__.py,sha256=
|
111
|
+
alita_sdk/tools/ado/work_item/__init__.py,sha256=k6gZ6pEE7gvNWvCDoDV05jltzbqxC_NPm06CEr5Wwcs,4726
|
112
112
|
alita_sdk/tools/ado/work_item/ado_wrapper.py,sha256=aLB-aSNQST0FCwP7I01OXanCpZHKVarZZB1u9j2H1LA,26253
|
113
113
|
alita_sdk/tools/advanced_jira_mining/__init__.py,sha256=pUTzECqGvYaR5qWY3JPUhrImrZgc7pCXuqSe5eWIE80,4604
|
114
114
|
alita_sdk/tools/advanced_jira_mining/data_mining_wrapper.py,sha256=nZPtuwVWp8VeHw1B8q9kdwf-6ZvHnlXTOGdcIMDkKpw,44211
|
@@ -223,7 +223,7 @@ alita_sdk/tools/llm/llm_utils.py,sha256=v3_lWP_Nk6tJLkj0BYohOun0OWNfvzqLjPdPAMl-
|
|
223
223
|
alita_sdk/tools/localgit/__init__.py,sha256=NScO0Eu-wl-rc63jjD5Qv1RXXB1qukSIJXx-yS_JQLI,2529
|
224
224
|
alita_sdk/tools/localgit/local_git.py,sha256=gsAftNcK7nMCd8VsIkwDLs2SoG0MgpYdkQG5tmoynkA,18074
|
225
225
|
alita_sdk/tools/localgit/tool.py,sha256=It_B24rMvFPurB355Oy5IShg2BsZTASsEoSS8hu2SXw,998
|
226
|
-
alita_sdk/tools/memory/__init__.py,sha256=
|
226
|
+
alita_sdk/tools/memory/__init__.py,sha256=8Q02h-PUvIw3bNbWbfklSJZe3qj0zAjfahq9C5XjyzE,2359
|
227
227
|
alita_sdk/tools/ocr/__init__.py,sha256=pvslKVXyJmK0q23FFDNieuc7RBIuzNXTjTNj-GqhGb0,3335
|
228
228
|
alita_sdk/tools/ocr/api_wrapper.py,sha256=08UF8wj1sR8DcW0z16pw19bgLatLkBF8dySW-Ds8iRk,29649
|
229
229
|
alita_sdk/tools/ocr/text_detection.py,sha256=1DBxt54r3_HdEi93QynSIVta3rH3UpIvy799TPtDTtk,23825
|
@@ -270,8 +270,8 @@ alita_sdk/tools/sharepoint/__init__.py,sha256=HqKQDFboab1AYh20uJvHxs9HFLJSqVfVTj
|
|
270
270
|
alita_sdk/tools/sharepoint/api_wrapper.py,sha256=qCHCIH4FRDtgdpIK22ewFhZJeOaTv9hT9BVivslxxlE,7119
|
271
271
|
alita_sdk/tools/sharepoint/authorization_helper.py,sha256=n-nL5dlBoLMK70nHu7P2RYCb8C6c9HMA_gEaw8LxuhE,2007
|
272
272
|
alita_sdk/tools/sharepoint/utils.py,sha256=fZ1YzAu5CTjKSZeslowpOPH974902S8vCp1Wu7L44LM,446
|
273
|
-
alita_sdk/tools/slack/__init__.py,sha256=
|
274
|
-
alita_sdk/tools/slack/api_wrapper.py,sha256=
|
273
|
+
alita_sdk/tools/slack/__init__.py,sha256=Y2sXN1__1923icF8bZbAtKVg3G_EZbCAjnj93yHUwtY,3415
|
274
|
+
alita_sdk/tools/slack/api_wrapper.py,sha256=dkMcS3xozEhoJ-A1ycEn6OqbIftxmVHjyYttTy3D2JI,7343
|
275
275
|
alita_sdk/tools/sql/__init__.py,sha256=9Lh8YHKO8zD5eeolpR4O9swTUsjpXj9LVDn8fM-T5IM,3506
|
276
276
|
alita_sdk/tools/sql/api_wrapper.py,sha256=Rky0_CX9HWDQ2mClHGAgP3LHjYVX4iymPuilZMtaDlQ,3687
|
277
277
|
alita_sdk/tools/sql/models.py,sha256=AKJgSl_kEEz4fZfw3kbvdGHXaRZ-yiaqfJOB6YOj3i0,641
|
@@ -294,11 +294,11 @@ alita_sdk/tools/zephyr_enterprise/api_wrapper.py,sha256=Ir3zHljhbZQJRJJQOBzS_GL5
|
|
294
294
|
alita_sdk/tools/zephyr_enterprise/zephyr_enterprise.py,sha256=hV9LIrYfJT6oYp-ZfQR0YHflqBFPsUw2Oc55HwK0H48,6809
|
295
295
|
alita_sdk/tools/zephyr_scale/__init__.py,sha256=2NTcdrfkx4GSegqyXhsPLsEpc4FlACuDy85b0fk6cAo,4572
|
296
296
|
alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=UHVQUVqcBc3SZvDfO78HSuBzwAsRw2cCDQa-xMOzndE,68663
|
297
|
-
alita_sdk/tools/zephyr_squad/__init__.py,sha256=
|
298
|
-
alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=
|
299
|
-
alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=
|
300
|
-
alita_sdk-0.3.
|
301
|
-
alita_sdk-0.3.
|
302
|
-
alita_sdk-0.3.
|
303
|
-
alita_sdk-0.3.
|
304
|
-
alita_sdk-0.3.
|
297
|
+
alita_sdk/tools/zephyr_squad/__init__.py,sha256=0AI_j27xVO5Gk5HQMFrqPTd4uvuVTpiZUicBrdfEpKg,2796
|
298
|
+
alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
|
299
|
+
alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
|
300
|
+
alita_sdk-0.3.194.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
301
|
+
alita_sdk-0.3.194.dist-info/METADATA,sha256=OJ_VfIlIR53zBYnpZL7P5LbBiZPoD9hkBozgBPwQXGw,18804
|
302
|
+
alita_sdk-0.3.194.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
303
|
+
alita_sdk-0.3.194.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
|
304
|
+
alita_sdk-0.3.194.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|