intentkit 0.8.3.dev1__py3-none-any.whl → 0.8.4__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.3-dev1"
6
+ __version__ = "0.8.4"
7
7
  __author__ = "hyacinthus"
8
8
  __email__ = "hyacinthus@gmail.com"
9
9
 
intentkit/clients/cdp.py CHANGED
@@ -13,8 +13,9 @@ from eth_keys.datatypes import PrivateKey
13
13
  from eth_utils import to_checksum_address
14
14
 
15
15
  from intentkit.config.config import config
16
- from intentkit.models.agent import Agent # noqa: E402
16
+ from intentkit.models.agent import Agent, AgentTable # noqa: E402
17
17
  from intentkit.models.agent_data import AgentData
18
+ from intentkit.models.db import get_session
18
19
  from intentkit.utils.error import IntentKitAPIError # noqa: E402
19
20
 
20
21
  _wallet_providers: Dict[str, Tuple[str, str, CdpEvmWalletProvider]] = {}
@@ -144,6 +145,13 @@ async def get_wallet_provider(agent: Agent) -> CdpEvmWalletProvider:
144
145
 
145
146
  agent_data.evm_wallet_address = address
146
147
  await agent_data.save()
148
+ # Update agent slug with evm_wallet_address if slug is null or empty
149
+ if not agent.slug:
150
+ async with get_session() as db:
151
+ db_agent = await db.get(AgentTable, agent.id)
152
+ if db_agent:
153
+ db_agent.slug = agent_data.evm_wallet_address
154
+ await db.commit()
147
155
 
148
156
  wallet_provider_config = CdpEvmWalletProviderConfig(
149
157
  api_key_id=api_key_id,
@@ -14,12 +14,16 @@ from tweepy.asynchronous import AsyncClient
14
14
  from intentkit.abstracts.skill import SkillStoreABC
15
15
  from intentkit.abstracts.twitter import TwitterABC
16
16
  from intentkit.models.agent_data import AgentData
17
+ from intentkit.models.redis import get_redis
17
18
 
18
19
  logger = logging.getLogger(__name__)
19
20
 
20
21
  _clients_linked: Dict[str, "TwitterClient"] = {}
21
22
  _clients_self_key: Dict[str, "TwitterClient"] = {}
22
23
 
24
+ _VERIFIER_KEY = "intentkit:twitter:code_verifier"
25
+ _CHALLENGE_KEY = "intentkit:twitter:code_challenge"
26
+
23
27
 
24
28
  class TwitterMedia(BaseModel):
25
29
  """Model representing Twitter media from the API response."""
@@ -460,17 +464,33 @@ class OAuth2UserHandler(OAuth2Session):
460
464
  self.auth = HTTPBasicAuth(client_id, client_secret)
461
465
  else:
462
466
  self.auth = None
463
- self.code_challenge = self._client.create_code_challenge(
464
- self._client.create_code_verifier(128), "S256"
465
- )
467
+ self.code_verifier = None
468
+ self.code_challenge = None
466
469
 
467
- def get_authorization_url(self, agent_id: str, redirect_uri: str):
470
+ async def get_authorization_url(self, agent_id: str, redirect_uri: str):
468
471
  """Get the authorization URL to redirect the user to
469
472
 
470
473
  Args:
471
474
  agent_id: ID of the agent to authenticate
472
475
  redirect_uri: URI to redirect to after authorization
473
476
  """
477
+ if not self.code_challenge:
478
+ try:
479
+ kv = await get_redis()
480
+ self.code_verifier = await kv.get(_VERIFIER_KEY)
481
+ self.code_challenge = await kv.get(_CHALLENGE_KEY)
482
+ if not self.code_verifier or not self.code_challenge:
483
+ self.code_verifier = self._client.create_code_verifier(128)
484
+ self.code_challenge = self._client.create_code_challenge(
485
+ self.code_verifier, "S256"
486
+ )
487
+ await kv.set(_VERIFIER_KEY, self.code_verifier)
488
+ await kv.set(_CHALLENGE_KEY, self.code_challenge)
489
+ except Exception:
490
+ self.code_verifier = self._client.create_code_verifier(128)
491
+ self.code_challenge = self._client.create_code_challenge(
492
+ self.code_verifier, "S256"
493
+ )
474
494
  state_params = {"agent_id": agent_id, "redirect_uri": redirect_uri}
475
495
  authorization_url, _ = self.authorization_url(
476
496
  "https://x.com/i/oauth2/authorize",
@@ -484,12 +504,14 @@ class OAuth2UserHandler(OAuth2Session):
484
504
  """After user has authorized the app, fetch access token with
485
505
  authorization response URL
486
506
  """
507
+ if not self.code_verifier or not self.code_challenge:
508
+ raise ValueError("Code verifier or challenge not init")
487
509
  return super().fetch_token(
488
510
  "https://api.x.com/2/oauth2/token",
489
511
  authorization_response=authorization_response,
490
512
  auth=self.auth,
491
513
  include_client_id=True,
492
- code_verifier=self._client.code_verifier,
514
+ code_verifier=self.code_verifier,
493
515
  )
494
516
 
495
517
  def refresh(self, refresh_token: str):
intentkit/core/agent.py CHANGED
@@ -83,13 +83,6 @@ async def process_agent_wallet(
83
83
  if config.cdp_api_key_id and current_wallet_provider == "cdp":
84
84
  await get_wallet_provider(agent)
85
85
  agent_data = await AgentData.get(agent.id)
86
- # Update agent slug with evm_wallet_address if slug is null or empty
87
- if not agent.slug:
88
- async with get_session() as db:
89
- db_agent = await db.get(AgentTable, agent.id)
90
- if db_agent:
91
- db_agent.slug = agent_data.evm_wallet_address
92
- await db.commit()
93
86
  elif current_wallet_provider == "readonly":
94
87
  agent_data = await AgentData.patch(
95
88
  agent.id,
@@ -6,7 +6,7 @@
6
6
  "x-icon": "https://ai.service.crestal.dev/skills/cookiefun/cookiefun.png",
7
7
  "x-tags": [
8
8
  "Analytics",
9
- "Communication"
9
+ "Social"
10
10
  ],
11
11
  "x-nft-requirement": 10,
12
12
  "properties": {
@@ -150,4 +150,4 @@
150
150
  }
151
151
  },
152
152
  "additionalProperties": true
153
- }
153
+ }
@@ -5,7 +5,8 @@
5
5
  "description": "Integration with X API enabling social media interactions including retrieving posts, mentions, user information, and posting content with media support",
6
6
  "x-icon": "https://ai.service.crestal.dev/skills/twitter/twitter.png",
7
7
  "x-tags": [
8
- "Communication"
8
+ "Communication",
9
+ "Social"
9
10
  ],
10
11
  "properties": {
11
12
  "enabled": {
@@ -255,4 +256,4 @@
255
256
  }
256
257
  },
257
258
  "additionalProperties": true
258
- }
259
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: intentkit
3
- Version: 0.8.3.dev1
3
+ Version: 0.8.4
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=X3lzpQ9Ui-DnUm-ZaFAwV218O0GxVL1s-uAfKkfWrx8,383
1
+ intentkit/__init__.py,sha256=5vxn227V5a8_4bdQ8hK23g9XbrscGmf6mnWZVVNGV_8,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
@@ -7,13 +7,13 @@ intentkit/abstracts/graph.py,sha256=fTkAHb4nf95Klg_yYEv1pliw3aVhGgNLiZPlz3Hl11c,
7
7
  intentkit/abstracts/skill.py,sha256=cIJ6BkASD31U1IEkE8rdAawq99w_xsg0lt3oalqa1ZA,5071
8
8
  intentkit/abstracts/twitter.py,sha256=cEtP7ygR_b-pHdc9i8kBuyooz1cPoGUGwsBHDpowJyY,1262
9
9
  intentkit/clients/__init__.py,sha256=YmXSif963E5rUfkfHaI6JdWRFU5yNa_yJwafs2KEIVo,406
10
- intentkit/clients/cdp.py,sha256=eUsy8r9zSHzogATyHLcm5pOn771gUI4gH3Mt0Jq-shQ,5392
11
- intentkit/clients/twitter.py,sha256=Lfa7srHOFnY96SXcElW0jfg7XKS_WliWnXjPZEe6SQc,18976
10
+ intentkit/clients/cdp.py,sha256=A-cczpek9iPw6dDxKub_BOjCAtpIbUP_MYYP06fYW90,5791
11
+ intentkit/clients/twitter.py,sha256=2g2XGbTISGOcQYk5K7J5BzPdwqCfhts9YZmGhJAeOLY,20094
12
12
  intentkit/clients/web3.py,sha256=iFjjingL9Aqh3kwUUKN8Tw5N66o2SE_bfo6OhqI-6SU,890
13
13
  intentkit/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  intentkit/config/config.py,sha256=kw9F-uLsJd-knCKmYNb-hqR7x7HUXUkNg5FZCgOPH54,8868
15
15
  intentkit/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- intentkit/core/agent.py,sha256=mDIcIr3GJDQUZX8k--LrT49W07L7IX4ufUbFh5ScqE4,38359
16
+ intentkit/core/agent.py,sha256=GLdd9Rh6aTdiU514R_aze7zuq4PgnDO7SDlwUAQrMyA,38016
17
17
  intentkit/core/api.py,sha256=WfoaHNquujYJIpNPuTR1dSaaxog0S3X2W4lG9Ehmkm4,3284
18
18
  intentkit/core/asset.py,sha256=9hkIgi-QRmr4FQddloEcQ5xdZlnHGFcxekNhss_gHOY,7339
19
19
  intentkit/core/chat.py,sha256=YN20CnDazWLjiOZFOHgV6uHmA2DKkvPCsD5Q5sfNcZg,1685
@@ -106,7 +106,7 @@ intentkit/skills/cookiefun/get_account_details.py,sha256=kDeg-_oWmyVg3GVXo0Q2eiW
106
106
  intentkit/skills/cookiefun/get_account_feed.py,sha256=1oVahOiLM9lZxHzZBS3UFRkPQzUnqrdXAL_OFyXIi0I,10835
107
107
  intentkit/skills/cookiefun/get_account_smart_followers.py,sha256=dOuUcb9piyCBz8SAlMA9Fw_1oCcuNekdBSfA2yWOHm0,7683
108
108
  intentkit/skills/cookiefun/get_sectors.py,sha256=YF3CFjiiQ2xtXRzYPGUoqTcRjNgNX9lSezgmRu2h7G0,5417
109
- intentkit/skills/cookiefun/schema.json,sha256=nc_0Iz0Ghj05gsTyHMtoSFLL0RZR5bipbQ7Ws3WTufY,4522
109
+ intentkit/skills/cookiefun/schema.json,sha256=jleyFSy8hzgLWI0fzxMbY-5ehyjCrGhkUPYX1RdP4V8,4514
110
110
  intentkit/skills/cookiefun/search_accounts.py,sha256=3tlSSPNlL7DVkuEPr30cvceY99nPEarhTSA5aK3iHic,8722
111
111
  intentkit/skills/cryptocompare/__init__.py,sha256=xAsUcZjqNKvKSe5EXe_7DnDaVnm7ykbBXKwI1JlgoCU,3852
112
112
  intentkit/skills/cryptocompare/api.py,sha256=6WcnqhxElHaLJXCCNjNBPKS6Fdivpgfg3d8U4Thuk2E,5650
@@ -370,7 +370,7 @@ intentkit/skills/twitter/like_tweet.py,sha256=KWX4rh1s_Y9gx_JMCKt3ew7HsIQhRlVyPD
370
370
  intentkit/skills/twitter/post_tweet.py,sha256=UocAXACT5lm_VKI0Xn1Ok6qpOw4AvgMjj2dooD6cTUw,3712
371
371
  intentkit/skills/twitter/reply_tweet.py,sha256=TCnI9tW97L35S1c7SddzYxsUI0G8l03w7HkgX0EtmTI,3954
372
372
  intentkit/skills/twitter/retweet.py,sha256=vyQgFutLrLqjo43YDZrEW-uKsZMZ6gTrPf0MHCXttnU,2417
373
- intentkit/skills/twitter/schema.json,sha256=W8TMug9kA8shKA_G7MafNxcHXp5OLSGeW654OO1tsPc,6985
373
+ intentkit/skills/twitter/schema.json,sha256=c3bL6rHTnPTwWxJ7kBjlvl6UR1z4tewW9MWu7AbmJVA,6998
374
374
  intentkit/skills/twitter/search_tweets.py,sha256=oR-dF3oIPDGjZKy1LN6ifG7GqJ9Ef5YYSuYlBalE9hY,3998
375
375
  intentkit/skills/twitter/twitter.png,sha256=MggF-4UC40K2mf1K0hqsIFzCmw-n_2yMSH50MjxvZso,23879
376
376
  intentkit/skills/unrealspeech/__init__.py,sha256=1A8084j67jltD4njAsCJVTP7IsPYxTghz2IbtuNS4O8,1588
@@ -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.3.dev1.dist-info/METADATA,sha256=qLfgW3gQU-2Hd-SYATFdxAh5Syvh8-iwN_X8ILB8Ro8,6315
455
- intentkit-0.8.3.dev1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
456
- intentkit-0.8.3.dev1.dist-info/licenses/LICENSE,sha256=Bln6DhK-LtcO4aXy-PBcdZv2f24MlJFm_qn222biJtE,1071
457
- intentkit-0.8.3.dev1.dist-info/RECORD,,
454
+ intentkit-0.8.4.dist-info/METADATA,sha256=URkuMQ2gFsvph6pBXpMtb9vOWzJicW3NtarCgw0ZDlQ,6310
455
+ intentkit-0.8.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
456
+ intentkit-0.8.4.dist-info/licenses/LICENSE,sha256=Bln6DhK-LtcO4aXy-PBcdZv2f24MlJFm_qn222biJtE,1071
457
+ intentkit-0.8.4.dist-info/RECORD,,