Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
bc1961d
Pull from PR#3101
HackedRico Jun 25, 2025
0eff130
fix!: Typo
HackedRico Jun 25, 2025
ca6b479
fix!: Conditional to Catch None Attribute Error Running Operations
HackedRico Jun 27, 2025
de989ef
fix!: Caldera Operations Api Manager creates Builder Payloads during …
HackedRico Jul 2, 2025
7cc2819
Update planning_svc.py
deacon-mp Jul 3, 2025
3ecb69c
Update conftest.py
deacon-mp Jul 3, 2025
3b40f30
Merge remote-tracking branch 'upstream/master'
HackedRico Jul 3, 2025
e588743
Merge branch 'master' into master
HackedRico Jul 7, 2025
41197e6
Merge branch 'master' into master
HackedRico Aug 19, 2025
d8ce9ac
Fixes Flake8 Linter Run Errors
HackedRico Aug 19, 2025
21c7621
Merge branch 'master' into master
deacon-mp Sep 4, 2025
885fbd0
Merge branch 'master' into master
HackedRico Sep 26, 2025
55454a2
fix: Direct Executer Function Call from Map
HackedRico Oct 6, 2025
53a379f
Revert "Update conftest.py"
HackedRico Oct 6, 2025
bd61e6c
fix: additional executor checks
HackedRico Oct 6, 2025
6958939
Python Linting
HackedRico Oct 6, 2025
92c8019
fix: flake8 linting error due to conditionals
HackedRico Oct 6, 2025
fd8f4aa
Pull Workflow from Upstream
HackedRico Oct 6, 2025
4198fa1
Merge branch 'master' into master
HackedRico Oct 6, 2025
d90ee95
Merge remote-tracking branch 'upstream/master'
HackedRico Oct 6, 2025
7f2a92f
Merge remote-tracking branch 'upstream/master'
HackedRico Oct 6, 2025
bb23771
Merge branch 'master' into master
deacon-mp Oct 6, 2025
eff92d5
Merge branch 'master' into master
deacon-mp Oct 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/api/v2/managers/operation_api_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ async def create_potential_link(self, operation_id: str, data: dict, access: Bas
file_svc=self.services['file_svc']))
executor = self.build_executor(data=data.pop('executor', {}), agent=agent)
ability = self.build_ability(data=data.pop('ability', {}), executor=executor)
await self._call_ability_plugin_hooks(ability, executor)
link = Link.load(dict(command=encoded_command, plaintext_command=encoded_command, paw=agent.paw, ability=ability, executor=executor,
status=operation.link_status(), score=data.get('score', 0), jitter=data.get('jitter', 0),
cleanup=data.get('cleanup', 0), pin=data.get('pin', 0),
Expand Down Expand Up @@ -171,6 +172,13 @@ async def _construct_and_dump_source(self, source_id: str):
source = (await self.services['data_svc'].locate('sources', match=dict(name='basic')))
return SourceSchema().dump(source[0])

async def _call_ability_plugin_hooks(self, ability, executor):
"""Calls any plugin hooks (at runtime) that exist for the ability and executor."""
if hasattr(executor, 'HOOKS') and executor.HOOKS and \
hasattr(executor, 'language') and executor.language and \
executor.language in executor.HOOKS:
await executor.HOOKS[executor.language](ability, executor)

async def validate_operation_state(self, data: dict, existing: Operation = None):
if not existing:
if data.get('state') in Operation.get_finished_states():
Expand Down
12 changes: 9 additions & 3 deletions app/service/planning_svc.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,7 @@ async def _generate_new_links(self, operation, agent, abilities, link_status):
executor = await agent.get_preferred_executor(ability)
if not executor:
continue

if executor.HOOKS and executor.language and executor.language in executor.HOOKS:
await executor.HOOKS[executor.language](ability, executor)
await self._call_ability_plugin_hooks(ability, executor)
if executor.command:
link = Link.load(dict(command=self.encode_string(executor.test), paw=agent.paw, score=0,
ability=ability, executor=executor, status=link_status,
Expand Down Expand Up @@ -392,6 +390,13 @@ async def _generate_cleanup_links(self, operation, agent, link_status):
links.append(lnk)
return links

async def _call_ability_plugin_hooks(self, ability, executor):
"""Calls any plugin hooks (at runtime) that exist for the ability and executor."""
if hasattr(executor, 'HOOKS') and executor.HOOKS and \
hasattr(executor, 'language') and executor.language and \
executor.language in executor.HOOKS:
await executor.HOOKS[executor.language](ability, executor)

@staticmethod
async def _apply_adjustments(operation, links):
"""Apply operation source ability adjustments to links
Expand All @@ -406,3 +411,4 @@ async def _apply_adjustments(operation, links):
if operation.has_fact(trait=adjustment.trait, value=adjustment.value):
a_link.visibility.apply(adjustment)
a_link.status = a_link.states['HIGH_VIZ']

Loading