Skip to content

Agent Zero AI framework

welcome screen prototype

frdel8798d6f86164
diff --git a/webui/components/sidebar/top-section/quick-actions.html b/webui/components/sidebar/top-section/quick-actions.html
index 7051f014b..a4d76e147 100644
--- a/webui/components/sidebar/top-section/quick-actions.html
+++ b/webui/components/sidebar/top-section/quick-actions.html
@@ -1,9 +1,11 @@
<html>
+
<head>
<script type="module">
import { store } from "/components/sidebar/chats/chats-store.js";
</script>
</head>
+
<body>
<div class="config-section" x-data>
<button class="config-button" id="resetChat" @click="$store.chats.resetChat()">Reset Chat</button>
@@ -12,56 +14,67 @@
<button class="config-button" id="loadChat" @click="$store.chats.saveChat()">Save Chat</button>
<button class="config-button" id="restart" @click="$store.chats.restart()">Restart</button>
<button class="config-button" id="settings" @click="settingsModalProxy.openModal()"><svg
- xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="-5.0 -17.0 110.0 135.0" fill="currentColor"
- width="24" height="24">
+ xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="-5.0 -17.0 110.0 135.0" fill="currentColor" width="24"
+ height="24">
<path
- d="m52.301 90.102h-4.1016c-3 0-5 0-6.8984-1.3984-1.8984-1.3984-2.5-3.3008-3.5-6.1016l-1.1016-3.6016c-0.19922-0.60156-0.69922-1.1992-1.3984-1.6016l-1.1016-0.60156c-0.60156-0.30078-1.5-0.39844-2.3008-0.19922l-4.3008 1.1992c-3.1016 0.89844-5.1016 1.5-7.3984 0.5-2.3008-0.89844-3.3984-2.8008-5-5.6016l-1.8008-3.1016c-1.5-2.5-2.5-4.3008-2.3008-6.6992 0.19922-2.3984 1.6016-3.8008 3.6016-6.1016l3.8008-4.1992c0.19922-0.19922 0.60156-1.3984 0.60156-2.6016 0-1.1016-0.5-2.3008-0.80078-2.6992l-3.6016-4c-2-2.1992-3.3008-3.6992-3.6016-6.1016-0.19922-2.3984 0.80078-4.1992 2.3008-6.6992l1.8008-3.1016c1.6016-2.8008 2.6992-4.6016 5-5.6016 2.3008-0.89844 4.3008-0.39844 7.3984 0.5l4.3984 1.1992c0.69922 0.10156 1.5 0 2.3008-0.30078l1.1016-0.60156c0.5-0.30078 1-0.89844 1.3008-1.6992l1.1992-3.5c0.89844-2.8008 1.6016-4.6992 3.5-6.1016 1.8984-1.3984 3.8984-1.3984 6.8984-1.3984h4.1016c3 0 5 0 6.8984 1.3984 1.8984 1.3984 2.5 3.1992 3.5 6.1016l1.1992 3.6016c0.19922 0.60156 0.69922 1.1992 1.3984 1.6016l1.1016 0.60156c0.60156 0.30078 1.5 0.39844 2.3008 0.19922l4.3008-1.1992c3.1016-0.89844 5.1016-1.5 7.3984-0.5 2.3008 0.89844 3.3984 2.8008 5 5.5l1.8008 3.1016c1.3984 2.5 2.5 4.3008 2.3008 6.6992-0.19922 2.3984-1.6016 3.8008-3.6016 6.1016l-3.9961 4.4062c-0.19922 0.19922-0.60156 1.3984-0.60156 2.6016 0 1.1016 0.5 2.3008 0.80078 2.6992l3.6016 4c2 2.1992 3.3008 3.6992 3.6016 6.1016 0.19922 2.3984-0.80078 4.1992-2.3008 6.6992l-1.8008 3.1016c-1.6016 2.8008-2.6992 4.6016-5 5.6016-2.3008 0.89844-4.3984 0.39844-7.3984-0.5l-4.3984-1.1992c-0.69922-0.10156-1.5 0-2.3008 0.30078l-1.1016 0.60156c-0.5 0.30078-1 0.89844-1.3008 1.6992l-1.1992 3.5c-0.89844 2.8008-1.6016 4.6992-3.5 6.1016-1.8008 1.293-3.8008 1.293-6.8008 1.293zm-6.6016-7.3008c0.5 0.10156 1.6016 0.10156 2.6016 0.10156h4.1016c1 0 2 0 2.6016-0.10156 0.19922-0.5 0.60156-1.5 0.89844-2.3984l1.1992-3.6016c0.89844-2.3008 2.3984-4.1992 4.3984-5.3984l1.3984-0.80078c2.3984-1.3008 5.1016-1.6016 7.6016-1l4.6016 1.3008c1 0.30078 2.1016 0.60156 2.6992 0.69922 0.30078-0.5 0.89844-1.5 1.3984-2.3984l1.8008-3.1016c0.5-0.80078 1-1.8008 1.1992-2.3008-0.30078-0.39844-1-1.1992-1.6992-2l-3.8008-4.1992c-1.6016-2-2.5-4.8008-2.5-7.3984 0-2.6016 0.89844-5.3984 2.3008-7.3008l3.8984-4.3984c0.69922-0.69922 1.3984-1.5 1.6992-2-0.19922-0.5-0.80078-1.3984-1.1992-2.3008l-1.8984-3.1016c-0.5-0.89844-1.1016-1.8984-1.3984-2.3984-0.60156 0.10156-1.6992 0.39844-2.6992 0.69922l-4.3984 1.3008c-2.6992 0.60156-5.3008 0.30078-7.6016-0.89844l-1.4023-0.80469c-2.1016-1.3984-3.6016-3.1992-4.3984-5.3984l-1.3008-3.8008c-0.30078-0.89844-0.60156-1.8984-0.89844-2.3984-0.5-0.10156-1.6016-0.10156-2.6016-0.10156h-4.1016c-1 0-2 0-2.6016 0.10156-0.19922 0.5-0.60156 1.5-0.89844 2.3984l-1.1992 3.6016c-0.89844 2.3008-2.3984 4.1992-4.3984 5.3984l-1.3984 0.80078c-2.3984 1.3008-5.1016 1.6016-7.6016 1l-4.6016-1.3008c-1-0.30078-2.1016-0.60156-2.6992-0.69922-0.30078 0.5-0.89844 1.5-1.3984 2.3984l-1.8008 3.1016c-0.5 0.80078-1 1.8008-1.1992 2.3008 0.30078 0.39844 1 1.1992 1.6992 2l3.8008 4.1992c1.6016 2 2.5 4.8008 2.5 7.3984 0 2.6016-0.89844 5.3984-2.3008 7.3008l-3.8984 4.3984c-0.69922 0.69922-1.3984 1.5-1.6992 2 0.19922 0.5 0.80078 1.3984 1.1992 2.3008l1.8008 3.1016c0.5 0.89844 1.1016 1.8984 1.3984 2.3984 0.60156-0.10156 1.6992-0.39844 2.6992-0.69922l4.3984-1.1992c2.6992-0.60156 5.3008-0.30078 7.6016 0.89844l1.3984 0.80078c2.1016 1.3008 3.6016 3.1992 4.3984 5.3984l1.3008 3.8008c0.5 0.80078 0.80078 1.8008 1 2.3008z"></path>
+ d="m52.301 90.102h-4.1016c-3 0-5 0-6.8984-1.3984-1.8984-1.3984-2.5-3.3008-3.5-6.1016l-1.1016-3.6016c-0.19922-0.60156-0.69922-1.1992-1.3984-1.6016l-1.1016-0.60156c-0.60156-0.30078-1.5-0.39844-2.3008-0.19922l-4.3008 1.1992c-3.1016 0.89844-5.1016 1.5-7.3984 0.5-2.3008-0.89844-3.3984-2.8008-5-5.6016l-1.8008-3.1016c-1.5-2.5-2.5-4.3008-2.3008-6.6992 0.19922-2.3984 1.6016-3.8008 3.6016-6.1016l3.8008-4.1992c0.19922-0.19922 0.60156-1.3984 0.60156-2.6016 0-1.1016-0.5-2.3008-0.80078-2.6992l-3.6016-4c-2-2.1992-3.3008-3.6992-3.6016-6.1016-0.19922-2.3984 0.80078-4.1992 2.3008-6.6992l1.8008-3.1016c1.6016-2.8008 2.6992-4.6016 5-5.6016 2.3008-0.89844 4.3008-0.39844 7.3984 0.5l4.3984 1.1992c0.69922 0.10156 1.5 0 2.3008-0.30078l1.1016-0.60156c0.5-0.30078 1-0.89844 1.3008-1.6992l1.1992-3.5c0.89844-2.8008 1.6016-4.6992 3.5-6.1016 1.8984-1.3984 3.8984-1.3984 6.8984-1.3984h4.1016c3 0 5 0 6.8984 1.3984 1.8984 1.3984 2.5 3.1992 3.5 6.1016l1.1992 3.6016c0.19922 0.60156 0.69922 1.1992 1.3984 1.6016l1.1016 0.60156c0.60156 0.30078 1.5 0.39844 2.3008 0.19922l4.3008-1.1992c3.1016-0.89844 5.1016-1.5 7.3984-0.5 2.3008 0.89844 3.3984 2.8008 5 5.5l1.8008 3.1016c1.3984 2.5 2.5 4.3008 2.3008 6.6992-0.19922 2.3984-1.6016 3.8008-3.6016 6.1016l-3.9961 4.4062c-0.19922 0.19922-0.60156 1.3984-0.60156 2.6016 0 1.1016 0.5 2.3008 0.80078 2.6992l3.6016 4c2 2.1992 3.3008 3.6992 3.6016 6.1016 0.19922 2.3984-0.80078 4.1992-2.3008 6.6992l-1.8008 3.1016c-1.6016 2.8008-2.6992 4.6016-5 5.6016-2.3008 0.89844-4.3984 0.39844-7.3984-0.5l-4.3984-1.1992c-0.69922-0.10156-1.5 0-2.3008 0.30078l-1.1016 0.60156c-0.5 0.30078-1 0.89844-1.3008 1.6992l-1.1992 3.5c-0.89844 2.8008-1.6016 4.6992-3.5 6.1016-1.8008 1.293-3.8008 1.293-6.8008 1.293zm-6.6016-7.3008c0.5 0.10156 1.6016 0.10156 2.6016 0.10156h4.1016c1 0 2 0 2.6016-0.10156 0.19922-0.5 0.60156-1.5 0.89844-2.3984l1.1992-3.6016c0.89844-2.3008 2.3984-4.1992 4.3984-5.3984l1.3984-0.80078c2.3984-1.3008 5.1016-1.6016 7.6016-1l4.6016 1.3008c1 0.30078 2.1016 0.60156 2.6992 0.69922 0.30078-0.5 0.89844-1.5 1.3984-2.3984l1.8008-3.1016c0.5-0.80078 1-1.8008 1.1992-2.3008-0.30078-0.39844-1-1.1992-1.6992-2l-3.8008-4.1992c-1.6016-2-2.5-4.8008-2.5-7.3984 0-2.6016 0.89844-5.3984 2.3008-7.3008l3.8984-4.3984c0.69922-0.69922 1.3984-1.5 1.6992-2-0.19922-0.5-0.80078-1.3984-1.1992-2.3008l-1.8984-3.1016c-0.5-0.89844-1.1016-1.8984-1.3984-2.3984-0.60156 0.10156-1.6992 0.39844-2.6992 0.69922l-4.3984 1.3008c-2.6992 0.60156-5.3008 0.30078-7.6016-0.89844l-1.4023-0.80469c-2.1016-1.3984-3.6016-3.1992-4.3984-5.3984l-1.3008-3.8008c-0.30078-0.89844-0.60156-1.8984-0.89844-2.3984-0.5-0.10156-1.6016-0.10156-2.6016-0.10156h-4.1016c-1 0-2 0-2.6016 0.10156-0.19922 0.5-0.60156 1.5-0.89844 2.3984l-1.1992 3.6016c-0.89844 2.3008-2.3984 4.1992-4.3984 5.3984l-1.3984 0.80078c-2.3984 1.3008-5.1016 1.6016-7.6016 1l-4.6016-1.3008c-1-0.30078-2.1016-0.60156-2.6992-0.69922-0.30078 0.5-0.89844 1.5-1.3984 2.3984l-1.8008 3.1016c-0.5 0.80078-1 1.8008-1.1992 2.3008 0.30078 0.39844 1 1.1992 1.6992 2l3.8008 4.1992c1.6016 2 2.5 4.8008 2.5 7.3984 0 2.6016-0.89844 5.3984-2.3008 7.3008l-3.8984 4.3984c-0.69922 0.69922-1.3984 1.5-1.6992 2 0.19922 0.5 0.80078 1.3984 1.1992 2.3008l1.8008 3.1016c0.5 0.89844 1.1016 1.8984 1.3984 2.3984 0.60156-0.10156 1.6992-0.39844 2.6992-0.69922l4.3984-1.1992c2.6992-0.60156 5.3008-0.30078 7.6016 0.89844l1.3984 0.80078c2.1016 1.3008 3.6016 3.1992 4.3984 5.3984l1.3008 3.8008c0.5 0.80078 0.80078 1.8008 1 2.3008z">
+ </path>
<path
- d="m50.301 66.5c-9 0-16.398-7.3008-16.398-16.398 0-9.1016 7.3008-16.398 16.398-16.398 9.1016 0 16.398 7.3008 16.398 16.398 0 9.0977-7.3984 16.398-16.398 16.398zm0-25.5c-5 0-9.1016 4.1016-9.1016 9.1016s4.1016 9.1016 9.1016 9.1016 9.1016-4.1016 9.1016-9.1016c-0.003906-5-4.1016-9.1016-9.1016-9.1016z"></path>
- </svg>Settings</button>
- <button class="config-button" id="memory-dash"
- @click="openModal('settings/memory/memory-dashboard.html');">Memory</button>
+ d="m50.301 66.5c-9 0-16.398-7.3008-16.398-16.398 0-9.1016 7.3008-16.398 16.398-16.398 9.1016 0 16.398 7.3008 16.398 16.398 0 9.0977-7.3984 16.398-16.398 16.398zm0-25.5c-5 0-9.1016 4.1016-9.1016 9.1016s4.1016 9.1016 9.1016 9.1016 9.1016-4.1016 9.1016-9.1016c-0.003906-5-4.1016-9.1016-9.1016-9.1016z">
+ </path>
+ </svg>Settings</button>
+ <button class="config-button" id="memory-dash"
+ @click="openModal('settings/memory/memory-dashboard.html');">Memory</button>
+ <button class="config-button" id="dashboard" @click="deselectChat()">Dashboard</button>
+
</div>
</body>
- <style>
- .config-button {
- background-color: var(--color-background);
- border: 0.1rem solid var(--color-border);
- border-radius: var(--spacing-xs);
- cursor: pointer;
- display: inline;
- font-family: "Rubik", Arial, Helvetica, sans-serif;
- font-size: var(--font-size-small);
- opacity: 0.8;
- text-wrap: nowrap;
- width: calc(50% - var(--spacing-xs));
- float: left;
- margin: 0 var(--spacing-xs) var(--spacing-xs) 0;
- padding: var(--spacing-sm) 0.75rem;
- max-height: 2.3rem;
- -webkit-transition: all var(--transition-speed), transform 0.1s ease-in-out;
- transition: all var(--transition-speed), transform 0.1s ease-in-out;
- }
- .config-button:hover {
- background-color: var(--color-secondary);
- opacity: 1;
- }
- .config-button:active {
- opacity: 0.5;
- }
- #settings {
- display: flex;
- align-items: center;
- }
- .light-mode .config-button {
- background-color: var(--color-background);
- color: #333333;
- }
- .light-mode .config-button:hover {
- background-color: #d6dae8;
- }
- .light-mode .config-button:active {
- background-color: #bdc0cb;
- }
- </style>
+<style>
+ .config-button {
+ background-color: var(--color-background);
+ border: 0.1rem solid var(--color-border);
+ border-radius: var(--spacing-xs);
+ cursor: pointer;
+ display: inline;
+ font-family: "Rubik", Arial, Helvetica, sans-serif;
+ font-size: var(--font-size-small);
+ opacity: 0.8;
+ text-wrap: nowrap;
+ width: calc(50% - var(--spacing-xs));
+ float: left;
+ margin: 0 var(--spacing-xs) var(--spacing-xs) 0;
+ padding: var(--spacing-sm) 0.75rem;
+ max-height: 2.3rem;
+ -webkit-transition: all var(--transition-speed), transform 0.1s ease-in-out;
+ transition: all var(--transition-speed), transform 0.1s ease-in-out;
+ }
+
+ .config-button:hover {
+ background-color: var(--color-secondary);
+ opacity: 1;
+ }
+
+ .config-button:active {
+ opacity: 0.5;
+ }
+
+ #settings {
+ display: flex;
+ align-items: center;
+ }
+
+ .light-mode .config-button {
+ background-color: var(--color-background);
+ color: #333333;
+ }
+
+ .light-mode .config-button:hover {
+ background-color: #d6dae8;
+ }
+
+ .light-mode .config-button:active {
+ background-color: #bdc0cb;
+ }
+</style>
+
</html>
\ No newline at end of file
diff --git a/webui/components/welcome/welcome-store.js b/webui/components/welcome/welcome-store.js
index f706de89e..bc4cac2c1 100644
--- a/webui/components/welcome/welcome-store.js
+++ b/webui/components/welcome/welcome-store.js
@@ -1,5 +1,4 @@
import { createStore } from "/js/AlpineStore.js";
-import { store as contextStore } from "/components/chat/context/context-store.js";
const model = {
// State
diff --git a/webui/index.html b/webui/index.html
index cea7b9eee..ad400dd49 100644
--- a/webui/index.html
+++ b/webui/index.html
@@ -168,9 +168,13 @@
<!-- Project Selector -->
<x-component path="projects/project-selector.html"></x-component>
</div>
- <!-- Message History (actual messages) -->
- <div id="chat-history">
+
+ <!-- Welcome Screen Component -->
+ <div x-data x-show="$store.welcomeStore && $store.welcomeStore.isVisible">
+ <x-component path="welcome/welcome-screen.html"></x-component>
</div>
+ <!-- Message History (actual messages) -->
+ <div id="chat-history" x-data x-show="!$store.welcomeStore || !$store.welcomeStore.isVisible"></div>
<!-- NEW: Toast Stack Component -->
<div style="position: relative; height: 0;">
diff --git a/webui/index.js b/webui/index.js
index 47a81ec1c..281651663 100644
--- a/webui/index.js
+++ b/webui/index.js
@@ -13,15 +13,24 @@ import { store as tasksStore } from "/components/sidebar/tasks/tasks-store.js";
globalThis.fetchApi = api.fetchApi; // TODO - backward compatibility for non-modular scripts, remove once refactored to alpine
// Declare variables for DOM elements, they will be assigned on DOMContentLoaded
-let leftPanel, rightPanel, container, chatInput, chatHistory, sendButton, inputSection, statusSection, progressBar, autoScrollSwitch, timeDate;
+let leftPanel,
+ rightPanel,
+ container,
+ chatInput,
+ chatHistory,
+ sendButton,
+ inputSection,
+ statusSection,
+ progressBar,
+ autoScrollSwitch,
+ timeDate;
let autoScroll = true;
-let context = "";
+let context = null;
globalThis.resetCounter = 0; // Used by stores and getChatBasedId
let skipOneSpeech = false;
let connectionStatus = undefined; // undefined = not checked yet, true = connected, false = disconnected
-
// Sidebar toggle logic is now handled by sidebar-store.js
export async function sendMessage() {
@@ -226,7 +235,9 @@ function setConnectionStatus(connected) {
connectionStatus = connected;
// Broadcast connection status without touching Alpine directly
try {
- window.dispatchEvent(new CustomEvent("connection-status", { detail: { connected } }));
+ window.dispatchEvent(
+ new CustomEvent("connection-status", { detail: { connected } })
+ );
} catch (_e) {
// no-op
}
@@ -256,8 +267,13 @@ async function poll() {
return false;
}
- if (!context) setContext(response.context);
- if (response.context != context) return; //skip late polls after context change
+ if (
+ response.context != context &&
+ !(response.context === null && context === null) &&
+ context !== null
+ ) {
+ return;
+ }
// if the chat has been reset, restart this poll as it may have been called with incorrect log_from
if (lastLogGuid != response.log_guid) {
@@ -311,7 +327,7 @@ async function poll() {
if (context) {
// Update selection in both stores
chatsStore.setSelected(context);
-
+
// Check if this context exists in the chats list
const contextExists = chatsStore.contains(context);
@@ -323,7 +339,7 @@ async function poll() {
chatsStore.setSelected(firstChatId);
}
}
-
+
tasksStore.setSelected(context);
} else {
// No context selected, try to select the first available item
@@ -429,8 +445,9 @@ globalThis.selectChat = async function (id) {
};
function generateShortId() {
- const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
- let result = '';
+ const chars =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+ let result = "";
for (let i = 0; i < 8; i++) {
result += chars.charAt(Math.floor(Math.random() * chars.length));
}
@@ -440,7 +457,7 @@ function generateShortId() {
export const newContext = function () {
context = generateShortId();
setContext(context);
-}
+};
globalThis.newContext = newContext;
export const setContext = function (id) {
@@ -467,9 +484,22 @@ export const setContext = function (id) {
if (localStorage.getItem("speech") == "true") skipOneSpeech = true;
};
+export const deselectChat = function () {
+ // Clear current context to show welcome screen
+ setContext(null);
+
+ // Clear localStorage selections so we don't auto-restore
+ localStorage.removeItem("lastSelectedChat");
+ localStorage.removeItem("lastSelectedTask");
+
+ // Clear the chat history
+ chatHistory.innerHTML = "";
+};
+globalThis.deselectChat = deselectChat;
+
export const getContext = function () {
return context;
-}
+};
globalThis.getContext = getContext;
globalThis.setContext = setContext;
@@ -477,7 +507,6 @@ export const getChatBasedId = function (id) {
return context + "-" + globalThis.resetCounter + "-" + id;
};
-
globalThis.loadChats = async function () {
await chatsStore.loadChats();
};
@@ -486,7 +515,6 @@ globalThis.saveChat = async function () {
await chatsStore.saveChat();
};
-
function addClassToElement(element, className) {
element.classList.add(className);
}
@@ -496,34 +524,26 @@ function removeClassFromElement(element, className) {
}
function justToast(text, type = "info", timeout = 5000, group = "") {
- notificationStore.addFrontendToastOnly(
- type,
- text,
- "",
- timeout / 1000,
- group
- )
+ notificationStore.addFrontendToastOnly(type, text, "", timeout / 1000, group);
}
globalThis.justToast = justToast;
-
function toast(text, type = "info", timeout = 5000) {
// Convert timeout from milliseconds to seconds for new notification system
const display_time = Math.max(timeout / 1000, 1); // Minimum 1 second
// Use new frontend notification system based on type
- switch (type.toLowerCase()) {
- case "error":
- return notificationStore.frontendError(text, "Error", display_time);
- case "success":
- return notificationStore.frontendInfo(text, "Success", display_time);
- case "warning":
- return notificationStore.frontendWarning(text, "Warning", display_time);
- case "info":
- default:
- return notificationStore.frontendInfo(text, "Info", display_time);
- }
-
+ switch (type.toLowerCase()) {
+ case "error":
+ return notificationStore.frontendError(text, "Error", display_time);
+ case "success":
+ return notificationStore.frontendInfo(text, "Success", display_time);
+ case "warning":
+ return notificationStore.frontendWarning(text, "Warning", display_time);
+ case "info":
+ default:
+ return notificationStore.frontendInfo(text, "Info", display_time);
+ }
}
globalThis.toast = toast;
@@ -540,7 +560,7 @@ function updateAfterScroll() {
const tolerancePx = 10;
const chatHistory = document.getElementById("chat-history");
if (!chatHistory) return;
-
+
const isAtBottom =
chatHistory.scrollHeight - chatHistory.scrollTop <=
chatHistory.clientHeight + tolerancePx;
@@ -590,9 +610,9 @@ document.addEventListener("DOMContentLoaded", function () {
progressBar = document.getElementById("progress-bar");
autoScrollSwitch = document.getElementById("auto-scroll-switch");
timeDate = document.getElementById("time-date-container");
-
+
// Sidebar and input event listeners are now handled by their respective stores
-
+
if (chatHistory) {
chatHistory.addEventListener("scroll", updateAfterScroll);
}