@@ -100,9 +100,7 @@ async def create_potential_link(self, operation_id: str, data: dict, access: Bas
100
100
raise JsonHttpBadRequest (f'Agent { agent .paw } missing specified executor' )
101
101
executor = self .build_executor (data = data .pop ('executor' , {}), agent = agent )
102
102
ability = self .build_ability (data = data .pop ('ability' , {}), executor = executor )
103
- """This dictionary provides plugins a way to hook into abilities at runtime"""
104
- for _hook , fcall in executor .HOOKS .items ():
105
- await fcall (ability , executor )
103
+ self ._call_ability_plugin_hooks (ability , executor )
106
104
encoded_command = self ._encode_string (agent .replace (self ._encode_string (data ['executor' ]['command' ]),
107
105
file_svc = self .services ['file_svc' ]))
108
106
link = Link .load (dict (command = encoded_command , plaintext_command = encoded_command , paw = agent .paw , ability = ability , executor = executor ,
@@ -173,6 +171,11 @@ async def _construct_and_dump_source(self, source_id: str):
173
171
if not source :
174
172
source = (await self .services ['data_svc' ].locate ('sources' , match = dict (name = 'basic' )))
175
173
return SourceSchema ().dump (source [0 ])
174
+
175
+ async def _call_ability_plugin_hooks (self , ability , executor ):
176
+ """Calls any plugin hooks (at runtime) that exist for the ability and executor."""
177
+ for _hook , fcall in executor .HOOKS .items ():
178
+ await fcall (ability , executor )
176
179
177
180
async def validate_operation_state (self , data : dict , existing : Operation = None ):
178
181
if not existing :
0 commit comments