Skip to content

Agent Zero AI framework

cleanup, simpler toggling logic

Alessandroec5842ace399
diff --git a/plugins/example_agent/plugin.yaml b/plugins/example_agent/plugin.yaml
index c440c311b..bc5dad0e4 100644
--- a/plugins/example_agent/plugin.yaml
+++ b/plugins/example_agent/plugin.yaml
@@ -3,4 +3,5 @@ description: Example agent plugin demonstrating the Agent Zero plugin system.
version: 1.0.0
settings_sections: []
per_project_config: true
-per_agent_config: false
\ No newline at end of file
+per_agent_config: false
+always_enabled: true
diff --git a/webui/components/plugins/plugin-settings-store.js b/webui/components/plugins/plugin-settings-store.js
index f6918d780..fd6dd6a8b 100644
--- a/webui/components/plugins/plugin-settings-store.js
+++ b/webui/components/plugins/plugin-settings-store.js
@@ -58,7 +58,7 @@ const model = {
if (toggleStore) {
toggleStore.projectName = nextProject;
toggleStore.agentProfileKey = nextProfile;
- toggleStore.calculateStatus();
+ await toggleStore.loadToggleStatus();
}
},
diff --git a/webui/components/plugins/toggle/plugin-toggle-advanced.html b/webui/components/plugins/toggle/plugin-toggle-advanced.html
index 7d744cffc..792d6d596 100644
--- a/webui/components/plugins/toggle/plugin-toggle-advanced.html
+++ b/webui/components/plugins/toggle/plugin-toggle-advanced.html
@@ -60,18 +60,10 @@
</label>
<div class="plugin-settings-toolbar-item plugin-status-toggle-item">
- <template x-if="!$store.pluginToggle.hasExplicitRuleForScope && !$store.pluginToggle.alwaysEnabled">
- <button type="button"
- class="button icon-button"
- title="Add explicit rule for this scope"
- @click="$store.pluginToggle.addRule()">
- <span class="icon material-symbols-outlined">add</span>
- </button>
- </template>
<label class="toggle" :class="{ 'disabled-appearance': !$store.pluginToggle.hasExplicitRuleForScope && !$store.pluginToggle.alwaysEnabled }">
<input type="checkbox"
:checked="$store.pluginToggle.status === 'enabled'"
- :disabled="$store.pluginToggle.alwaysEnabled || $store.pluginToggle.isSaving || !$store.pluginToggle.hasExplicitRuleForScope"
+ :disabled="$store.pluginToggle.alwaysEnabled || $store.pluginToggle.isSaving"
@change="$store.pluginToggle.setEnabled($event.target.checked)">
<span class="toggler"></span>
</label>
@@ -189,11 +181,6 @@
font-size: var(--font-size-small);
}
- .plugin-settings-body {
- padding: 1rem;
- min-height: 4rem;
- }
-
@media (max-width: 640px) {
.plugin-settings-toolbar-item {
flex-basis: 100%;
@@ -238,18 +225,6 @@
flex: 0 0 auto;
}
- .plugin-status-toggle-item .button {
- padding: 0.3rem 0.5rem;
- height: 2.2rem;
- display: flex;
- align-items: center;
- justify-content: center;
- }
-
- .plugin-status-toggle-item .button .icon {
- font-size: 1.1rem;
- }
-
.disabled-appearance {
opacity: 0.6;
}
diff --git a/webui/components/plugins/toggle/plugin-toggle-store.js b/webui/components/plugins/toggle/plugin-toggle-store.js
index 00edf93fe..ebf553ba4 100644
--- a/webui/components/plugins/toggle/plugin-toggle-store.js
+++ b/webui/components/plugins/toggle/plugin-toggle-store.js
@@ -23,6 +23,7 @@ const model = {
perProjectConfig: true,
perAgentConfig: true,
hasExplicitRuleForScope: false,
+ hasConfigScreen: false,
// Where the effective toggle was actually resolved (mirrors plugin-settings-store loadedXxx fields)
loadedPath: "",
@@ -39,6 +40,8 @@ const model = {
this.projectName = "";
this.agentProfileKey = "";
this.configs = [];
+ this.status = 'enabled';
+ this.hasExplicitRuleForScope = false;
this.loadedPath = "";
this.loadedProjectName = "";
this.loadedAgentProfile = "";
@@ -72,6 +75,8 @@ const model = {
this.loadedPath = "";
this.loadedProjectName = "";
this.loadedAgentProfile = "";
+ this.isLoading = false;
+ this.isSaving = false;
},
async loadProjects() {
@@ -176,27 +181,20 @@ const model = {
});
} else {
// Same plugin — push current scope explicitly.
- // onScopeChanged() syncs on @change events, but if the user never touched
- // the scope selectors after the modal opened the settings store may still
- // hold a stale scope from a prior session.
settingsStore.projectName = this.projectName || "";
settingsStore.agentProfileKey = this.agentProfileKey || "";
}
- await window.openModal?.("components/plugins/plugin-settings.html");
+ await window.openModal?.("/components/plugins/plugin-settings.html");
},
async openConfigListModal() {
await window.openModal?.("/components/plugins/toggle/plugin-toggles.html");
},
- async loadConfigList() {
- await this.loadConfigs();
- },
-
async switchToConfig(projectName, agentProfile) {
this.projectName = projectName || "";
this.agentProfileKey = agentProfile || "";
- this.onScopeChanged();
+ await this.onScopeChanged();
await window.closeModal?.();
},
@@ -258,10 +256,6 @@ const model = {
await settingsStore.loadSettings();
},
- async addRule() {
- await this.setEnabled(this.status === 'enabled');
- },
-
projectLabel(key) {
if (!key) return "Global";
const found = (this.projects || []).find(p => p.key === key);