arcade-slack 0.5.2__py3-none-any.whl → 1.1.0__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.
@@ -0,0 +1,36 @@
1
+ from typing import Annotated, Any
2
+
3
+ from arcade_tdk import ToolContext, tool
4
+ from arcade_tdk.auth import Slack
5
+ from slack_sdk.web.async_client import AsyncWebClient
6
+
7
+ from arcade_slack.who_am_i_util import build_who_am_i_response
8
+
9
+
10
+ @tool(
11
+ requires_auth=Slack(
12
+ scopes=[
13
+ "users:read",
14
+ "users:read.email",
15
+ ]
16
+ )
17
+ )
18
+ async def who_am_i(
19
+ context: ToolContext,
20
+ ) -> Annotated[
21
+ dict[str, Any],
22
+ "Get comprehensive user profile and Slack information.",
23
+ ]:
24
+ """
25
+ Get comprehensive user profile and Slack information.
26
+
27
+ This tool provides detailed information about the authenticated user including
28
+ their name, email, profile picture, and other important profile details from
29
+ Slack services.
30
+ """
31
+
32
+ auth_token = context.get_auth_token_or_empty()
33
+ slack_client = AsyncWebClient(token=auth_token)
34
+ user_info = await build_who_am_i_response(context, slack_client)
35
+
36
+ return dict(user_info)
@@ -0,0 +1,122 @@
1
+ from typing import Any, TypedDict, cast
2
+
3
+ from slack_sdk.web.async_client import AsyncWebClient
4
+
5
+
6
+ class WhoAmIResponse(TypedDict, total=False):
7
+ user_id: str
8
+ username: str
9
+ display_name: str
10
+ real_name: str
11
+ email: str
12
+ profile_picture_url: str
13
+ title: str
14
+ phone: str
15
+ first_name: str
16
+ last_name: str
17
+ pronouns: str
18
+ status_text: str
19
+ status_emoji: str
20
+ slack_access: bool
21
+
22
+
23
+ async def build_who_am_i_response(context: Any, slack_client: AsyncWebClient) -> WhoAmIResponse:
24
+ """Build complete who_am_i response from Slack APIs."""
25
+ auth_token = context.get_auth_token_or_empty()
26
+
27
+ auth_info = await _get_auth_info(slack_client)
28
+
29
+ user_profile = await _get_user_profile(auth_token, auth_info["user_id"])
30
+
31
+ user_info: dict[str, Any] = {}
32
+ user_info.update(_extract_auth_info(auth_info))
33
+ user_info.update(_extract_user_profile(user_profile))
34
+
35
+ return cast(WhoAmIResponse, user_info)
36
+
37
+
38
+ async def _get_auth_info(slack_client: AsyncWebClient) -> dict[str, Any]:
39
+ """Get authentication information including user_id and team info."""
40
+ response = await slack_client.auth_test()
41
+ return cast(dict[str, Any], response.data)
42
+
43
+
44
+ async def _get_user_profile(auth_token: str, user_id: str) -> dict[str, Any]:
45
+ """Get detailed user profile information."""
46
+ slack_client = AsyncWebClient(token=auth_token)
47
+ response = await slack_client.users_info(user=user_id)
48
+ response_dict = cast(dict[str, Any], response)
49
+ if not response_dict.get("ok"):
50
+ error = response_dict.get("error", "Unknown error")
51
+ raise RuntimeError(f"Failed to get user info: {error}")
52
+ return cast(dict[str, Any], response_dict["user"])
53
+
54
+
55
+ def _extract_auth_info(auth_info: dict[str, Any]) -> dict[str, Any]:
56
+ """Extract authentication information."""
57
+ extracted = {}
58
+
59
+ if auth_info.get("user_id"):
60
+ extracted["user_id"] = auth_info["user_id"]
61
+ if auth_info.get("user"):
62
+ extracted["username"] = auth_info["user"]
63
+
64
+ extracted["slack_access"] = bool(auth_info.get("ok"))
65
+
66
+ return extracted
67
+
68
+
69
+ def _extract_user_profile(user_profile: dict[str, Any]) -> dict[str, Any]:
70
+ """Extract user profile information."""
71
+ extracted = {}
72
+
73
+ if user_profile.get("real_name"):
74
+ extracted["real_name"] = user_profile["real_name"]
75
+ if user_profile.get("name"):
76
+ extracted["username"] = user_profile["name"]
77
+
78
+ profile = user_profile.get("profile", {})
79
+ extracted.update(_extract_profile_fields(profile))
80
+ extracted.update(_extract_profile_picture(profile))
81
+
82
+ return extracted
83
+
84
+
85
+ def _extract_profile_fields(profile: dict[str, Any]) -> dict[str, Any]:
86
+ """Extract profile fields from user profile."""
87
+ extracted = {}
88
+
89
+ fields = [
90
+ ("display_name", "display_name"),
91
+ ("real_name", "real_name"),
92
+ ("email", "email"),
93
+ ("title", "title"),
94
+ ("phone", "phone"),
95
+ ("first_name", "first_name"),
96
+ ("last_name", "last_name"),
97
+ ("pronouns", "pronouns"),
98
+ ("status_text", "status_text"),
99
+ ("status_emoji", "status_emoji"),
100
+ ]
101
+
102
+ for profile_key, extracted_key in fields:
103
+ if profile.get(profile_key):
104
+ extracted[extracted_key] = profile[profile_key]
105
+
106
+ return extracted
107
+
108
+
109
+ def _extract_profile_picture(profile: dict[str, Any]) -> dict[str, Any]:
110
+ """Extract profile picture URL from user profile."""
111
+ for size in [
112
+ "image_1024",
113
+ "image_512",
114
+ "image_192",
115
+ "image_72",
116
+ "image_48",
117
+ "image_32",
118
+ "image_24",
119
+ ]:
120
+ if profile.get(size):
121
+ return {"profile_picture_url": profile[size]}
122
+ return {}
@@ -1,8 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: arcade_slack
3
- Version: 0.5.2
3
+ Version: 1.1.0
4
4
  Summary: Arcade.dev LLM tools for Slack
5
5
  Author-email: Arcade <dev@arcade.dev>
6
+ License: Proprietary - Arcade Software License Agreement v1.0
6
7
  License-File: LICENSE
7
8
  Requires-Python: >=3.10
8
9
  Requires-Dist: aiodns<2.0.0,>=1.0
@@ -8,10 +8,12 @@ arcade_slack/message_retrieval.py,sha256=XdzWLJdKtc5DL7H_qQBei6qJ-rz2uGs-Q0HfYqx
8
8
  arcade_slack/models.py,sha256=-zlkAxaDNEcIkQqePYTZXAqcRX4gO5jocJIixeWpK7A,12213
9
9
  arcade_slack/user_retrieval.py,sha256=cdfzBbm2fsVNCztt2XbIV2UKuCdHaotfFBdo10EpBcE,6774
10
10
  arcade_slack/utils.py,sha256=z6G7GCDXn_7_TshQRx-rnhgmQG8eCQSND5It9_uvhmE,21776
11
+ arcade_slack/who_am_i_util.py,sha256=Nf6EdRiURva5jMhVx1lFOoKQ-2SuMwjXYbPCmtj6Zcw,3670
11
12
  arcade_slack/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
13
  arcade_slack/tools/chat.py,sha256=KWDalEiOhay4Z71EB97dVllm3Uo7sXxjXFfmcpvuWYE,38125
14
+ arcade_slack/tools/system_context.py,sha256=l2gZh_WhrIVL2LzttGAz5yiv0Cl6q_6AFyBBUBskz3E,961
13
15
  arcade_slack/tools/users.py,sha256=Kw3MWNOwuUY17X5HGf3JMAH_mfloLRdRzXSBC7Zo7ug,4233
14
- arcade_slack-0.5.2.dist-info/METADATA,sha256=8vwvUttDlMHVsBOv5c5WEbUoKXD9HORTbwghT0kpfug,953
15
- arcade_slack-0.5.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
- arcade_slack-0.5.2.dist-info/licenses/LICENSE,sha256=f4Q0XUZJ2MqZBO1XsqqHhuZfSs2ar1cZEJ45150zERo,1067
17
- arcade_slack-0.5.2.dist-info/RECORD,,
16
+ arcade_slack-1.1.0.dist-info/METADATA,sha256=7xIdWupyKsoxoT8kgUBoJh-m72gSIa8NdH8IP8OTIhE,1015
17
+ arcade_slack-1.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
18
+ arcade_slack-1.1.0.dist-info/licenses/LICENSE,sha256=ixeE7aL9b2B-_ZYHTY1vQcJB4NufKeo-LWwKNObGDN0,1960
19
+ arcade_slack-1.1.0.dist-info/RECORD,,
@@ -0,0 +1,35 @@
1
+ # The Arcade Software License Agreement
2
+
3
+ - Version 1.0
4
+ - Effective Date: July 24, 2025
5
+
6
+ ---
7
+
8
+ This software and associated documentation (collectively, the “Software”) are the intellectual property of Arcade Technologies, Inc. (“Arcade”). All rights are reserved.
9
+
10
+ 1. License Grant
11
+
12
+ No license or other rights are granted to any party under this Agreement, whether by implication, estoppel, or otherwise. This Software is proprietary and confidential. Use, reproduction, modification, distribution, display, or creation of derivative works based on the Software is strictly prohibited without the prior written consent of Arcade.
13
+
14
+ 2. Commercial Use Only
15
+
16
+ Any use of this Software requires a commercial license agreement with Arcade. You may not use any part of the Software for any purpose—including but not limited to evaluation, testing, or internal use—without first obtaining explicit written permission and entering into a commercial licensing arrangement.
17
+
18
+ To inquire about licensing terms, contact Arcade at:
19
+ 🔗 www.arcade.dev
20
+
21
+ 3. No Open Source Rights
22
+
23
+ This Software is not licensed under an open-source license. No part of it may be incorporated into open-source or publicly available projects under any open-source terms or licenses.
24
+
25
+ 4. Ownership
26
+
27
+ Arcade retains all right, title, and interest in and to the Software, including all intellectual property rights therein. No ownership or license rights are transferred under this Agreement.
28
+
29
+ 5. Disclaimer of Warranty
30
+
31
+ The Software is provided “as is” without warranty of any kind. Arcade disclaims all warranties, express or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, and noninfringement.
32
+
33
+ 6. Limitation of Liability
34
+
35
+ In no event shall Arcade be liable for any damages arising out of or in connection with the use or performance of the Software, whether in an action of contract, tort (including negligence), or otherwise.
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025, Arcade AI
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.