Singleton plugin manager wrapper with session-tag filtering.Documentation Index
Fetch the complete documentation index at: https://docs.mellea.ai/llms.txt
Use this file to discover all available pages before exploring further.
Functions
FUNC enable_background_collection
FUNC disable_background_collection
FUNC drain_background_tasks
FUNC discard_background_tasks
FUNC has_plugins
hook_type is provided, also checks whether any plugin has
registered a handler for that specific hook, enabling callers to skip
payload construction entirely when no plugin subscribes.
Args:
hook_type: Optional hook type to check for registered handlers.
Trueif plugins are enabled and (whenhook_typeis given)- at least one plugin subscribes to that hook.
FUNC is_internal_tool
tool_name: Name of the tool to check.
Trueif the tool is in the internal tools registry.
FUNC get_plugin_manager
None if plugins are not configured.
Returns:
- The singleton
PluginManagerinstance, orNone.
FUNC ensure_plugin_manager
- The singleton
PluginManagerinstance.
ImportError: If the ContextForge plugin framework is not installed.
FUNC initialize_plugins
config_path: Optional path to a YAML plugin configuration file.timeout: Maximum execution time per plugin in seconds.
- The initialized
PluginManagerinstance.
ImportError: If the ContextForge plugin framework is not installed.
FUNC shutdown_plugins
FUNC track_session_plugin
session_id: Identifier for the session that owns the plugin.plugin_name: Registered name of the plugin.
FUNC deregister_session_plugins
session_id: Identifier for the session whose plugins should be removed.
FUNC invoke_hook
(result, possibly-modified-payload).
If plugins are not configured, returns (None, original_payload) immediately.
Three layers of no-op guards ensure zero overhead when plugins are not configured:
_plugins_enabledboolean — single pointer dereferencehas_hooks_for(hook_type)— skips when no plugin subscribes- Returns immediately when either guard fails
hook_type: The hook point to invoke.payload: The immutable payload to pass to plugin handlers.backend: Optional backend for building the global context.**context_fields: Additional fields passed tobuild_global_context.
- A
(result, payload)tuple where result is thePluginResult - (or
Nonewhen no plugins ran) and payload is the - possibly-modified payload.
PluginViolationError: If a plugin blocks execution.