Skip to content

Agent Zero AI framework

Refactor plugin installer UI and thumbnail handling

frdel5c2ee20cee5e
diff --git a/models.py b/models.py
index 3e87bec09..7cb558d32 100644
--- a/models.py
+++ b/models.py
@@ -361,11 +361,12 @@ class LiteLLMChatWrapper(SimpleChatModel):
if tool_call_id:
message_dict["tool_call_id"] = tool_call_id
- # Skip messages with empty content
+ # fix messages with empty content, this breaks some LLMs
content = message_dict.get("content")
has_content = bool(content) if not isinstance(content, list) else len(content) > 0
if not has_content:
- continue
+ message_dict["content"] = "empty"
+
result.append(message_dict)
if explicit_caching and result:
diff --git a/plugins/plugin_installer/webui/install-detail.html b/plugins/plugin_installer/webui/install-detail.html
index 7a2e1c13c..7cb027cd1 100644
--- a/plugins/plugin_installer/webui/install-detail.html
+++ b/plugins/plugin_installer/webui/install-detail.html
@@ -15,7 +15,7 @@
<template x-if="$store.pluginInstallStore.getDetailThumbnailUrl()">
<img :src="$store.pluginInstallStore.getDetailThumbnailUrl()"
:alt="$store.pluginInstallStore.selectedPlugin.title"
- @error="$store.pluginInstallStore.nextDetailThumbnail()">
+ @error="$store.pluginInstallStore.detailThumbnailUrl = null">
</template>
<template x-if="!$store.pluginInstallStore.getDetailThumbnailUrl()">
<span class="material-symbols-outlined pi-hero-placeholder">extension</span>
diff --git a/plugins/plugin_installer/webui/install-index.html b/plugins/plugin_installer/webui/install-index.html
index a0ba0c0b2..74ae2ee5b 100644
--- a/plugins/plugin_installer/webui/install-index.html
+++ b/plugins/plugin_installer/webui/install-index.html
@@ -15,9 +15,9 @@
<section class="pi-browse-hero">
<div class="pi-browse-copy">
<div class="pi-browse-eyebrow">Community Marketplace</div>
- <h2 class="pi-browse-title">Discover plugins for Agent Zero</h2>
+ <h2 class="pi-browse-title">Discover community plugins for Agent Zero</h2>
<p class="pi-browse-description">
- Browse community plugins, filter by what you already have installed, and open each listing for screenshots, README, and install actions.
+ These plugins are provided by the community of Agent Zero. Contribute by publishing in the <a href="https://github.com/agent0ai/a0-plugins" target="_blank">index repository</a>.
</p>
</div>
<div class="pi-browse-summary" x-text="$store.pluginInstallStore.browseResultsSummary"></div>
diff --git a/plugins/plugin_installer/webui/main.html b/plugins/plugin_installer/webui/main.html
index bfd8636bd..71336d4c2 100644
--- a/plugins/plugin_installer/webui/main.html
+++ b/plugins/plugin_installer/webui/main.html
@@ -1,38 +1,34 @@
<html>
+
<head>
<title>Install Plugin</title>
<script type="module">
import { store } from "/plugins/plugin_installer/webui/pluginInstallStore.js";
</script>
</head>
+
<body>
<div x-data>
<template x-if="$store.pluginInstallStore">
<div x-init="$store.pluginInstallStore.setTab('store')"
- x-destroy="$store.pluginInstallStore.refreshPluginList()">
+ x-destroy="$store.pluginInstallStore.refreshPluginList()">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item" role="presentation">
- <button class="nav-link"
- :class="{ active: $store.pluginInstallStore.activeTab === 'store' }"
- type="button" role="tab"
- @click="$store.pluginInstallStore.setTab('store')">
+ <button class="nav-link" :class="{ active: $store.pluginInstallStore.activeTab === 'store' }"
+ type="button" role="tab" @click="$store.pluginInstallStore.setTab('store')">
<span class="material-symbols-outlined pi-tab-icon">store</span> Browse
</button>
</li>
<li class="nav-item" role="presentation">
- <button class="nav-link"
- :class="{ active: $store.pluginInstallStore.activeTab === 'git' }"
- type="button" role="tab"
- @click="$store.pluginInstallStore.setTab('git')">
+ <button class="nav-link" :class="{ active: $store.pluginInstallStore.activeTab === 'git' }"
+ type="button" role="tab" @click="$store.pluginInstallStore.setTab('git')">
<span class="material-symbols-outlined pi-tab-icon">terminal</span> Git
</button>
</li>
<li class="nav-item" role="presentation">
- <button class="nav-link"
- :class="{ active: $store.pluginInstallStore.activeTab === 'zip' }"
- type="button" role="tab"
- @click="$store.pluginInstallStore.setTab('zip')">
+ <button class="nav-link" :class="{ active: $store.pluginInstallStore.activeTab === 'zip' }"
+ type="button" role="tab" @click="$store.pluginInstallStore.setTab('zip')">
<span class="material-symbols-outlined pi-tab-icon">upload_file</span> ZIP
</button>
</li>
@@ -40,34 +36,34 @@
<!-- ═══ Store Tab ═══ -->
<div x-show="$store.pluginInstallStore.activeTab === 'store'"
- x-init="$store.pluginInstallStore.resetIndex(); $store.pluginInstallStore.fetchIndex()">
+ x-init="$store.pluginInstallStore.resetIndex(); $store.pluginInstallStore.fetchIndex()">
<div class="pi-browse-shell">
<section class="pi-browse-hero">
<div class="pi-browse-copy">
<div class="pi-browse-eyebrow">Community Marketplace</div>
- <h2 class="pi-browse-title">Discover plugins for Agent Zero</h2>
+ <h2 class="pi-browse-title">Discover community plugins for Agent Zero</h2>
<p class="pi-browse-description">
- Browse community plugins, filter by what you already have installed, and open each listing for screenshots, README, and install actions.
+ These plugins are provided by the community of Agent Zero. Contribute by publishing
+ in the <a href="https://github.com/agent0ai/a0-plugins" target="_blank">index
+ repository</a>.
</p>
</div>
- <div class="pi-browse-summary" x-text="$store.pluginInstallStore.browseResultsSummary"></div>
+ <div class="pi-browse-summary" x-text="$store.pluginInstallStore.browseResultsSummary">
+ </div>
</section>
<div class="pi-index-toolbar">
<label class="pi-search-field">
<span class="material-symbols-outlined">search</span>
- <input type="text"
- class="pi-search-input"
- x-model="$store.pluginInstallStore.search"
+ <input type="text" class="pi-search-input" x-model="$store.pluginInstallStore.search"
@input="$store.pluginInstallStore.page = 1"
placeholder="Search plugins, authors, or tags...">
</label>
<label class="pi-sort-field">
<span class="pi-field-label">Sort</span>
- <select class="pi-sort-select"
- x-model="$store.pluginInstallStore.sortBy">
+ <select class="pi-sort-select" x-model="$store.pluginInstallStore.sortBy">
<option value="stars">Stars</option>
<option value="name">Name</option>
</select>
@@ -76,8 +72,7 @@
<div class="pi-filter-row" x-show="$store.pluginInstallStore.browseFilters.length > 1">
<template x-for="filter in $store.pluginInstallStore.browseFilters" :key="filter.key">
- <button type="button"
- class="pi-filter-chip"
+ <button type="button" class="pi-filter-chip"
:class="{ active: $store.pluginInstallStore.browseFilter === filter.key }"
@click="$store.pluginInstallStore.setBrowseFilter(filter.key)">
<span x-text="filter.label"></span>
@@ -90,11 +85,13 @@
<span class="material-symbols-outlined">progress_activity</span>
<div>
<div class="pi-state-title">Loading marketplace</div>
- <div class="pi-state-text" x-text="$store.pluginInstallStore.loadingMessage || 'Loading plugins...'"></div>
+ <div class="pi-state-text"
+ x-text="$store.pluginInstallStore.loadingMessage || 'Loading plugins...'"></div>
</div>
</div>
- <div x-show="$store.pluginInstallStore.error && !$store.pluginInstallStore.loading" class="pi-state-card pi-state-error">
+ <div x-show="$store.pluginInstallStore.error && !$store.pluginInstallStore.loading"
+ class="pi-state-card pi-state-error">
<span class="material-symbols-outlined">error</span>
<div>
<div class="pi-state-title">Marketplace unavailable</div>
@@ -105,7 +102,8 @@
<div x-show="$store.pluginInstallStore.index && !$store.pluginInstallStore.loading && $store.pluginInstallStore.filteredPlugins.length > 0"
class="pi-grid">
<template x-for="plugin in $store.pluginInstallStore.paginatedPlugins" :key="plugin.key">
- <button type="button" class="pi-card" @click="$store.pluginInstallStore.openDetail(plugin)">
+ <button type="button" class="pi-card"
+ @click="$store.pluginInstallStore.openDetail(plugin)">
<div class="pi-card-thumb">
<template x-if="plugin.thumbnail">
<img :src="plugin.thumbnail" :alt="plugin.title" loading="lazy">
@@ -163,8 +161,7 @@
</div>
<div x-show="$store.pluginInstallStore.totalPages > 1" class="pi-pagination">
- <button class="button"
- :disabled="$store.pluginInstallStore.page <= 1"
+ <button class="button" :disabled="$store.pluginInstallStore.page <= 1"
@click="$store.pluginInstallStore.setPage($store.pluginInstallStore.page - 1)">
<span class="material-symbols-outlined">chevron_left</span>
</button>
@@ -182,28 +179,25 @@
<!-- ═══ Git Tab ═══ -->
<div x-show="$store.pluginInstallStore.activeTab === 'git'"
- x-init="$store.pluginInstallStore.resetGit()">
+ x-init="$store.pluginInstallStore.resetGit()">
<div class="pi-form-group">
<label class="pi-label">Git Repository URL</label>
- <input type="text" class="pi-input"
- x-model="$store.pluginInstallStore.gitUrl"
+ <input type="text" class="pi-input" x-model="$store.pluginInstallStore.gitUrl"
:disabled="$store.pluginInstallStore.loading"
placeholder="https://github.com/user/my-plugin.git">
</div>
<div class="pi-form-group">
- <label class="pi-label">Access Token <span class="pi-optional">(optional, for private repos)</span></label>
- <input type="password" class="pi-input"
- x-model="$store.pluginInstallStore.gitToken"
- :disabled="$store.pluginInstallStore.loading"
- placeholder="ghp_xxxx or glpat-xxxx">
+ <label class="pi-label">Access Token <span class="pi-optional">(optional, for private
+ repos)</span></label>
+ <input type="password" class="pi-input" x-model="$store.pluginInstallStore.gitToken"
+ :disabled="$store.pluginInstallStore.loading" placeholder="ghp_xxxx or glpat-xxxx">
<div class="pi-hint">Token is used only for cloning and is not stored.</div>
</div>
<div class="pi-actions">
- <button class="button confirm"
- @click="$store.pluginInstallStore.installGit()"
+ <button class="button confirm" @click="$store.pluginInstallStore.installGit()"
:disabled="$store.pluginInstallStore.loading || !$store.pluginInstallStore.gitUrl.trim()">
<template x-if="$store.pluginInstallStore.loading">
<span class="pi-button-loading">
@@ -228,7 +222,8 @@
<span class="material-symbols-outlined">check_circle</span>
</div>
<div class="pi-result-text">
- <strong x-text="'Plugin installed: ' + ($store.pluginInstallStore.result?.title || $store.pluginInstallStore.result?.plugin_name || '')"></strong>
+ <strong
+ x-text="'Plugin installed: ' + ($store.pluginInstallStore.result?.title || $store.pluginInstallStore.result?.plugin_name || '')"></strong>
<div class="pi-result-path" x-text="$store.pluginInstallStore.result?.path || ''"></div>
</div>
</div>
@@ -236,7 +231,7 @@
<!-- ═══ ZIP Tab ═══ -->
<div x-show="$store.pluginInstallStore.activeTab === 'zip'"
- x-init="$store.pluginInstallStore.resetZip()">
+ x-init="$store.pluginInstallStore.resetZip()">
<div class="pi-upload-section">
<label for="plugin-zip-file" class="pi-upload-btn button confirm"
@@ -252,8 +247,7 @@
</div>
<div x-show="$store.pluginInstallStore.zipFile" class="pi-actions-center">
- <button class="button confirm"
- @click="$store.pluginInstallStore.installZip()"
+ <button class="button confirm" @click="$store.pluginInstallStore.installZip()"
:disabled="$store.pluginInstallStore.loading">
<span class="icon material-symbols-outlined">download</span> Install Plugin
</button>
@@ -272,7 +266,8 @@
<span class="material-symbols-outlined">check_circle</span>
</div>
<div class="pi-result-text">
- <strong x-text="'Plugin installed: ' + ($store.pluginInstallStore.result?.title || $store.pluginInstallStore.result?.plugin_name || '')"></strong>
+ <strong
+ x-text="'Plugin installed: ' + ($store.pluginInstallStore.result?.title || $store.pluginInstallStore.result?.plugin_name || '')"></strong>
<div class="pi-result-path" x-text="$store.pluginInstallStore.result?.path || ''"></div>
</div>
</div>
@@ -696,6 +691,7 @@
height: 164px;
}
}
+
/* ── Git Tab ─────────────────────────── */
.pi-form-group {
margin-bottom: 1rem;
@@ -775,7 +771,7 @@
.pi-error {
color: var(--color-error);
padding: 0.75rem;
- background: var(--color-error-bg, rgba(239,68,68,0.1));
+ background: var(--color-error-bg, rgba(239, 68, 68, 0.1));
border-radius: 4px;
margin-top: 0.75rem;
}
@@ -797,8 +793,8 @@
align-items: center;
gap: 0.75rem;
padding: 0.75rem;
- background: rgba(34,197,94,0.1);
- border: 1px solid rgba(34,197,94,0.3);
+ background: rgba(34, 197, 94, 0.1);
+ border: 1px solid rgba(34, 197, 94, 0.3);
border-radius: 4px;
margin-top: 0.75rem;
}
@@ -822,4 +818,5 @@
}
</style>
</body>
-</html>
+
+</html>
\ No newline at end of file
diff --git a/plugins/plugin_installer/webui/pluginInstallStore.js b/plugins/plugin_installer/webui/pluginInstallStore.js
index de76574dd..45e47c179 100644
--- a/plugins/plugin_installer/webui/pluginInstallStore.js
+++ b/plugins/plugin_installer/webui/pluginInstallStore.js
@@ -4,9 +4,9 @@ import { openModal } from "/js/modals.js";
import { marked } from "/vendor/marked/marked.esm.js";
import { toastFrontendSuccess } from "/components/notifications/notification-store.js";
import { showConfirmDialog } from "/js/confirmDialog.js";
-import "/components/plugins/list/pluginListStore.js";
-import "/components/plugins/list/plugin-init-store.js";
-import "/components/modals/image-viewer/image-viewer-store.js";
+import {store as pluginListStore } from "/components/plugins/list/pluginListStore.js";
+// import {store as pluginInitStore } from "/components/plugins/list/plugin-init-store.js";
+// import {store as imageViewerStore } from "/components/modals/image-viewer/image-viewer-store.js";
const PLUGIN_API = "plugins/plugin_installer/plugin_install";
const PER_PAGE = 20;
@@ -37,7 +37,7 @@ const model = {
gitToken: "",
// Index state
- index: null,
+ index: { authors: {}, plugins: {} },
installedPlugins: [],
search: "",
page: 1,
@@ -57,11 +57,7 @@ const model = {
// Installed plugin detail (for manage buttons)
installedPluginInfo: null,
- // Detail hero thumbnail fallbacks
- detailPluginName: "",
- /** @type {string[]} */
- detailThumbnailSources: [],
- detailThumbnailIndex: 0,
+ detailThumbnailUrl: null,
// Tab state
activeTab: "store",
@@ -85,8 +81,20 @@ const model = {
},
_pluginName(plugin) {
- const repoUrl = (plugin?.github || "").replace(/\.git$/, "");
- return repoUrl.split("/").pop() || plugin?.key || "";
+ const githubUrl = (plugin?.github || "").trim().replace(/\.git$/i, "");
+ const match = githubUrl.match(/github\.com\/([^/]+)\/([^/]+)/i);
+ if (!match) return plugin?.key || "";
+
+ const parts = [match[1], match[2]]
+ .map((part) =>
+ String(part)
+ .replace(/[^0-9A-Za-z]+/g, "_")
+ .replace(/_+/g, "_")
+ .replace(/^_+|_+$/g, "")
+ )
+ .filter(Boolean);
+
+ return parts.join("__") || plugin?.key || "";
},
_pluginPrimaryTag(plugin) {
@@ -213,7 +221,7 @@ const model = {
this.loading = true;
this.loadingMessage = "Loading plugin index...";
this.error = "";
- this.index = null;
+ // this.index = null;
const data = await api.callJsonApi(PLUGIN_API, {
action: "fetch_index",
@@ -342,18 +350,15 @@ const model = {
},
openDetail(plugin) {
- const detailPlugin = plugin ? { ...plugin } : null;
- this.selectedPlugin = detailPlugin;
+ this.selectedPlugin = {...plugin, name: this._pluginName(plugin) };
this.error = "";
this.installedPluginInfo = null;
this.readmeContent = null;
- this.detailPluginName = this._pluginName(detailPlugin);
- this.detailThumbnailSources = this.getDetailThumbnailSources(detailPlugin);
- this.detailThumbnailIndex = 0;
- if (detailPlugin?.installed) {
- this.fetchInstalledPluginInfo(this.detailPluginName);
+ this.detailThumbnailUrl = this.getThumbnailUrl(this.selectedPlugin);
+ if (this.selectedPlugin.installed) {
+ this.fetchInstalledPluginInfo(this.selectedPlugin.name);
}
- this.fetchReadme(detailPlugin);
+ this.fetchReadme(this.selectedPlugin);
openModal("/plugins/plugin_installer/webui/install-detail.html");
},
@@ -429,9 +434,7 @@ const model = {
...(this.selectedPlugin || {}),
installed: true,
};
- this.detailPluginName = data.plugin_name;
- this.detailThumbnailSources = this.getDetailThumbnailSources(this.selectedPlugin);
- this.detailThumbnailIndex = 0;
+ this.detailThumbnailUrl = this.getThumbnailUrl(this.selectedPlugin);
this.fetchInstalledPluginInfo(data.plugin_name);
toastFrontendSuccess(
@@ -462,13 +465,6 @@ const model = {
}
},
- _pluginListStore() {
- return getStore("pluginListStore");
- },
-
- _pluginInitStore() {
- return getStore("pluginInitStore");
- },
manageOpenPlugin() {
const info = this.installedPluginInfo;
@@ -477,23 +473,20 @@ const model = {
},
async manageOpenConfig() {
- const pls = this._pluginListStore();
- if (pls?.openPluginConfig && this.installedPluginInfo) {
- await pls.openPluginConfig(this.installedPluginInfo);
+ if (this.installedPluginInfo) {
+ await pluginListStore.openPluginConfig(this.installedPluginInfo);
}
},
async manageOpenDoc(doc) {
- const pls = this._pluginListStore();
- if (pls?.openPluginDoc && this.installedPluginInfo) {
- await pls.openPluginDoc(this.installedPluginInfo, doc);
+ if (this.installedPluginInfo) {
+ await pluginListStore.openPluginDoc(this.installedPluginInfo, doc);
}
},
manageOpenInfo() {
- const pls = this._pluginListStore();
- if (pls?.openPluginInfo && this.installedPluginInfo) {
- pls.openPluginInfo(this.installedPluginInfo);
+ if (this.installedPluginInfo) {
+ pluginListStore.openPluginInfo(this.installedPluginInfo);
}
},
@@ -505,9 +498,8 @@ const model = {
},
async manageDeletePlugin() {
- const pls = this._pluginListStore();
- if (pls?.deletePlugin && this.installedPluginInfo) {
- await pls.deletePlugin(this.installedPluginInfo);
+ if (this.installedPluginInfo) {
+ await pluginListStore.deletePlugin(this.installedPluginInfo);
const currentPlugin = this.selectedPlugin;
if (currentPlugin) {
this.selectedPlugin = { ...currentPlugin, installed: false };
@@ -531,41 +523,8 @@ const model = {
return rawBase ? `${rawBase}/main/thumbnail.png` : null;
},
- getLocalThumbnailUrl() {
- const name = this.detailPluginName;
- return name ? `/plugins/${name}/thumbnail.png` : null;
- },
-
- /**
- * Build the ordered thumbnail URLs for the detail view.
- * First try GitHub, then the local plugin asset.
- * @param {any} plugin
- * @returns {string[]}
- */
- getDetailThumbnailSources(plugin) {
- const currentPlugin = plugin || this.selectedPlugin;
- const rawSources = [
- this.getThumbnailUrl(currentPlugin),
- this.getLocalThumbnailUrl(),
- ];
- const uniqueSources = [];
- const seen = new Set();
-
- for (const url of rawSources) {
- if (typeof url !== "string" || seen.has(url)) continue;
- seen.add(url);
- uniqueSources.push(url);
- }
-
- return uniqueSources;
- },
-
getDetailThumbnailUrl() {
- return this.detailThumbnailSources[this.detailThumbnailIndex] || null;
- },
-
- nextDetailThumbnail() {
- this.detailThumbnailIndex += 1;
+ return this.detailThumbnailUrl;
},
// ── Shared ───────────────────────────────────
@@ -593,7 +552,7 @@ const model = {
/** Called from x-destroy when the installer modal is torn down; refreshes the plugin list store */
refreshPluginList() {
- getStore("pluginListStore")?.refresh();
+ pluginListStore.refresh();
},
truncate(text, max) {