Skip to content

Agent Zero AI framework

fix plugin toggle signature and sync UI via modal events

Alessandrodfc76a2aafc4
diff --git a/python/helpers/plugins.py b/python/helpers/plugins.py
index 999245601..1e97fb3f7 100644
--- a/python/helpers/plugins.py
+++ b/python/helpers/plugins.py
@@ -305,8 +305,23 @@ def get_toggle_state(plugin_name: str) -> ToggleState:
def toggle_plugin(
- plugin_name: str, enabled: bool, project_name: str = "", agent_profile: str = ""
+ plugin_name: str,
+ enabled: bool,
+ project_name: str = "",
+ agent_profile: str = "",
+ clear_overrides: bool = False,
):
+ if clear_overrides:
+ all_toggles = find_plugin_assets(
+ TOGGLE_FILE_PATTERN,
+ plugin_name=plugin_name,
+ project_name="*",
+ agent_profile="*",
+ only_first=False,
+ )
+ for toggle in all_toggles:
+ files.delete_file(toggle["path"])
+
enabled_file = determine_plugin_asset_path(
plugin_name, project_name, agent_profile, ENABLED_FILE_NAME
)
diff --git a/webui/components/plugins/list/plugin-list.html b/webui/components/plugins/list/plugin-list.html
index 82280786f..eae56971f 100644
--- a/webui/components/plugins/list/plugin-list.html
+++ b/webui/components/plugins/list/plugin-list.html
@@ -7,7 +7,7 @@
</head>
<body>
- <div x-data>
+ <div x-data x-on:plugin-modal-closed.window="$store.pluginListStore.refresh()">
<template x-if="$store.pluginListStore">
<div x-init="$store.pluginListStore.init && $store.pluginListStore.init()">
diff --git a/webui/components/plugins/plugin-settings.html b/webui/components/plugins/plugin-settings.html
index 49d2e846d..3ba231526 100644
--- a/webui/components/plugins/plugin-settings.html
+++ b/webui/components/plugins/plugin-settings.html
@@ -9,7 +9,7 @@
<div x-data>
<template x-if="$store.pluginSettings">
<div x-create="$store.pluginSettings.onModalOpen()"
- x-destroy="$store.pluginSettings.cleanup()">
+ x-destroy="$store.pluginSettings.cleanup(); $dispatch('plugin-modal-closed')">
<!-- Context toolbar: Project + Agent profile (only when at least one scope is configurable) -->
<div class="plugin-settings-scope-section"
diff --git a/webui/components/plugins/toggle/plugin-toggle-advanced.html b/webui/components/plugins/toggle/plugin-toggle-advanced.html
index 209fd9ebc..4cc8c7932 100644
--- a/webui/components/plugins/toggle/plugin-toggle-advanced.html
+++ b/webui/components/plugins/toggle/plugin-toggle-advanced.html
@@ -9,7 +9,7 @@
<div x-data>
<template x-if="$store.pluginToggle">
<div x-create="$store.pluginToggle.open($store.pluginListStore?.selectedPlugin || '')"
- x-destroy="$store.pluginToggle.cleanup()">
+ x-destroy="$store.pluginToggle.cleanup(); $dispatch('plugin-modal-closed')">
<!-- Error -->
<div x-show="$store.pluginToggle.error" class="plugin-settings-error">