intentkit 0.8.13.dev2__py3-none-any.whl → 0.8.13.dev3__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 +1 -1
- intentkit/skills/x402/ask_agent.py +62 -3
- {intentkit-0.8.13.dev2.dist-info → intentkit-0.8.13.dev3.dist-info}/METADATA +1 -1
- {intentkit-0.8.13.dev2.dist-info → intentkit-0.8.13.dev3.dist-info}/RECORD +6 -6
- {intentkit-0.8.13.dev2.dist-info → intentkit-0.8.13.dev3.dist-info}/WHEEL +0 -0
- {intentkit-0.8.13.dev2.dist-info → intentkit-0.8.13.dev3.dist-info}/licenses/LICENSE +0 -0
intentkit/__init__.py
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import threading
|
|
1
2
|
from typing import Any, Dict, Optional, Type
|
|
2
3
|
|
|
4
|
+
from coinbase_agentkit.wallet_providers.evm_wallet_provider import (
|
|
5
|
+
EvmWalletSigner as CoinbaseEvmWalletSigner,
|
|
6
|
+
)
|
|
3
7
|
from langchain_core.tools import ToolException
|
|
4
8
|
from pydantic import BaseModel, Field
|
|
5
9
|
from x402.clients.httpx import x402HttpxClient
|
|
6
10
|
|
|
11
|
+
from intentkit.clients import get_wallet_provider
|
|
7
12
|
from intentkit.config.config import config
|
|
8
13
|
from intentkit.models.chat import AuthorType
|
|
9
14
|
from intentkit.skills.x402.base import X402BaseSkill
|
|
@@ -42,8 +47,10 @@ class X402AskAgent(X402BaseSkill):
|
|
|
42
47
|
if not base_url:
|
|
43
48
|
raise ValueError("X402 API base URL is not configured.")
|
|
44
49
|
|
|
45
|
-
#
|
|
46
|
-
|
|
50
|
+
# Use wallet provider signer to satisfy eth_account.BaseAccount interface requirements
|
|
51
|
+
context = self.get_context()
|
|
52
|
+
wallet_provider = await get_wallet_provider(context.agent)
|
|
53
|
+
account = ThreadSafeEvmWalletSigner(wallet_provider)
|
|
47
54
|
|
|
48
55
|
payload: Dict[str, Any] = {
|
|
49
56
|
"agent_id": agent_id,
|
|
@@ -56,7 +63,7 @@ class X402AskAgent(X402BaseSkill):
|
|
|
56
63
|
payload["super_mode"] = super_mode
|
|
57
64
|
|
|
58
65
|
async with x402HttpxClient(
|
|
59
|
-
account=
|
|
66
|
+
account=account,
|
|
60
67
|
base_url=base_url,
|
|
61
68
|
timeout=20.0,
|
|
62
69
|
) as client:
|
|
@@ -80,3 +87,55 @@ class X402AskAgent(X402BaseSkill):
|
|
|
80
87
|
raise ToolException("Agent response did not include message text.")
|
|
81
88
|
|
|
82
89
|
return str(content)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class ThreadSafeEvmWalletSigner(CoinbaseEvmWalletSigner):
|
|
93
|
+
"""EVM wallet signer that avoids nested event loop errors.
|
|
94
|
+
|
|
95
|
+
Coinbase's signer runs async wallet calls in the current thread. When invoked
|
|
96
|
+
inside an active asyncio loop (as happens in async skills), it trips over the
|
|
97
|
+
loop already running. We hop work to a background thread so the provider can
|
|
98
|
+
spin up its own loop safely.
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
def _run_in_thread(self, func: Any, *args: Any, **kwargs: Any) -> Any:
|
|
102
|
+
result: list[Any] = []
|
|
103
|
+
error: list[BaseException] = []
|
|
104
|
+
|
|
105
|
+
def _target() -> None:
|
|
106
|
+
try:
|
|
107
|
+
result.append(func(*args, **kwargs))
|
|
108
|
+
except BaseException as exc: # pragma: no cover - bubble up original error
|
|
109
|
+
error.append(exc)
|
|
110
|
+
|
|
111
|
+
thread = threading.Thread(target=_target, daemon=True)
|
|
112
|
+
thread.start()
|
|
113
|
+
thread.join()
|
|
114
|
+
|
|
115
|
+
if error:
|
|
116
|
+
raise error[0]
|
|
117
|
+
return result[0] if result else None
|
|
118
|
+
|
|
119
|
+
def unsafe_sign_hash(self, message_hash: Any) -> Any:
|
|
120
|
+
return self._run_in_thread(super().unsafe_sign_hash, message_hash)
|
|
121
|
+
|
|
122
|
+
def sign_message(self, signable_message: Any) -> Any:
|
|
123
|
+
return self._run_in_thread(super().sign_message, signable_message)
|
|
124
|
+
|
|
125
|
+
def sign_transaction(self, transaction_dict: Any) -> Any:
|
|
126
|
+
return self._run_in_thread(super().sign_transaction, transaction_dict)
|
|
127
|
+
|
|
128
|
+
def sign_typed_data(
|
|
129
|
+
self,
|
|
130
|
+
domain_data: Optional[Dict[str, Any]] = None,
|
|
131
|
+
message_types: Optional[Dict[str, Any]] = None,
|
|
132
|
+
message_data: Optional[Dict[str, Any]] = None,
|
|
133
|
+
full_message: Optional[Dict[str, Any]] = None,
|
|
134
|
+
) -> Any:
|
|
135
|
+
return self._run_in_thread(
|
|
136
|
+
super().sign_typed_data,
|
|
137
|
+
domain_data=domain_data,
|
|
138
|
+
message_types=message_types,
|
|
139
|
+
message_data=message_data,
|
|
140
|
+
full_message=full_message,
|
|
141
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: intentkit
|
|
3
|
-
Version: 0.8.13.
|
|
3
|
+
Version: 0.8.13.dev3
|
|
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=
|
|
1
|
+
intentkit/__init__.py,sha256=aed72E3E1e647h-JvVmtVM1Jq4PY6LGQuaG_P0_MINo,384
|
|
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
|
|
@@ -437,7 +437,7 @@ intentkit/skills/wow/base.py,sha256=nFt8sJtQQsu2_ZlRasXhyG148fSJYRL-20kEt380PaE,
|
|
|
437
437
|
intentkit/skills/wow/schema.json,sha256=jGpugebVupGTlOUYNu7fN99p-zL-cfaoOYSX7KW8VQc,2292
|
|
438
438
|
intentkit/skills/wow/wow.svg,sha256=PO0-m6TZjJCql9r1oWohlRV5PyqGc5kIDUEnpP2-5SU,427
|
|
439
439
|
intentkit/skills/x402/__init__.py,sha256=tAO80tBlMluExByWiQ_r2GZlaAYTMsaWxCXDREaqqAg,1315
|
|
440
|
-
intentkit/skills/x402/ask_agent.py,sha256=
|
|
440
|
+
intentkit/skills/x402/ask_agent.py,sha256=9zp73uHmYZXnJQtEF7SRxC8N36e41cOwsNqVFo2Q9IQ,5053
|
|
441
441
|
intentkit/skills/x402/base.py,sha256=KhC9CWFEgdfQjWH1QCRJiNSWCnmgypVIe1ap1hb3X5E,211
|
|
442
442
|
intentkit/skills/x402/schema.json,sha256=1mYBzi5t3nSgSBzRv5imAAPG1hEGUWp_-QGJ1vyymoA,1069
|
|
443
443
|
intentkit/skills/x402/x402.png,sha256=0BTtwDFlbdily3dA7ZANZYujEI_2_Ll3_D_091jBDws,68
|
|
@@ -458,7 +458,7 @@ intentkit/utils/s3.py,sha256=A8Nsx5QJyLsxhj9g7oHNy2-m24tjQUhC9URm8Qb1jFw,10057
|
|
|
458
458
|
intentkit/utils/schema.py,sha256=ATeTskEO2Y-MLFcOJEm5BoFJvxqc_zqQwiRS3rO4XDQ,3428
|
|
459
459
|
intentkit/utils/slack_alert.py,sha256=s7UpRgyzLW7Pbmt8cKzTJgMA9bm4EP-1rQ5KXayHu6E,2264
|
|
460
460
|
intentkit/utils/tx.py,sha256=2yLLGuhvfBEY5n_GJ8wmIWLCzn0FsYKv5kRNzw_sLUI,1454
|
|
461
|
-
intentkit-0.8.13.
|
|
462
|
-
intentkit-0.8.13.
|
|
463
|
-
intentkit-0.8.13.
|
|
464
|
-
intentkit-0.8.13.
|
|
461
|
+
intentkit-0.8.13.dev3.dist-info/METADATA,sha256=Hi4VzX9QFTnF9lEEPBgeWKxT7W-_u_DHLWjSQx9iDqU,6316
|
|
462
|
+
intentkit-0.8.13.dev3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
463
|
+
intentkit-0.8.13.dev3.dist-info/licenses/LICENSE,sha256=Bln6DhK-LtcO4aXy-PBcdZv2f24MlJFm_qn222biJtE,1071
|
|
464
|
+
intentkit-0.8.13.dev3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|