mezoAgent 0.7.1__py3-none-any.whl → 0.7.3__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mezoAgent
3
- Version: 0.7.1
3
+ Version: 0.7.3
4
4
  Summary: A Python package for Mezo Agent transactions with LangChain tools
5
5
  Author: Dreadwulf, Duck, Digi
6
6
  Requires-Dist: python-dotenv
@@ -1,4 +1,4 @@
1
- mezo_agent/__init__.py,sha256=1UatqstSlOF8pU5-fu675ONGteB6INqyE74xMi8S1o4,752
1
+ mezo_agent/__init__.py,sha256=5OyYPS3Ub5e9H0Jcp5lYg0pjP39DzJjuLwX8oyoqfZk,895
2
2
  mezo_agent/characters.py,sha256=wub7y9BrAAdAKWwcNAdgrvhRi2zHMaZNzTr2y3qtbsw,515
3
3
  mezo_agent/chat.py,sha256=ZtNurUDV7UzJjbFyU96DNGy37hO3gl0osn19mRu7ER8,859
4
4
  mezo_agent/config.py,sha256=6xFgk80eiBLTasKGW73Ne8hNhMtx8BbQ_Ef79YOyDlc,3233
@@ -9,10 +9,10 @@ mezo_agent/token_price_tool.py,sha256=vD-ukq0D_4zmjIy9bZ9qL44nGctf-hWzkQuTd-0wy2
9
9
  mezo_agent/token_utils.py,sha256=3NH_Z_vbZ0uupuuGjEbmwsbUkubluQbL-0xR9kia7nU,1118
10
10
  mezo_agent/transaction.py,sha256=YpfWrkEaf0YGM_Kc4cFwlT9GmBGZkeJHWm0VGHs9Gks,4199
11
11
  mezo_agent/twitter_client.py,sha256=Va8ZQaK5lZjJUq3-bhIJWnDmX4Mmt4kWRW3aKSGbLq8,3248
12
- mezo_agent/twitter_manager.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ mezo_agent/twitter_manager.py,sha256=KvxiMOhBmQbLuLoVrAQ77DpAnFIdiDSztsKbZ_3-ar4,2363
13
13
  mezo_agent/utils.py,sha256=hsGtL_iXvUVGnY5aHPQ0v6Jejxd4P4qw0yOtS1omToU,1397
14
14
  mezo_agent/data/new_router.json,sha256=A8U-NVfe1F-hDyR90_SuH8jDAxmzyyHWdJW62j9TZsc,26756
15
- mezoAgent-0.7.1.dist-info/METADATA,sha256=0SWYjd82fIU-sYplnf6oPRUH15JeyiniDKPB6l4S9q0,273
16
- mezoAgent-0.7.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
17
- mezoAgent-0.7.1.dist-info/top_level.txt,sha256=rrAci_NyTR9z6w_BrQhQrAhzMW_A0NYhVa0x2USl0nQ,11
18
- mezoAgent-0.7.1.dist-info/RECORD,,
15
+ mezoAgent-0.7.3.dist-info/METADATA,sha256=v5lV-XUshSwN69O9nuPHOfpuGYT8zZ38ugGpI2J4Yjs,273
16
+ mezoAgent-0.7.3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
17
+ mezoAgent-0.7.3.dist-info/top_level.txt,sha256=rrAci_NyTR9z6w_BrQhQrAhzMW_A0NYhVa0x2USl0nQ,11
18
+ mezoAgent-0.7.3.dist-info/RECORD,,
mezo_agent/__init__.py CHANGED
@@ -5,7 +5,11 @@ from .characters import get_character_prompt
5
5
  from .token_balance_tool import mezo_agent_token_balance_tool
6
6
  from .token_price_tool import mezo_agent_token_price_tool
7
7
  from .token_utils import get_token_address_by_symbol
8
- from .twitter_manager import TwitterManager
8
+
9
+ # ✅ Move TwitterManager import inside a function to avoid circular import
10
+ def get_twitter_manager():
11
+ from .twitter_manager import TwitterManager
12
+ return TwitterManager
9
13
 
10
14
  __all__ = [
11
15
  "mezo_agent_transaction_btc",
@@ -15,6 +19,6 @@ __all__ = [
15
19
  "mezo_agent_token_balance_tool",
16
20
  "mezo_agent_token_price_tool",
17
21
  "get_token_address_by_symbol",
18
- "TwitterManager",
22
+ "get_twitter_manager",
19
23
  "get_character_prompt"
20
24
  ]
@@ -0,0 +1,63 @@
1
+ import os
2
+ import json
3
+
4
+ class TwitterManager:
5
+ """
6
+ Manages Twitter clients for MezoAgent characters.
7
+ """
8
+
9
+ def __init__(self, config_file="twitter_config.json"):
10
+ """
11
+ Initializes the Twitter Manager.
12
+
13
+ :param config_file: The JSON file that stores character Twitter credentials.
14
+ """
15
+ self.config_file = config_file
16
+ self.characters = {}
17
+ self.load_characters()
18
+
19
+ def load_characters(self):
20
+ """
21
+ Loads characters and their Twitter credentials from a JSON config file.
22
+ """
23
+ if os.path.exists(self.config_file):
24
+ with open(self.config_file, "r") as f:
25
+ self.characters = json.load(f)
26
+
27
+ def save_characters(self):
28
+ """
29
+ Saves character Twitter credentials to a JSON config file.
30
+ """
31
+ with open(self.config_file, "w") as f:
32
+ json.dump(self.characters, f, indent=4)
33
+
34
+ def add_character(self, character_name: str, api_key: str, api_secret: str, access_token: str, access_secret: str, personality: str):
35
+ """
36
+ Registers a character with Twitter API credentials and starts their Twitter client.
37
+
38
+ :param character_name: Name of the character.
39
+ :param api_key: Twitter API Key.
40
+ :param api_secret: Twitter API Secret Key.
41
+ :param access_token: Twitter Access Token.
42
+ :param access_secret: Twitter Access Token Secret.
43
+ :param personality: Custom personality description for AI-generated tweets.
44
+ """
45
+ from mezo_agent.twitter_client import TwitterClient # ✅ Move import inside the function
46
+
47
+ if character_name in self.characters:
48
+ print(f"❌ Character '{character_name}' already has a Twitter client.")
49
+ return
50
+
51
+ self.characters[character_name] = {
52
+ "api_key": api_key,
53
+ "api_secret": api_secret,
54
+ "access_token": access_token,
55
+ "access_secret": access_secret,
56
+ "personality": personality
57
+ }
58
+ self.save_characters()
59
+ print(f"✅ Character '{character_name}' registered for Twitter with personality!")
60
+
61
+ # Start the Twitter client with personality
62
+ TwitterClient(character_name, api_key, api_secret, access_token, access_secret, personality)
63
+