-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add list of hooks and tools when fetching plugins #457
Conversation
This is a good idea thanks |
I thought about that too, but... who cares about the tools names? The description of the plugin should already answer a hypothetical question like "how do I trigger this plugin?", or am I wrong? |
core/cat/routes/plugins.py
Outdated
@@ -40,6 +40,8 @@ async def get_available_plugins( | |||
# get manifest | |||
manifest = deepcopy(p.manifest) # we make a copy to avoid modifying the plugin obj | |||
manifest["active"] = p.id in active_plugins # pass along if plugin is active or not | |||
manifest["used_hooks"] = [{ "name": hook.name, "priority": hook.priority } for hook in p.hooks] | |||
manifest["used_tools"] = [tool.func.__name__ for tool in p.tools] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also added tools, should the entry be called used_tools
, tools
or created_tools
?
I was thinking about changing the data structure in this way, where the key is the priority: {
"0": ["hook name 1", "hook name 2"],
"1": ["hook name 3", "hook name 4"]
} (Suggested by the Cat 😉) |
The previous was better, because it makes no assumptions on ordering or indexing. |
Description
In this way, you can visualize in the frontend or from a generic client, the used hooks by each plugin and their priority, for a better understanding of the flow of the plugins you installed. You can also see the tools created by the plugins.
Type of change
Checklist: