Updated plugin documentation with hooking mechanism overview#129
Updated plugin documentation with hooking mechanism overview#129bjeffries wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive documentation for Caldera's plugin hooks feature, which allows plugins to intercept and modify abilities during runtime. The documentation explains how to leverage the executor hooks dictionary to customize ability execution behavior.
- Added detailed explanation of the executor hooks mechanism
- Provided step-by-step implementation examples with code snippets
- Demonstrated different criteria for targeting specific abilities or executors
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| ## Caldera Plugin Hooks | ||
|
|
||
| Caldera provides plugins the ability to hook into the runtime when a link is added to any operation. This is facilated through a dictionary object in each executor ```executor.HOOKS```. The values in this dictionary contain function pointers to be called before the server queues the ability for execution. |
There was a problem hiding this comment.
Corrected spelling of 'facilated' to 'facilitated'.
| Caldera provides plugins the ability to hook into the runtime when a link is added to any operation. This is facilated through a dictionary object in each executor ```executor.HOOKS```. The values in this dictionary contain function pointers to be called before the server queues the ability for execution. | |
| Caldera provides plugins the ability to hook into the runtime when a link is added to any operation. This is facilitated through a dictionary object in each executor ```executor.HOOKS```. The values in this dictionary contain function pointers to be called before the server queues the ability for execution. |
| async def expansion(services): | ||
| await services.get('myplugin_svc').initialize_code_hook_functions() | ||
| ``` | ||
| 2. Update your plugin service script (e.g., myplugin_svc.py) to parse ability files and their executors. Add logic to hook into the executor's you are interested in modifying. |
There was a problem hiding this comment.
Remove unnecessary apostrophe - should be 'executors' not 'executor's'.
| 2. Update your plugin service script (e.g., myplugin_svc.py) to parse ability files and their executors. Add logic to hook into the executor's you are interested in modifying. | |
| 2. Update your plugin service script (e.g., myplugin_svc.py) to parse ability files and their executors. Add logic to hook into the executors you are interested in modifying. |
| - id: 1811b7f2-3a73-11eb-adc1-0242ac120103 | ||
| name: my awesome ability | ||
| plugin: myplugin | ||
| hook: myspecialhook |
There was a problem hiding this comment.
The YAML example shows 'hook: myspecialhook' as a top-level field, but the code example checks 'ability.additional_info['hook']'. The YAML should be nested under 'additional_info' to match the code implementation.
| hook: myspecialhook | |
| additional_info: | |
| hook: myspecialhook |
|
Can you address the above and resubmit for Review |
Description
This update to field manual includes documentation update on how to leverage the executor hooks dictionary.
Caldera pull request apache/caldera#3101
Type of change
How Has This Been Tested?
Previewed mark down in editor. No issues.
Checklist: