arcade-x 0.1.16__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.
arcade_x/tools/tweets.py CHANGED
@@ -14,12 +14,22 @@ from arcade_x.tools.utils import (
14
14
  get_tweet_url,
15
15
  parse_search_recent_tweets_response,
16
16
  remove_none_values,
17
+ validate_tweet_id,
17
18
  )
18
19
 
19
20
  # Manage Tweets Tools. See developer docs for additional available parameters:
20
21
  # https://developer.x.com/en/docs/x-api/tweets/manage-tweets/api-reference
21
22
 
22
23
 
24
+ async def _post_tweet(context: ToolContext, payload: dict) -> str:
25
+ headers = get_headers_with_token(context)
26
+ async with httpx.AsyncClient() as client:
27
+ response = await client.post(TWEETS_URL, headers=headers, json=payload, timeout=10)
28
+ response.raise_for_status()
29
+ tweet_id = response.json()["data"]["id"]
30
+ return f"Tweet with id {tweet_id} posted successfully. URL: {get_tweet_url(tweet_id)}"
31
+
32
+
23
33
  @tool(
24
34
  requires_auth=X(
25
35
  scopes=["tweet.read", "tweet.write", "users.read"],
@@ -28,18 +38,59 @@ from arcade_x.tools.utils import (
28
38
  async def post_tweet(
29
39
  context: ToolContext,
30
40
  tweet_text: Annotated[str, "The text content of the tweet you want to post"],
41
+ quote_tweet_id: Annotated[
42
+ str | None,
43
+ "The ID of the tweet you want to quote."
44
+ " It must be a valid integer as a string. Optional.",
45
+ ] = None,
31
46
  ) -> Annotated[str, "Success string and the URL of the tweet"]:
32
- """Post a tweet to X (Twitter)."""
47
+ """Post a tweet to X (Twitter).
33
48
 
34
- headers = get_headers_with_token(context)
49
+ IMPORTANT NOTE:
50
+ Use this tool ONLY when posting a tweet that is not a reply.
51
+ If you need to reply to a tweet, use the ReplyToTweet tool instead.
52
+ If you need to quote a tweet, you must include the quote_tweet_id parameter."""
35
53
  payload = {"text": tweet_text}
54
+ if quote_tweet_id:
55
+ validate_tweet_id(quote_tweet_id)
56
+ payload["quote_tweet_id"] = quote_tweet_id
57
+ return await _post_tweet(context, payload)
36
58
 
37
- async with httpx.AsyncClient() as client:
38
- response = await client.post(TWEETS_URL, headers=headers, json=payload, timeout=10)
39
- response.raise_for_status()
40
59
 
41
- tweet_id = response.json()["data"]["id"]
42
- return f"Tweet with id {tweet_id} posted successfully. URL: {get_tweet_url(tweet_id)}"
60
+ @tool(
61
+ requires_auth=X(
62
+ scopes=["tweet.read", "tweet.write", "users.read"],
63
+ )
64
+ )
65
+ async def reply_to_tweet(
66
+ context: ToolContext,
67
+ tweet_id: Annotated[
68
+ str, "The ID of the tweet you want to reply to. It must be a valid integer as a string."
69
+ ],
70
+ tweet_text: Annotated[str, "The text content of the tweet you want to post"],
71
+ quote_tweet_id: Annotated[
72
+ str | None,
73
+ "The ID of the tweet you want to quote. It must be a valid integer as a string. Optional.",
74
+ ] = None,
75
+ ) -> Annotated[str, "Success string and the URL of the tweet"]:
76
+ """Reply to a tweet on X (Twitter).
77
+
78
+ IMPORTANT NOTE:
79
+ Use this tool ONLY when replying to a tweet directly.
80
+ If you need to post a tweet that is not a reply, use the PostTweet tool instead.
81
+ If you need to quote a tweet on your reply, you must include the quote_tweet_id parameter.
82
+ """
83
+
84
+ payload = {
85
+ "text": tweet_text,
86
+ "reply": {
87
+ "in_reply_to_tweet_id": tweet_id,
88
+ },
89
+ }
90
+ if quote_tweet_id:
91
+ validate_tweet_id(quote_tweet_id)
92
+ payload["quote_tweet_id"] = quote_tweet_id
93
+ return await _post_tweet(context, payload)
43
94
 
44
95
 
45
96
  @tool(requires_auth=X(scopes=["tweet.read", "tweet.write", "users.read"]))
@@ -49,6 +100,7 @@ async def delete_tweet_by_id(
49
100
  ) -> Annotated[str, "Success string confirming the tweet deletion"]:
50
101
  """Delete a tweet on X (Twitter)."""
51
102
 
103
+ validate_tweet_id(tweet_id)
52
104
  headers = get_headers_with_token(context)
53
105
  url = f"{TWEETS_URL}/{tweet_id}"
54
106
 
@@ -185,6 +237,7 @@ async def lookup_tweet_by_id(
185
237
  ) -> Annotated[dict[str, Any], "Dictionary containing the tweet data"]:
186
238
  """Look up a tweet on X (Twitter) by tweet ID."""
187
239
 
240
+ validate_tweet_id(tweet_id)
188
241
  headers = get_headers_with_token(context)
189
242
  params = {
190
243
  "expansions": "author_id",
arcade_x/tools/utils.py CHANGED
@@ -161,3 +161,14 @@ def expand_attached_media(params: dict) -> dict:
161
161
  "public_metrics",
162
162
  ])
163
163
  return params
164
+
165
+
166
+ def validate_tweet_id(tweet_id: str) -> None:
167
+ """
168
+ Validate a tweet ID.
169
+ """
170
+ if not tweet_id.isdigit():
171
+ raise ToolExecutionError(
172
+ "Invalid tweet ID",
173
+ developer_message="Tweet ID must be a valid integer",
174
+ )
@@ -1,8 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: arcade_x
3
- Version: 0.1.16
3
+ Version: 1.1.0
4
4
  Summary: Arcade.dev LLM tools for X (Twitter)
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: arcade-tdk<3.0.0,>=2.0.0
@@ -0,0 +1,10 @@
1
+ arcade_x/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ arcade_x/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ arcade_x/tools/constants.py,sha256=d-OJK5Qx05JRUcpK5G1DcYB91wT37hFSzGmIYfwlEtA,42
4
+ arcade_x/tools/tweets.py,sha256=xfg31_Jh7sUuBfFjRIY_TwbUFCcYbm_xyUE_s35HB-8,9416
5
+ arcade_x/tools/users.py,sha256=gopYKTBOwbZAeVdL_T3vwkepbpv1bdPbqcU_2oPC3SY,2132
6
+ arcade_x/tools/utils.py,sha256=lR_shws08LWQD-4XU9r3xYmasZ2j2i-cUaCCDnuN8UE,5723
7
+ arcade_x-1.1.0.dist-info/METADATA,sha256=4NOmlu-_kCLdy_KjDZAGkX3DFjaBZsLHsNmmYvtjkFY,896
8
+ arcade_x-1.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ arcade_x-1.1.0.dist-info/licenses/LICENSE,sha256=ixeE7aL9b2B-_ZYHTY1vQcJB4NufKeo-LWwKNObGDN0,1960
10
+ arcade_x-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,10 +0,0 @@
1
- arcade_x/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- arcade_x/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- arcade_x/tools/constants.py,sha256=d-OJK5Qx05JRUcpK5G1DcYB91wT37hFSzGmIYfwlEtA,42
4
- arcade_x/tools/tweets.py,sha256=S1Psv-gFePz-8ibnp7rY-GCdogkAm-hJQZpHf7hUusk,7498
5
- arcade_x/tools/users.py,sha256=gopYKTBOwbZAeVdL_T3vwkepbpv1bdPbqcU_2oPC3SY,2132
6
- arcade_x/tools/utils.py,sha256=wxPdp3JDG-gEDM7XUNiZSgL61isVE3SRqaLiwYP-K40,5461
7
- arcade_x-0.1.16.dist-info/METADATA,sha256=7ox9l5R61ZAaxf46r2Bwib5vxmr1OrWB19LSldl_k2Q,835
8
- arcade_x-0.1.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
- arcade_x-0.1.16.dist-info/licenses/LICENSE,sha256=f4Q0XUZJ2MqZBO1XsqqHhuZfSs2ar1cZEJ45150zERo,1067
10
- arcade_x-0.1.16.dist-info/RECORD,,
@@ -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.