Agent Zero AI framework
Fix unsecured connection settings link
Alessandro4ba591358e80
diff --git a/extensions/python/banners/AGENTS.md b/extensions/python/banners/AGENTS.mdindex d49581a27..f2ce20f10 100644--- a/extensions/python/banners/AGENTS.md+++ b/extensions/python/banners/AGENTS.md@@ -12,6 +12,7 @@- Banner IDs must be unique and stable.- Use supported banner/card fields and types only.+- Banner HTML links that trigger WebUI behavior should use supported structured actions, such as `data-banner-action`, instead of inline JavaScript handlers.- Do not expose secrets, local paths, or raw system diagnostics in banner text.## Work Guidancediff --git a/extensions/python/banners/_10_unsecured_connection.py b/extensions/python/banners/_10_unsecured_connection.pyindex 3b05b21b3..19145fef3 100644--- a/extensions/python/banners/_10_unsecured_connection.py+++ b/extensions/python/banners/_10_unsecured_connection.py@@ -24,7 +24,7 @@ class UnsecuredConnectionCheck(Extension):"priority": 80,"title": "Unsecured Connection","html": """You are accessing Agent Zero from a non-local address without authentication.- <a href="#" onclick="document.getElementById('settings').click(); return false;">+ <a href="#section-auth" data-banner-action="open-modal:settings/settings.html#section-auth">Configure credentials</a> in Settings → External Services → Authentication.""","dismissible": True,"source": "backend"diff --git a/tests/test_unsecured_connection_banner.py b/tests/test_unsecured_connection_banner.pynew file mode 100644index 000000000..b50391f7f--- /dev/null+++ b/tests/test_unsecured_connection_banner.py@@ -0,0 +1,31 @@+import asyncio+import sys+from pathlib import Path+++PROJECT_ROOT = Path(__file__).resolve().parents[1]+if str(PROJECT_ROOT) not in sys.path:+ sys.path.insert(0, str(PROJECT_ROOT))++from extensions.python.banners import _10_unsecured_connection as unsecured_connection+++def test_unsecured_connection_banner_opens_authentication_settings(monkeypatch):+ monkeypatch.setattr(+ unsecured_connection.dotenv,+ "get_dotenv_value",+ lambda key, default="": "",+ )++ banners = []+ asyncio.run(+ unsecured_connection.UnsecuredConnectionCheck(agent=None).execute(+ banners=banners,+ frontend_context={"hostname": "agent.example.com", "protocol": "http:"},+ )+ )++ row = next(banner for banner in banners if banner.get("id") == "unsecured-connection")+ assert 'href="#section-auth"' in row["html"]+ assert 'data-banner-action="open-modal:settings/settings.html#section-auth"' in row["html"]+ assert "onclick" not in row["html"]diff --git a/tests/test_welcome_composer_static.py b/tests/test_welcome_composer_static.pyindex 0738fb8a9..650836491 100644--- a/tests/test_welcome_composer_static.py+++ b/tests/test_welcome_composer_static.py@@ -58,7 +58,12 @@ def test_welcome_screen_embeds_shared_new_chat_composer() -> None:assert 'class="welcome-banner-cta"' in welcomeassert "executeBannerAction(banner.cta_action)" in welcomeassert "executeBannerAction(action)" in welcome_store+ assert "handleBannerHtmlClick($event)" in welcome+ assert "handleBannerHtmlClick(event)" in welcome_store+ assert "[data-banner-action]" in welcome_storeassert 'action.startsWith("open-modal:")' in welcome_store+ assert 'const hashIndex = path.indexOf("#");' in welcome_store+ assert 'history.replaceState(null, "", `#${hash}`);' in welcome_storeassert ".welcome-banner-html .onboarding-banner-btn-container" in welcomeassert "justify-content: flex-end;" in welcomeassert "justify-content: flex-start;" in welcomediff --git a/webui/components/welcome/AGENTS.md b/webui/components/welcome/AGENTS.mdindex 3fd814d5f..ab4ab245c 100644--- a/webui/components/welcome/AGENTS.md+++ b/webui/components/welcome/AGENTS.md@@ -13,6 +13,8 @@- Keep banner and discovery card behavior compatible with Python `banners` extensions.- Supported banner/card CTA actions must stay synchronized with plugin discovery contracts.+- Banner body links may use `data-banner-action`; these actions route through the same welcome action dispatcher as CTA buttons.+- `open-modal:` banner actions may include a `#section-id` fragment, which updates the page hash before opening the modal so settings sections can deep-link correctly.- Do not show setup prompts for already configured plugins when backend status can prevent it.- The welcome screen mounts the shared chat composer to start a new chat; keep it mutually exclusive with the normal chat input DOM.- Render `system-resources` as the dedicated System Resources panel, not as a generic alert banner.diff --git a/webui/components/welcome/welcome-screen.html b/webui/components/welcome/welcome-screen.htmlindex fcae43203..f963427a2 100644--- a/webui/components/welcome/welcome-screen.html+++ b/webui/components/welcome/welcome-screen.html@@ -55,7 +55,9 @@</div><div class="welcome-banner-content"><div class="welcome-banner-title" x-text="banner.title"></div>- <div class="welcome-banner-html" x-html="banner.html"></div>+ <div class="welcome-banner-html"+ x-html="banner.html"+ @click="$store.welcomeStore.handleBannerHtmlClick($event)"></div></div><button class="welcome-banner-cta"type="button"diff --git a/webui/components/welcome/welcome-store.js b/webui/components/welcome/welcome-store.jsindex 26d770372..9916f911f 100644--- a/webui/components/welcome/welcome-store.js+++ b/webui/components/welcome/welcome-store.js@@ -179,7 +179,7 @@ const model = {if (action.startsWith("open-modal:")) {const path = action.slice("open-modal:".length);- if (path) window.openModal(path);+ this.openModalPath(path);return;}@@ -189,6 +189,34 @@ const model = {}},+ handleBannerHtmlClick(event) {+ const actionTarget = event?.target?.closest?.("[data-banner-action]");+ if (!actionTarget) return;+ const action = actionTarget.getAttribute("data-banner-action");+ if (!action) return;++ event.preventDefault();+ event.stopPropagation();+ this.executeBannerAction(action);+ },++ openModalPath(path) {+ if (!path) return;++ let modalPath = path;+ let hash = "";+ const hashIndex = path.indexOf("#");+ if (hashIndex !== -1) {+ modalPath = path.slice(0, hashIndex);+ hash = path.slice(hashIndex + 1);+ }++ if (hash) {+ history.replaceState(null, "", `#${hash}`);+ }+ if (modalPath) window.openModal(modalPath);+ },+/*** Dismiss a banner by ID.*