acp-plugin-gamesdk 0.1.13__tar.gz → 0.1.15__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.
- {acp_plugin_gamesdk-0.1.13 → acp_plugin_gamesdk-0.1.15}/PKG-INFO +1 -1
- {acp_plugin_gamesdk-0.1.13 → acp_plugin_gamesdk-0.1.15}/acp_plugin_gamesdk/acp_plugin.py +18 -13
- {acp_plugin_gamesdk-0.1.13 → acp_plugin_gamesdk-0.1.15}/acp_plugin_gamesdk/interface.py +10 -3
- {acp_plugin_gamesdk-0.1.13 → acp_plugin_gamesdk-0.1.15}/pyproject.toml +1 -1
- {acp_plugin_gamesdk-0.1.13 → acp_plugin_gamesdk-0.1.15}/README.md +0 -0
- {acp_plugin_gamesdk-0.1.13 → acp_plugin_gamesdk-0.1.15}/acp_plugin_gamesdk/acp_client.py +0 -0
- {acp_plugin_gamesdk-0.1.13 → acp_plugin_gamesdk-0.1.15}/acp_plugin_gamesdk/acp_token.py +0 -0
- {acp_plugin_gamesdk-0.1.13 → acp_plugin_gamesdk-0.1.15}/acp_plugin_gamesdk/acp_token_abi.py +0 -0
@@ -13,7 +13,6 @@ import socketio.client
|
|
13
13
|
from game_sdk.game.agent import WorkerConfig
|
14
14
|
from game_sdk.game.custom_types import Argument, Function, FunctionResultStatus
|
15
15
|
from twitter_plugin_gamesdk.twitter_plugin import TwitterPlugin
|
16
|
-
from twitter_plugin_gamesdk.game_twitter_plugin import GameTwitterPlugin
|
17
16
|
from acp_plugin_gamesdk.acp_client import AcpClient
|
18
17
|
from acp_plugin_gamesdk.acp_token import AcpToken
|
19
18
|
from acp_plugin_gamesdk.interface import AcpJobPhasesDesc, IDeliverable, IInventory, AcpJob
|
@@ -22,7 +21,7 @@ from acp_plugin_gamesdk.interface import AcpJobPhasesDesc, IDeliverable, IInvent
|
|
22
21
|
class AcpPluginOptions:
|
23
22
|
api_key: str
|
24
23
|
acp_token_client: AcpToken
|
25
|
-
twitter_plugin: TwitterPlugin
|
24
|
+
twitter_plugin: TwitterPlugin = None
|
26
25
|
cluster: Optional[str] = None
|
27
26
|
evaluator_cluster: Optional[str] = None
|
28
27
|
on_evaluate: Optional[Callable[[IDeliverable], Tuple[bool, str]]] = None
|
@@ -168,7 +167,7 @@ class AcpPlugin:
|
|
168
167
|
self.deliver_job,
|
169
168
|
]
|
170
169
|
|
171
|
-
def get_environment(
|
170
|
+
def get_environment() -> Dict[str, Any]:
|
172
171
|
environment = data.get_environment() if hasattr(data, "get_environment") else {}
|
173
172
|
return {
|
174
173
|
**environment,
|
@@ -335,8 +334,14 @@ class AcpPlugin:
|
|
335
334
|
try:
|
336
335
|
state = self.get_acp_state()
|
337
336
|
|
338
|
-
|
339
|
-
|
337
|
+
existing_job = next(
|
338
|
+
(job for job in state["jobs"]["active"]["asABuyer"]
|
339
|
+
if job["providerAddress"] == sellerWalletAddress),
|
340
|
+
None
|
341
|
+
)
|
342
|
+
|
343
|
+
if existing_job:
|
344
|
+
return FunctionResultStatus.FAILED, f"You already have an active job as a buyer with {existing_job['providerAddress']} - complete the current job before initiating a new one", {}
|
340
345
|
|
341
346
|
if not sellerWalletAddress:
|
342
347
|
return FunctionResultStatus.FAILED, "Missing seller wallet address - specify the agent you want to buy from", {}
|
@@ -365,8 +370,8 @@ class AcpPlugin:
|
|
365
370
|
)
|
366
371
|
|
367
372
|
if (hasattr(self, 'twitter_plugin') and self.twitter_plugin is not None and tweetContent is not None):
|
368
|
-
post_tweet_fn = self.twitter_plugin.
|
369
|
-
tweet_id = post_tweet_fn(tweetContent
|
373
|
+
post_tweet_fn = self.twitter_plugin.twitter_client.create_tweet
|
374
|
+
tweet_id = post_tweet_fn(text=tweetContent).get('data', {}).get('id')
|
370
375
|
if (tweet_id is not None):
|
371
376
|
self.acp_client.add_tweet(job_id, tweet_id, tweetContent)
|
372
377
|
print("Tweet has been posted")
|
@@ -454,8 +459,8 @@ class AcpPlugin:
|
|
454
459
|
tweet_history = job.get("tweetHistory", [])
|
455
460
|
tweet_id = tweet_history[-1].get("tweetId") if tweet_history else None
|
456
461
|
if (tweet_id is not None):
|
457
|
-
reply_tweet_fn = self.twitter_plugin.
|
458
|
-
tweet_id = reply_tweet_fn(tweet_id,tweetContent
|
462
|
+
reply_tweet_fn = self.twitter_plugin.twitter_client.create_tweet
|
463
|
+
tweet_id = reply_tweet_fn(in_reply_to_tweet_id=tweet_id, text=tweetContent).get('data', {}).get('id')
|
459
464
|
if (tweet_id is not None):
|
460
465
|
self.acp_client.add_tweet(jobId ,tweet_id, tweetContent)
|
461
466
|
print("Tweet has been posted")
|
@@ -541,8 +546,8 @@ class AcpPlugin:
|
|
541
546
|
tweet_history = job.get("tweetHistory", [])
|
542
547
|
tweet_id = tweet_history[-1].get("tweetId") if tweet_history else None
|
543
548
|
if (tweet_id is not None):
|
544
|
-
reply_tweet_fn = self.twitter_plugin.
|
545
|
-
tweet_id = reply_tweet_fn(tweet_id,tweetContent
|
549
|
+
reply_tweet_fn = self.twitter_plugin.twitter_client.create_tweet
|
550
|
+
tweet_id = reply_tweet_fn(in_reply_to_tweet_id=tweet_id, text=tweetContent).get('data', {}).get('id')
|
546
551
|
if (tweet_id is not None):
|
547
552
|
self.acp_client.add_tweet(jobId ,tweet_id, tweetContent)
|
548
553
|
print("Tweet has been posted")
|
@@ -646,8 +651,8 @@ class AcpPlugin:
|
|
646
651
|
tweet_history = job.get("tweetHistory", [])
|
647
652
|
tweet_id = tweet_history[-1].get("tweetId") if tweet_history else None
|
648
653
|
if (tweet_id is not None):
|
649
|
-
reply_tweet_fn = self.twitter_plugin.
|
650
|
-
tweet_id = reply_tweet_fn(tweet_id,tweetContent
|
654
|
+
reply_tweet_fn = self.twitter_plugin.twitter_client.create_tweet
|
655
|
+
tweet_id = reply_tweet_fn(in_reply_to_tweet_id=tweet_id, text=tweetContent).get('data', {}).get('id')
|
651
656
|
if (tweet_id is not None):
|
652
657
|
self.acp_client.add_tweet(jobId ,tweet_id, tweetContent)
|
653
658
|
print("Tweet has been posted")
|
@@ -73,22 +73,26 @@ class ITweet:
|
|
73
73
|
@dataclass
|
74
74
|
class AcpJob:
|
75
75
|
jobId: Optional[int]
|
76
|
+
clientName : Optional[str]
|
77
|
+
providerName: Optional[str]
|
76
78
|
desc: str
|
77
79
|
price: str
|
80
|
+
providerAddress: Optional[str]
|
78
81
|
phase: AcpJobPhasesDesc
|
79
82
|
memo: List[AcpRequestMemo]
|
80
|
-
lastUpdated: int
|
81
83
|
tweetHistory : ITweet | List
|
82
84
|
lastUpdated: int
|
83
85
|
|
84
86
|
def __repr__(self) -> str:
|
85
87
|
output =(
|
86
88
|
f"Job ID: {self.jobId}, "
|
89
|
+
f"Client Name: {self.clientName}, "
|
90
|
+
f"Provider Name: {self.providerName}, "
|
87
91
|
f"Description: {self.desc}, "
|
88
92
|
f"Price: {self.price}, "
|
93
|
+
f"Provider Address: {self.providerAddress}, "
|
89
94
|
f"Phase: {self.phase.value}, "
|
90
95
|
f"Memo: {self.memo}, "
|
91
|
-
f"Last Updated: {self.lastUpdated})"
|
92
96
|
f"Tweet History: {self.tweetHistory}, "
|
93
97
|
f"Last Updated: {self.lastUpdated})"
|
94
98
|
)
|
@@ -98,10 +102,13 @@ class AcpJob:
|
|
98
102
|
class IDeliverable:
|
99
103
|
type: str
|
100
104
|
value: str
|
101
|
-
|
105
|
+
clientName: Optional[str]
|
106
|
+
providerName: Optional[str]
|
102
107
|
@dataclass
|
103
108
|
class IInventory(IDeliverable):
|
104
109
|
jobId: int
|
110
|
+
clientName: Optional[str]
|
111
|
+
providerName: Optional[str]
|
105
112
|
|
106
113
|
@dataclass
|
107
114
|
class AcpJobsSection:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|