intentkit 0.8.7__py3-none-any.whl → 0.8.8__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 intentkit might be problematic. Click here for more details.

intentkit/__init__.py CHANGED
@@ -3,7 +3,7 @@
3
3
  A powerful platform for building AI agents with blockchain and cryptocurrency capabilities.
4
4
  """
5
5
 
6
- __version__ = "0.8.7"
6
+ __version__ = "0.8.8"
7
7
  __author__ = "hyacinthus"
8
8
  __email__ = "hyacinthus@gmail.com"
9
9
 
intentkit/core/engine.py CHANGED
@@ -293,6 +293,12 @@ async def stream_agent_raw(
293
293
  # save input message first
294
294
  user_message = await message.save()
295
295
 
296
+ # temporary debug logging for telegram messages
297
+ if user_message.author_type == AuthorType.TELEGRAM:
298
+ logger.info(
299
+ f"[TELEGRAM DEBUG] Agent: {user_message.agent_id} | Chat: {user_message.chat_id} | Message: {user_message.message}"
300
+ )
301
+
296
302
  if re.search(
297
303
  r"(@clear|/clear)(?!\w)",
298
304
  user_message.message.strip(),
intentkit/core/prompt.py CHANGED
@@ -12,6 +12,7 @@ from intentkit.models.agent import Agent
12
12
  from intentkit.models.agent_data import AgentData
13
13
  from intentkit.models.chat import AuthorType
14
14
  from intentkit.models.skill import Skill
15
+ from intentkit.models.user import User
15
16
 
16
17
  # ============================================================================
17
18
  # CONSTANTS AND CONFIGURATION
@@ -120,18 +121,37 @@ def _build_wallet_section(agent: Agent, agent_data: AgentData) -> str:
120
121
  return "\n".join(wallet_parts) + ("\n" if wallet_parts else "")
121
122
 
122
123
 
123
- def _build_user_info_section(context: AgentContext) -> str:
124
+ async def _build_user_info_section(context: AgentContext) -> str:
124
125
  """Build user information section when user_id is a valid EVM wallet address."""
125
126
  if not context.user_id:
126
127
  return ""
127
128
 
128
- # Check if user_id is a valid EVM wallet address
129
- try:
130
- if is_address(context.user_id):
131
- return f"## User Info\n\nThe person you are talking to has wallet address: {context.user_id}\n\n"
132
- except Exception:
133
- # If validation fails, don't include the section
134
- pass
129
+ user = await User.get(context.user_id)
130
+
131
+ prompt_array = []
132
+
133
+ evm_wallet_address = ""
134
+ if user and user.evm_wallet_address:
135
+ evm_wallet_address = user.evm_wallet_address
136
+ elif is_address(context.user_id):
137
+ evm_wallet_address = context.user_id
138
+
139
+ if evm_wallet_address:
140
+ prompt_array.append(
141
+ f"The user you are talking to has EVM wallet address: {evm_wallet_address}\n"
142
+ )
143
+
144
+ if user:
145
+ if user.email:
146
+ prompt_array.append(f"User Email: {user.email}\n")
147
+ if user.x_username:
148
+ prompt_array.append(f"User X Username: {user.x_username}\n")
149
+ if user.telegram_username:
150
+ prompt_array.append(f"User Telegram Username: {user.telegram_username}\n")
151
+
152
+ if prompt_array:
153
+ prompt_array.append("\n")
154
+ return "## User Info\n\n" + "".join(prompt_array)
135
155
 
136
156
  return ""
137
157
 
@@ -397,7 +417,7 @@ def create_formatted_prompt_function(agent: Agent, agent_data: AgentData) -> Cal
397
417
  )
398
418
 
399
419
  # Add user info if user_id is a valid EVM wallet address
400
- user_info = _build_user_info_section(context)
420
+ user_info = await _build_user_info_section(context)
401
421
  if user_info:
402
422
  final_system_prompt = f"{final_system_prompt}{user_info}"
403
423
 
intentkit/models/user.py CHANGED
@@ -322,3 +322,29 @@ class User(UserUpdate):
322
322
  if user is None:
323
323
  return None
324
324
  return user_model_class.model_validate(user)
325
+
326
+ @classmethod
327
+ async def get_by_tg(cls, telegram_username: str) -> Optional[UserModelType]:
328
+ """Get a user by telegram username.
329
+
330
+ Args:
331
+ telegram_username: Telegram username of the user to get
332
+
333
+ Returns:
334
+ User model or None if not found
335
+ """
336
+ user_model_class = user_model_registry.get_user_model_class()
337
+ assert issubclass(user_model_class, User)
338
+ user_table_class = user_model_registry.get_user_table_class()
339
+ assert issubclass(user_table_class, UserTable)
340
+
341
+ async with get_session() as session:
342
+ result = await session.execute(
343
+ select(user_table_class).where(
344
+ user_table_class.telegram_username == telegram_username
345
+ )
346
+ )
347
+ user = result.scalars().first()
348
+ if user is None:
349
+ return None
350
+ return user_model_class.model_validate(user)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: intentkit
3
- Version: 0.8.7
3
+ Version: 0.8.8
4
4
  Summary: Intent-based AI Agent Platform - Core Package
5
5
  Project-URL: Homepage, https://github.com/crestalnetwork/intentkit
6
6
  Project-URL: Repository, https://github.com/crestalnetwork/intentkit
@@ -1,4 +1,4 @@
1
- intentkit/__init__.py,sha256=X74sp-05XPp5JncUXXNbFfozdN1GhkHMElqNLRiUTX4,378
1
+ intentkit/__init__.py,sha256=DcLBjMf2BsKDfY4rNYsjLqXFK_U7Kw38ji8OD6XHZmM,378
2
2
  intentkit/abstracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  intentkit/abstracts/agent.py,sha256=108gb5W8Q1Sy4G55F2_ZFv2-_CnY76qrBtpIr0Oxxqk,1489
4
4
  intentkit/abstracts/api.py,sha256=ZUc24vaQvQVbbjznx7bV0lbbQxdQPfEV8ZxM2R6wZWo,166
@@ -19,9 +19,9 @@ intentkit/core/asset.py,sha256=9hkIgi-QRmr4FQddloEcQ5xdZlnHGFcxekNhss_gHOY,7339
19
19
  intentkit/core/chat.py,sha256=YN20CnDazWLjiOZFOHgV6uHmA2DKkvPCsD5Q5sfNcZg,1685
20
20
  intentkit/core/client.py,sha256=J5K7f08-ucszBKAbn9K3QNOFKIC__7amTbKYii1jFkI,3056
21
21
  intentkit/core/credit.py,sha256=b4f4T6G6eeBTMe0L_r8awWtXgUnqiog4IUaymDPYym0,75587
22
- intentkit/core/engine.py,sha256=CCAo-N3PYxYw13xhiovEqoVWZWbMYdQX3bSaOZ68Ni8,38409
22
+ intentkit/core/engine.py,sha256=cpJfAtq9v_I49OJdnvu1QyOF-oW2V8NPqIpO1j00TlM,38677
23
23
  intentkit/core/node.py,sha256=-QVgmQuMnrzo6cF-4AECOIVT3R4gCnWfQ1EjTm2Sz1g,8791
24
- intentkit/core/prompt.py,sha256=idNx1ono4Maz2i6IBKfaKOBBbEQiWbaSxr2Eb1vZTI4,15482
24
+ intentkit/core/prompt.py,sha256=Lu6olwLLwuPpsl5749ffVh2q_aR7SgxmA_xc8LpmRr4,16095
25
25
  intentkit/core/scheduler.py,sha256=De84aTHYoIH18YPooB_GckHts5oGFZg-XQZQcqFvlXc,2842
26
26
  intentkit/core/statistics.py,sha256=-IZmxIBzyzZuai7QyfPEY1tx8Q8ydmmcm6eqbSSy_6o,6366
27
27
  intentkit/models/agent.py,sha256=TjAnpefyWAv3BVqQUTrp5Kl4Q7mhUqYGHtSRiUPJyKU,69083
@@ -41,7 +41,7 @@ intentkit/models/llm.py,sha256=ZnM6qpk9ouTqFysQzzg8TcAfxXASD-H9f1eHsmVjYv8,22186
41
41
  intentkit/models/redis.py,sha256=Vqb9pjeMQ85Az5GvUbqCsQ5stBpFg3n85p94TB40xEw,3727
42
42
  intentkit/models/skill.py,sha256=n9d1VKWxACe852wMOUC5P7Ps1EUMzIDAYT62Vfs8pQU,20826
43
43
  intentkit/models/skills.csv,sha256=lvQg_1byPvJaHToQbEqRZarfYDuXpP4EXeVJVMc8aDs,19132
44
- intentkit/models/user.py,sha256=23jigwL3h7_wRfrHIOF_lH49V5WXeHsU1jfEOOaMuE0,10536
44
+ intentkit/models/user.py,sha256=M79XT1dF1Ju5HKdE49RALeV_XXen7mIvmP9Lhsx9NFw,11485
45
45
  intentkit/skills/__init__.py,sha256=WkjmKB4xvy36zyXMroPMf_DTPgQloNS3L73nVnBmuQI,303
46
46
  intentkit/skills/base.py,sha256=LJC6-zG4vgRvhkqRx-8syXSSjJBYlLLWperZycZt9jo,7727
47
47
  intentkit/skills/skills.toml,sha256=WQiai9RKIQ2Mqp-eW35_RCn2RW5QLWN3aRgsj7B7OvE,3532
@@ -451,7 +451,7 @@ intentkit/utils/random.py,sha256=DymMxu9g0kuQLgJUqalvgksnIeLdS-v0aRk5nQU0mLI,452
451
451
  intentkit/utils/s3.py,sha256=A8Nsx5QJyLsxhj9g7oHNy2-m24tjQUhC9URm8Qb1jFw,10057
452
452
  intentkit/utils/slack_alert.py,sha256=s7UpRgyzLW7Pbmt8cKzTJgMA9bm4EP-1rQ5KXayHu6E,2264
453
453
  intentkit/utils/tx.py,sha256=2yLLGuhvfBEY5n_GJ8wmIWLCzn0FsYKv5kRNzw_sLUI,1454
454
- intentkit-0.8.7.dist-info/METADATA,sha256=wFGqzyqTzkxLSujkpDJ1bw7aoG8fFx3WzM5gjo_l-cI,6310
455
- intentkit-0.8.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
456
- intentkit-0.8.7.dist-info/licenses/LICENSE,sha256=Bln6DhK-LtcO4aXy-PBcdZv2f24MlJFm_qn222biJtE,1071
457
- intentkit-0.8.7.dist-info/RECORD,,
454
+ intentkit-0.8.8.dist-info/METADATA,sha256=BaEfwO2l_z7J_PJDFDR0TZ5PmzdGyfTnIYTO2BPyWmo,6310
455
+ intentkit-0.8.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
456
+ intentkit-0.8.8.dist-info/licenses/LICENSE,sha256=Bln6DhK-LtcO4aXy-PBcdZv2f24MlJFm_qn222biJtE,1071
457
+ intentkit-0.8.8.dist-info/RECORD,,