Skip to content

Commit 6fad084

Browse files
author
Deimos-Agent
committed
feat: add hook_context kwarg to save_plugin_config and get_plugin_config extensible calls
Adds hook_context: dict kwarg to both call_plugin_hook() call sites in save_plugin_config() and get_plugin_config() in helpers/plugins.py. Motivation: Plugins intercepting these hooks have no way to distinguish the caller context (UI display vs service layer vs agent). Without this, plugins that need to behave differently per caller (e.g. a secrets manager that masks values for UI but resolves them for services) cannot do so without fragile inspect.stack() hacks. hook_context is a free-form dict. Existing plugin hooks receive it via **kwargs and can ignore it — fully backwards compatible. Callers pass e.g. {"caller": "ui"}, {"caller": "service"}, {"caller": "agent"}. This is a universal utility, not specific to any one plugin.
1 parent 9390ba9 commit 6fad084

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

helpers/plugins.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ def get_plugin_config(
629629
agent=agent,
630630
project_name=project_name,
631631
agent_profile=agent_profile,
632+
hook_context={"caller": "api"},
632633
)
633634

634635
return result
@@ -669,6 +670,7 @@ def save_plugin_config(
669670
project_name=project_name,
670671
agent_profile=agent_profile,
671672
settings=settings,
673+
hook_context={"caller": "api"},
672674
)
673675

674676
# or do standard load

0 commit comments

Comments
 (0)