mech-client 0.2.18__tar.gz → 0.2.20__tar.gz
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.
- {mech_client-0.2.18 → mech_client-0.2.20}/PKG-INFO +1 -1
- mech_client-0.2.20/mech_client/__init__.py +3 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/configs/mechs.json +3 -2
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn/__init__.py +1 -1
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn/dialogues.py +1 -1
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn/message.py +1 -1
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn/protocol.yaml +4 -4
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn/serialization.py +1 -1
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/p2p_libp2p_client/connection.py +21 -6
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/p2p_libp2p_client/connection.yaml +7 -6
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/interact.py +10 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/subgraph.py +4 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/pyproject.toml +1 -1
- mech_client-0.2.18/mech_client/__init__.py +0 -3
- {mech_client-0.2.18 → mech_client-0.2.20}/LICENSE +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/README.md +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/acn.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/cli.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/__init__.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn/README.md +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn/acn.proto +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn/acn_pb2.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn/custom_types.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn/tests/__init__.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn/tests/test_acn.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn/tests/test_acn_dialogues.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn/tests/test_acn_messages.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn_data_share/README.md +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn_data_share/__init__.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn_data_share/acn_data_share.proto +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn_data_share/acn_data_share_pb2.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn_data_share/dialogues.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn_data_share/message.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn_data_share/protocol.yaml +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn_data_share/serialization.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn_data_share/tests/test_acn_data_share_dialogues.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn_data_share/tests/test_acn_data_share_messages.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/p2p_libp2p_client/README.md +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/p2p_libp2p_client/__init__.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/mech_tool_management.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/prompt_to_ipfs.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/push_to_ipfs.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/to_png.py +0 -0
- {mech_client-0.2.18 → mech_client-0.2.20}/mech_client/wss.py +0 -0
|
@@ -58,8 +58,9 @@
|
|
|
58
58
|
"default_gas_price_strategy": "eip1559",
|
|
59
59
|
"is_gas_estimation_enabled": false
|
|
60
60
|
},
|
|
61
|
-
"gas_limit":
|
|
62
|
-
"
|
|
61
|
+
"gas_limit": 250000,
|
|
62
|
+
"price": 3000000000000,
|
|
63
|
+
"contract_abi_url": "https://api.basescan.org/api?module=contract&action=getabi&address={contract_address}&apikey={api_key}",
|
|
63
64
|
"transaction_url": "https://basescan.org/tx/{transaction_digest}",
|
|
64
65
|
"subgraph_url": ""
|
|
65
66
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# ------------------------------------------------------------------------------
|
|
3
3
|
#
|
|
4
|
-
# Copyright
|
|
4
|
+
# Copyright 2024 valory
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# ------------------------------------------------------------------------------
|
|
3
3
|
#
|
|
4
|
-
# Copyright
|
|
4
|
+
# Copyright 2024 valory
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# ------------------------------------------------------------------------------
|
|
3
3
|
#
|
|
4
|
-
# Copyright
|
|
4
|
+
# Copyright 2024 valory
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
|
@@ -8,13 +8,13 @@ license: Apache-2.0
|
|
|
8
8
|
aea_version: '>=1.0.0, <2.0.0'
|
|
9
9
|
fingerprint:
|
|
10
10
|
README.md: bafybeie7paijucvzemlfhwfmmhorypwuhzbeimgoitlkokdio5c3ne4pjq
|
|
11
|
-
__init__.py:
|
|
11
|
+
__init__.py: bafybeicqlp4gkeeef5osp6zopjztlgat24nxrzq43cy7wbwxk5omf2sc2m
|
|
12
12
|
acn.proto: bafybeidkun7o75sxpyk2sixt7dsykgty62f6dnixnes2irbunyamilqsh4
|
|
13
13
|
acn_pb2.py: bafybeialafz3yomunwa3g5xgrdqwodzl7zg5dncvzuetv7xoew4zhw76ni
|
|
14
14
|
custom_types.py: bafybeigpueuq6mdeyjyayzv3menkmemutfgfiwlozlpl64t67cfnnom24q
|
|
15
|
-
dialogues.py:
|
|
16
|
-
message.py:
|
|
17
|
-
serialization.py:
|
|
15
|
+
dialogues.py: bafybeidjpyk7s3getyfegjdrgrt5blf2yutzqclohaktjehwcj3sqx2ole
|
|
16
|
+
message.py: bafybeiai7kond3rcbtwnr5xgpwzuauf5tusuep6ikopi4cqvp2wa5qfz3e
|
|
17
|
+
serialization.py: bafybeidu7fzixk6sm3iprhph4shbiq5qgvg56lg4yiryfaf3unuqk34bwi
|
|
18
18
|
tests/__init__.py: bafybeidteufp2npjd77ekcftk5e4gbaquq3gike5nxtk5xfmnusls56keu
|
|
19
19
|
tests/test_acn.py: bafybeignjgdtlfdnj25hc5necmg7zl3kvngsmzkjgcwfm5qg36liqa63ki
|
|
20
20
|
tests/test_acn_dialogues.py: bafybeia2kndutaokjpogo4wlb5pf4gkqacvcbngqromf4g4mzu6wyetz7q
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# ------------------------------------------------------------------------------
|
|
3
3
|
#
|
|
4
|
-
# Copyright
|
|
4
|
+
# Copyright 2024 valory
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
{mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/p2p_libp2p_client/connection.py
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# ------------------------------------------------------------------------------
|
|
3
3
|
#
|
|
4
|
-
# Copyright 2022-
|
|
4
|
+
# Copyright 2022-2024 Valory AG
|
|
5
5
|
# Copyright 2018-2019 Fetch.AI Limited
|
|
6
6
|
#
|
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -279,6 +279,7 @@ class P2PLibp2pClientConnection(Connection):
|
|
|
279
279
|
connection_id = PUBLIC_ID
|
|
280
280
|
|
|
281
281
|
DEFAULT_CONNECT_RETRIES = 3
|
|
282
|
+
DEFAULT_RESEND_ENVELOPE_RETRY = 1
|
|
282
283
|
DEFAULT_TLS_CONNECTION_SIGNATURE_TIMEOUT = 5.0
|
|
283
284
|
|
|
284
285
|
def __init__(self, **kwargs: Any) -> None:
|
|
@@ -292,6 +293,9 @@ class P2PLibp2pClientConnection(Connection):
|
|
|
292
293
|
self.connect_retries = self.configuration.config.get(
|
|
293
294
|
"connect_retries", self.DEFAULT_CONNECT_RETRIES
|
|
294
295
|
)
|
|
296
|
+
self.resend_envelope_retry = self.configuration.config.get(
|
|
297
|
+
"resend_envelope_retry", self.DEFAULT_RESEND_ENVELOPE_RETRY
|
|
298
|
+
)
|
|
295
299
|
ledger_id = self.configuration.config.get("ledger_id", DEFAULT_LEDGER)
|
|
296
300
|
if ledger_id not in SUPPORTED_LEDGER_IDS:
|
|
297
301
|
raise ValueError( # pragma: nocover
|
|
@@ -386,11 +390,17 @@ class P2PLibp2pClientConnection(Connection):
|
|
|
386
390
|
)
|
|
387
391
|
await asyncio.shield(self.disconnect())
|
|
388
392
|
|
|
389
|
-
async def _send_envelope_with_node_client(
|
|
393
|
+
async def _send_envelope_with_node_client(
|
|
394
|
+
self, envelope: Envelope, retry_counter: int = 0
|
|
395
|
+
) -> None:
|
|
390
396
|
"""Send envelope with node client, reconnect and retry on fail."""
|
|
391
397
|
if not self._node_client: # pragma: nocover
|
|
392
398
|
raise ValueError("Connection not connected to node!")
|
|
393
|
-
|
|
399
|
+
if retry_counter > self.resend_envelope_retry:
|
|
400
|
+
self.logger.warning(
|
|
401
|
+
f"Dropping envelope {envelope}. It failed after retry. "
|
|
402
|
+
)
|
|
403
|
+
return
|
|
394
404
|
self._ensure_valid_envelope_for_external_comms(envelope)
|
|
395
405
|
try:
|
|
396
406
|
await self._node_client.send_envelope(envelope)
|
|
@@ -399,7 +409,7 @@ class P2PLibp2pClientConnection(Connection):
|
|
|
399
409
|
"Exception raised on message send. Try reconnect and send again."
|
|
400
410
|
)
|
|
401
411
|
await self._perform_connection_to_node()
|
|
402
|
-
await self.
|
|
412
|
+
await self._send_envelope_with_node_client(envelope, retry_counter + 1)
|
|
403
413
|
|
|
404
414
|
async def connect(self) -> None:
|
|
405
415
|
"""Set up the connection."""
|
|
@@ -584,9 +594,14 @@ class P2PLibp2pClientConnection(Connection):
|
|
|
584
594
|
envelope = await self._read_envelope_from_node()
|
|
585
595
|
if self._in_queue is None:
|
|
586
596
|
raise ValueError("Input queue not initialized.") # pragma: nocover
|
|
587
|
-
self.
|
|
597
|
+
self.logger.debug(f"Received envelope: {envelope}")
|
|
588
598
|
if envelope is None:
|
|
589
|
-
|
|
599
|
+
# give it time to recover
|
|
600
|
+
# twice the amount what we wait for ACK timeouts
|
|
601
|
+
timeout = NodeClient.ACN_ACK_TIMEOUT * 2
|
|
602
|
+
await asyncio.sleep(timeout)
|
|
603
|
+
continue # pragma: no cover
|
|
604
|
+
self._in_queue.put_nowait(envelope)
|
|
590
605
|
|
|
591
606
|
|
|
592
607
|
class TCPSocketChannelClientTLS(TCPSocketChannelClient):
|
{mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/p2p_libp2p_client/connection.yaml
RENAMED
|
@@ -10,14 +10,15 @@ aea_version: '>=1.0.0, <2.0.0'
|
|
|
10
10
|
fingerprint:
|
|
11
11
|
README.md: bafybeiaf5kdnfdc2jifojgniib76zl2c4utnx7ofewc3szqkrxsby62ulu
|
|
12
12
|
__init__.py: bafybeid2azroxglu6fl7bxdfcsv3j77vyzgpikjnfwpxg73zeb5orez6ju
|
|
13
|
-
connection.py:
|
|
13
|
+
connection.py: bafybeihcwyo5nhxmsjxw7qrrvkvp7qu6izbgzgipmmnrpdvc6jtwmw7vgy
|
|
14
14
|
fingerprint_ignore_patterns: []
|
|
15
15
|
connections: []
|
|
16
16
|
protocols:
|
|
17
|
-
- valory/acn:1.1.0:
|
|
17
|
+
- valory/acn:1.1.0:bafybeidluaoeakae3exseupaea4i3yvvk5vivyt227xshjlffywwxzcxqe
|
|
18
18
|
class_name: P2PLibp2pClientConnection
|
|
19
19
|
config:
|
|
20
20
|
connect_retries: 3
|
|
21
|
+
resend_envelope_retry: 1
|
|
21
22
|
ledger_id: cosmos
|
|
22
23
|
nodes:
|
|
23
24
|
- uri: acn.staging.autonolas.tech:9005
|
|
@@ -29,15 +30,15 @@ cert_requests:
|
|
|
29
30
|
- identifier: acn
|
|
30
31
|
ledger_id: ethereum
|
|
31
32
|
message_format: '{public_key}'
|
|
32
|
-
not_after: '
|
|
33
|
-
not_before: '
|
|
33
|
+
not_after: '2025-01-01'
|
|
34
|
+
not_before: '2024-01-01'
|
|
34
35
|
public_key: 02d3a830c9d6ea1ae91936951430dee11f4662f33118b02190693be835359a9d77
|
|
35
36
|
save_path: .certs/acn_cosmos_9005.txt
|
|
36
37
|
- identifier: acn
|
|
37
38
|
ledger_id: ethereum
|
|
38
39
|
message_format: '{public_key}'
|
|
39
|
-
not_after: '
|
|
40
|
-
not_before: '
|
|
40
|
+
not_after: '2025-01-01'
|
|
41
|
+
not_before: '2024-01-01'
|
|
41
42
|
public_key: 02e741c62d706e1dcf6986bf37fa74b98681bc32669623ac9ee6ff72488d4f59e8
|
|
42
43
|
save_path: .certs/acn_cosmos_9006.txt
|
|
43
44
|
excluded_protocols: []
|
|
@@ -112,6 +112,7 @@ class MechConfig: # pylint: disable=too-many-instance-attributes
|
|
|
112
112
|
contract_abi_url: str
|
|
113
113
|
transaction_url: str
|
|
114
114
|
subgraph_url: str
|
|
115
|
+
price: int
|
|
115
116
|
|
|
116
117
|
def __post_init__(self) -> None:
|
|
117
118
|
"""Post initialization to override with environment variables."""
|
|
@@ -143,6 +144,13 @@ class MechConfig: # pylint: disable=too-many-instance-attributes
|
|
|
143
144
|
if subgraph_url:
|
|
144
145
|
self.subgraph_url = subgraph_url
|
|
145
146
|
|
|
147
|
+
api_key = os.getenv("MECHX_API_KEY")
|
|
148
|
+
if api_key:
|
|
149
|
+
updated_contract_abi_url = self.contract_abi_url.replace(
|
|
150
|
+
"{api_key}", api_key
|
|
151
|
+
)
|
|
152
|
+
self.contract_abi_url = updated_contract_abi_url
|
|
153
|
+
|
|
146
154
|
|
|
147
155
|
class ConfirmationType(Enum):
|
|
148
156
|
"""Verification type."""
|
|
@@ -587,11 +595,13 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
587
595
|
deliver_signature=deliver_event_signature,
|
|
588
596
|
)
|
|
589
597
|
print("Sending Mech request...")
|
|
598
|
+
price = mech_config.price or 10_000_000_000_000_000
|
|
590
599
|
transaction_digest = send_request(
|
|
591
600
|
crypto=crypto,
|
|
592
601
|
ledger_api=ledger_api,
|
|
593
602
|
mech_contract=mech_contract,
|
|
594
603
|
gas_limit=mech_config.gas_limit,
|
|
604
|
+
price=price,
|
|
595
605
|
prompt=prompt,
|
|
596
606
|
tool=tool,
|
|
597
607
|
extra_attributes=extra_attributes,
|
|
@@ -70,8 +70,12 @@ def query_agent_address( # pylint: disable=too-many-return-statements
|
|
|
70
70
|
:rtype: Optional[str]
|
|
71
71
|
"""
|
|
72
72
|
# temporary hard coded until subgraph present
|
|
73
|
+
if chain_config == "base" and agent_id == 1:
|
|
74
|
+
return "0x37C484cc34408d0F827DB4d7B6e54b8837Bf8BDA"
|
|
73
75
|
if chain_config == "base" and agent_id == 2:
|
|
74
76
|
return "0x111D7DB1B752AB4D2cC0286983D9bd73a49bac6c"
|
|
77
|
+
if chain_config == "base" and agent_id == 3:
|
|
78
|
+
return "0x111D7DB1B752AB4D2cC0286983D9bd73a49bac6c"
|
|
75
79
|
if chain_config == "arbitrum" and agent_id == 2:
|
|
76
80
|
return "0x1FDAD3a5af5E96e5a64Fc0662B1814458F114597"
|
|
77
81
|
if chain_config == "polygon" and agent_id == 2:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn/tests/test_acn_dialogues.py
RENAMED
|
File without changes
|
{mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn/tests/test_acn_messages.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn_data_share/acn_data_share.proto
RENAMED
|
File without changes
|
{mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn_data_share/acn_data_share_pb2.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mech_client-0.2.18 → mech_client-0.2.20}/mech_client/helpers/acn_data_share/serialization.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|