Agent Zero AI framework
(WIP) feat: Task Scheduler Management UI/UX
Rafael Uzarowski82eebf730e9b
diff --git a/agent.py b/agent.pyindex de9ba65dc..3bfd885f8 100644--- a/agent.py+++ b/agent.py@@ -1,6 +1,7 @@import asynciofrom collections import OrderedDictfrom dataclasses import dataclass, field+from datetime import datetimeimport time, importlib, inspect, os, jsonimport tokenfrom typing import Any, Awaitable, Coroutine, Optional, Dict, TypedDict@@ -42,6 +43,7 @@ class AgentContext:log: Log.Log | None = None,paused: bool = False,streaming_agent: "Agent|None" = None,+ created_at: datetime | None = None,):# build contextself.id = id or str(uuid.uuid4())@@ -52,6 +54,7 @@ class AgentContext:self.paused = pausedself.streaming_agent = streaming_agentself.task: DeferredTask | None = None+ self.created_at = created_at or datetime.now()AgentContext._counter += 1self.no = AgentContext._counter@@ -77,6 +80,9 @@ class AgentContext:context.task.kill()return context+ def get_created_at(self):+ return self.created_at+def kill_process(self):if self.task:self.task.kill()@@ -195,6 +201,7 @@ class AgentConfig:class UserMessage:message: strattachments: list[str] = field(default_factory=list[str])+ system_message: list[str] = field(default_factory=list[str])class LoopData:@@ -466,12 +473,14 @@ class Agent:"fw.intervention.md",message=message.message,attachments=message.attachments,+ system_message=message.system_message)else:content = self.parse_prompt("fw.user_message.md",message=message.message,attachments=message.attachments,+ system_message=message.system_message)# remove empty attachments from templatediff --git a/prompts/default/fw.intervention.md b/prompts/default/fw.intervention.mdindex 78488abf0..7f03e2521 100644--- a/prompts/default/fw.intervention.md+++ b/prompts/default/fw.intervention.md@@ -1,6 +1,7 @@```json{"user_intervention": {{message}},+ "system_message": {{system_message}},"attachments": {{attachments}}}-```\ No newline at end of file+```diff --git a/prompts/default/fw.user_message.md b/prompts/default/fw.user_message.mdindex 5c7ec0d17..bf73ed899 100644--- a/prompts/default/fw.user_message.md+++ b/prompts/default/fw.user_message.md@@ -1,6 +1,7 @@```json{"user_message": {{message}},+ "system_message": {{system_message}},"attachments": {{attachments}}}```diff --git a/python/api/poll.py b/python/api/poll.pyindex d51ec2d53..7aefa0f37 100644--- a/python/api/poll.py+++ b/python/api/poll.py@@ -1,12 +1,16 @@+import time+from python.helpers.api import ApiHandlerfrom flask import Request, Responsefrom agent import AgentContextfrom python.helpers import persist_chat+from python.helpers.task_scheduler import TaskSchedulerclass Poll(ApiHandler):+async def process(self, input: dict, request: Request) -> dict | Response:ctxid = input.get("context", None)from_no = input.get("log_from", 0)@@ -17,19 +21,31 @@ class Poll(ApiHandler):logs = context.log.output(start=from_no)# loop AgentContext._contexts++ # Get a task scheduler instance+ scheduler = TaskScheduler.get()++ # Always reload the scheduler on each poll to ensure we have the latest task state+ await scheduler.reload()++ # loop AgentContext._contexts and number unnamed chats+ctxs = []tasks = []processed_contexts = set() # Track processed context IDs+ all_ctxs = list(AgentContext._contexts.values())# First, identify all tasks- for ctx in AgentContext._contexts.values():+ for ctx in all_ctxs:# Skip if already processedif ctx.id in processed_contexts:continue+ # Create the base context data that will be returnedcontext_data = {"id": ctx.id,"name": ctx.name,+ "created_at": ctx.created_at,"no": ctx.no,"log_guid": ctx.log.guid,"log_version": len(ctx.log.updates),@@ -37,19 +53,43 @@ class Poll(ApiHandler):"paused": ctx.paused,}- # Determine if this is a task using multiple methods- ctx_path = persist_chat.get_chat_folder_path(ctx.id)- is_task = (ctx_path and persist_chat.TASKS_FOLDER in ctx_path)+ # Determine if this is a task by checking if a task with this UUID exists+ is_task = scheduler.get_task_by_uuid(ctx.id) is not None- # Add to the appropriate list- if is_task:- tasks.append(context_data)- else:+ if not is_task:ctxs.append(context_data)+ else:+ # If this is a task, get task details from the scheduler+ task_details = scheduler.serialize_task(ctx.id)+ if task_details:+ # Add task details to context_data with the same field names+ # as used in scheduler endpoints to maintain UI compatibility+ context_data.update({+ "uuid": task_details.get("uuid"),+ "state": task_details.get("state"),+ "type": task_details.get("type"),+ "system_prompt": task_details.get("system_prompt"),+ "prompt": task_details.get("prompt"),+ "last_run": task_details.get("last_run"),+ "last_result": task_details.get("last_result"),+ "attachments": task_details.get("attachments", [])+ })++ # Add type-specific fields+ if task_details.get("type") == "scheduled":+ context_data["schedule"] = task_details.get("schedule")+ else:+ context_data["token"] = task_details.get("token")++ tasks.append(context_data)# Mark as processedprocessed_contexts.add(ctx.id)+ # Sort tasks and chats by their creation date, descending+ ctxs.sort(key=lambda x: x["created_at"], reverse=True)+ tasks.sort(key=lambda x: x["created_at"], reverse=True)+# data from this serverreturn {"context": context.id,diff --git a/python/api/scheduler_task_create.py b/python/api/scheduler_task_create.pynew file mode 100644index 000000000..5f657989f--- /dev/null+++ b/python/api/scheduler_task_create.py@@ -0,0 +1,78 @@+from python.helpers.api import ApiHandler, Input, Output, Request+from python.helpers.task_scheduler import (+ TaskScheduler, ScheduledTask, AdHocTask, TaskSchedule,+ serialize_task, parse_task_schedule+)+++class SchedulerTaskCreate(ApiHandler):+ async def process(self, input: Input, request: Request) -> Output:+ """+ Create a new task in the scheduler+ """+ scheduler = TaskScheduler.get()+ await scheduler.reload()++ # Get common fields from input+ name = input.get("name")+ system_prompt = input.get("system_prompt")+ prompt = input.get("prompt")+ attachments = input.get("attachments", [])++ # Check if schedule is provided (for ScheduledTask)+ schedule = input.get("schedule", {})+ token: str = input.get("token", "")++ # Validate required fields+ if not name or not system_prompt or not prompt:+ return {"error": "Missing required fields: name, system_prompt, prompt"}++ task = None+ if schedule:+ # Create a scheduled task+ # Handle different schedule formats (string or object)+ if isinstance(schedule, str):+ # Parse the string schedule+ parts = schedule.split(' ')+ task_schedule = TaskSchedule(+ minute=parts[0] if len(parts) > 0 else "*",+ hour=parts[1] if len(parts) > 1 else "*",+ day=parts[2] if len(parts) > 2 else "*",+ month=parts[3] if len(parts) > 3 else "*",+ weekday=parts[4] if len(parts) > 4 else "*"+ )+ elif isinstance(schedule, dict):+ # Use our standardized parsing function+ try:+ task_schedule = parse_task_schedule(schedule)+ except ValueError as e:+ return {"error": str(e)}+ else:+ return {"error": "Invalid schedule format. Must be string or object."}++ task = ScheduledTask.create(+ name=name,+ system_prompt=system_prompt,+ prompt=prompt,+ schedule=task_schedule,+ attachments=attachments+ )+ else:+ # Create an ad-hoc task+ task = AdHocTask.create(+ name=name,+ system_prompt=system_prompt,+ prompt=prompt,+ token=token,+ attachments=attachments+ )++ # Add the task to the scheduler+ await scheduler.add_task(task)++ # Return the created task using our standardized serialization function+ task_dict = serialize_task(task)++ return {+ "task": task_dict+ }diff --git a/python/api/scheduler_task_delete.py b/python/api/scheduler_task_delete.pynew file mode 100644index 000000000..e526285aa--- /dev/null+++ b/python/api/scheduler_task_delete.py@@ -0,0 +1,27 @@+from python.helpers.api import ApiHandler, Input, Output, Request+from python.helpers.task_scheduler import TaskScheduler+++class SchedulerTaskDelete(ApiHandler):+ async def process(self, input: Input, request: Request) -> Output:+ """+ Delete a task from the scheduler by ID+ """+ scheduler = TaskScheduler.get()+ await scheduler.reload()++ # Get task ID from input+ task_id: str = input.get("task_id", "")++ if not task_id:+ return {"error": "Missing required field: task_id"}++ # Check if the task exists first+ task = scheduler.get_task_by_uuid(task_id)+ if not task:+ return {"error": f"Task with ID {task_id} not found"}++ # Remove the task+ await scheduler.remove_task_by_uuid(task_id)++ return {"success": True, "message": f"Task {task_id} deleted successfully"}diff --git a/python/api/scheduler_task_run.py b/python/api/scheduler_task_run.pynew file mode 100644index 000000000..dd1dbbd4c--- /dev/null+++ b/python/api/scheduler_task_run.py@@ -0,0 +1,49 @@+from python.helpers.api import ApiHandler, Input, Output, Request+from python.helpers.task_scheduler import TaskScheduler, TaskState+++class SchedulerTaskRun(ApiHandler):+ async def process(self, input: Input, request: Request) -> Output:+ """+ Manually run a task from the scheduler by ID+ """+ scheduler = TaskScheduler.get()+ await scheduler.reload()++ # Get task ID from input+ task_id: str = input.get("task_id", "")++ if not task_id:+ return {"error": "Missing required field: task_id"}++ # Check if the task exists first+ task = scheduler.get_task_by_uuid(task_id)+ if not task:+ return {"error": f"Task with ID '{task_id}' not found"}++ # Check if task is already running+ if task.state != TaskState.IDLE:+ # Return task details along with error for better frontend handling+ serialized_task = scheduler.serialize_task(task_id)+ return {+ "error": f"Task '{task_id}' is in state '{task.state}' and cannot be run",+ "task": serialized_task+ }++ # Run the task, which now includes atomic state checks and updates+ try:+ await scheduler.run_task_by_uuid(task_id)+ # Get updated task after run starts+ serialized_task = scheduler.serialize_task(task_id)+ if serialized_task:+ return {+ "success": True,+ "message": f"Task '{task_id}' started successfully",+ "task": serialized_task+ }+ else:+ return {"success": True, "message": f"Task '{task_id}' started successfully"}+ except ValueError as e:+ return {"error": str(e)}+ except Exception as e:+ return {"error": f"Failed to run task '{task_id}': {str(e)}"}diff --git a/python/api/scheduler_task_update.py b/python/api/scheduler_task_update.pynew file mode 100644index 000000000..ca73bd39f--- /dev/null+++ b/python/api/scheduler_task_update.py@@ -0,0 +1,67 @@+from python.helpers.api import ApiHandler, Input, Output, Request+from python.helpers.task_scheduler import (+ TaskScheduler, ScheduledTask, AdHocTask, TaskState,+ serialize_task, parse_task_schedule+)+++class SchedulerTaskUpdate(ApiHandler):+ async def process(self, input: Input, request: Request) -> Output:+ """+ Update an existing task in the scheduler+ """+ scheduler = TaskScheduler.get()+ await scheduler.reload()++ # Get task ID from input+ task_id: str = input.get("task_id", "")++ if not task_id:+ return {"error": "Missing required field: task_id"}++ # Get the task to update+ task = scheduler.get_task_by_uuid(task_id)++ if not task:+ return {"error": f"Task with ID {task_id} not found"}++ # Update fields if provided using the task's update method+ update_params = {}++ if "name" in input:+ update_params["name"] = input.get("name", "")++ if "state" in input:+ update_params["state"] = TaskState(input.get("state", TaskState.IDLE))++ if "system_prompt" in input:+ update_params["system_prompt"] = input.get("system_prompt", "")++ if "prompt" in input:+ update_params["prompt"] = input.get("prompt", "")++ if "attachments" in input:+ update_params["attachments"] = input.get("attachments", [])++ # Update schedule if this is a scheduled task and schedule is provided+ if isinstance(task, ScheduledTask) and "schedule" in input:+ schedule_data = input.get("schedule", {})+ try:+ update_params["schedule"] = parse_task_schedule(schedule_data)+ except ValueError as e:+ return {"error": f"Invalid schedule format: {str(e)}"}+ elif isinstance(task, AdHocTask) and "token" in input:+ update_params["token"] = input.get("token", "")++ # Use atomic update method to apply changes+ updated_task = await scheduler.update_task(task_id, **update_params)++ if not updated_task:+ return {"error": f"Task with ID {task_id} not found or could not be updated"}++ # Return the updated task using our standardized serialization function+ task_dict = serialize_task(updated_task)++ return {+ "task": task_dict+ }diff --git a/python/api/scheduler_tasks_list.py b/python/api/scheduler_tasks_list.pynew file mode 100644index 000000000..29fc154b2--- /dev/null+++ b/python/api/scheduler_tasks_list.py@@ -0,0 +1,24 @@+from python.helpers.api import ApiHandler, Input, Output, Request+from python.helpers.task_scheduler import TaskScheduler+import traceback+from python.helpers.print_style import PrintStyle+++class SchedulerTasksList(ApiHandler):+ async def process(self, input: Input, request: Request) -> Output:+ """+ List all tasks in the scheduler with their types+ """+ try:+ # Get task scheduler+ scheduler = TaskScheduler.get()+ await scheduler.reload()++ # Use the scheduler's convenience method for task serialization+ tasks_list = scheduler.serialize_all_tasks()++ return {"tasks": tasks_list}++ except Exception as e:+ PrintStyle.error(f"Failed to list tasks: {str(e)} {traceback.format_exc()}")+ return {"error": f"Failed to list tasks: {str(e)} {traceback.format_exc()}", "tasks": []}diff --git a/python/api/scheduler_tick.py b/python/api/scheduler_tick.pyindex f5d3dd9ea..87bd9c568 100644--- a/python/api/scheduler_tick.py+++ b/python/api/scheduler_tick.py@@ -11,7 +11,32 @@ class SchedulerTick(ApiHandler):return Trueasync def process(self, input: Input, request: Request) -> Output:- # timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")- # PrintStyle().print(f"Scheduler tick - API: {timestamp}")- await TaskScheduler.get().tick()- return {"scheduler": "tick"}+ timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")+ printer = PrintStyle(font_color="green", padding=False)+ printer.print(f"Scheduler tick - API: {timestamp}")++ # Get the task scheduler instance and print detailed debug info+ scheduler = TaskScheduler.get()+ await scheduler.reload()++ tasks = scheduler.get_tasks()+ tasks_count = len(tasks)++ # Log information about the tasks+ printer.print(f"Scheduler has {tasks_count} task(s)")+ if tasks_count > 0:+ for task in tasks:+ printer.print(f"Task: {task.name} (UUID: {task.uuid}, State: {task.state})")++ # Run the scheduler tick+ await scheduler.tick()++ # Get updated tasks after tick+ serialized_tasks = scheduler.serialize_all_tasks()++ return {+ "scheduler": "tick",+ "timestamp": timestamp,+ "tasks_count": tasks_count,+ "tasks": serialized_tasks+ }diff --git a/python/helpers/api.py b/python/helpers/api.pyindex 8c7e7a59f..2d1cbfaa5 100644--- a/python/helpers/api.py+++ b/python/helpers/api.py@@ -39,13 +39,21 @@ class ApiHandler:async def handle_request(self, request: Request) -> Response:try:# input data from request based on type+ input_data: Input = {}if request.is_json:- input = request.get_json()+ try:+ if request.data: # Check if there's any data+ input_data = request.get_json()+ # If empty or not valid JSON, use empty dict+ except Exception as e:+ # Just log the error and continue with empty input+ PrintStyle().print(f"Error parsing JSON: {str(e)}")+ input_data = {}else:- input = {"data": request.get_data(as_text=True)}+ input_data = {"data": request.get_data(as_text=True)}# process via handler- output = await self.process(input, request)+ output = await self.process(input_data, request)# return output based on typeif isinstance(output, Response):@@ -59,7 +67,7 @@ class ApiHandler:# return exceptions with 500except Exception as e:error = format_error(e)- PrintStyle.error(error)+ PrintStyle.error(f"API error: {error}")return Response(response=error, status=500, mimetype="text/plain")# get context to run agent zero indiff --git a/python/helpers/persist_chat.py b/python/helpers/persist_chat.pyindex ce81a1293..4a9eed093 100644--- a/python/helpers/persist_chat.py+++ b/python/helpers/persist_chat.py@@ -9,30 +9,39 @@ from initialize import initializefrom python.helpers.log import Log, LogItemCHATS_FOLDER = "tmp/chats"-TASKS_FOLDER = "tmp/task_chats"LOG_SIZE = 1000CHAT_FILE_NAME = "chat.json"-def get_chat_folder_path(ctxid: str, folder: str = CHATS_FOLDER):- return files.get_abs_path(folder, ctxid)+def get_chat_folder_path(ctxid: str):+ """+ Get the folder path for any context (chat or task).+ Args:+ ctxid: The context ID-def save_tmp_chat(context: AgentContext, folder: str = CHATS_FOLDER):- path = _get_chat_file_path(context.id, folder)+ Returns:+ The absolute path to the context folder+ """+ return files.get_abs_path(CHATS_FOLDER, ctxid)+++def save_tmp_chat(context: AgentContext):+ """Save context to the chats folder"""+ path = _get_chat_file_path(context.id)files.make_dirs(path)data = _serialize_context(context)js = _safe_json_serialize(data, ensure_ascii=False)files.write_file(path, js)-def load_tmp_chats(folder: str = CHATS_FOLDER):- if folder == CHATS_FOLDER:- _convert_v080_chats()- folders = files.list_files(folder, "*")+def load_tmp_chats():+ """Load all contexts from the chats folder"""+ _convert_v080_chats()+ folders = files.list_files(CHATS_FOLDER, "*")json_files = []for folder_name in folders:- json_files.append(_get_chat_file_path(folder_name, folder))+ json_files.append(_get_chat_file_path(folder_name))ctxids = []for file in json_files:@@ -46,8 +55,8 @@ def load_tmp_chats(folder: str = CHATS_FOLDER):return ctxids-def _get_chat_file_path(ctxid: str, folder: str = CHATS_FOLDER):- return files.get_abs_path(folder, ctxid, CHAT_FILE_NAME)+def _get_chat_file_path(ctxid: str):+ return files.get_abs_path(CHATS_FOLDER, ctxid, CHAT_FILE_NAME)def _convert_v080_chats():@@ -59,7 +68,8 @@ def _convert_v080_chats():files.move_file(path, new)-def load_json_chats(jsons: list[str], folder: str = CHATS_FOLDER):+def load_json_chats(jsons: list[str]):+ """Load contexts from JSON strings"""ctxids = []for js in jsons:data = json.loads(js)@@ -71,30 +81,16 @@ def load_json_chats(jsons: list[str], folder: str = CHATS_FOLDER):def export_json_chat(context: AgentContext):+ """Export context as JSON string"""data = _serialize_context(context)js = _safe_json_serialize(data, ensure_ascii=False)return js-def remove_chat(ctxid, folder: str = CHATS_FOLDER):- files.delete_dir(get_chat_folder_path(ctxid, folder))---# Task-specific functions for convenience-def save_tmp_task(context: AgentContext):- save_tmp_chat(context, TASKS_FOLDER)---def load_tmp_tasks():- return load_tmp_chats(TASKS_FOLDER)---def load_json_tasks(jsons: list[str]):- return load_json_chats(jsons, TASKS_FOLDER)---def remove_task(ctxid):- remove_chat(ctxid, TASKS_FOLDER)+def remove_chat(ctxid):+ """Remove a chat or task context"""+ path = get_chat_folder_path(ctxid)+ files.delete_dir(path)def _serialize_context(context: AgentContext):diff --git a/python/helpers/print_style.py b/python/helpers/print_style.pyindex 083326662..ef2de0ea8 100644--- a/python/helpers/print_style.py+++ b/python/helpers/print_style.py@@ -34,7 +34,7 @@ class PrintStyle:else:rgb_color = webcolors.name_to_rgb(color)r, g, b = rgb_color.red, rgb_color.green, rgb_color.blue-+if is_background:return f"\033[48;2;{r};{g};{b}m", f"background-color: rgb({r}, {g}, {b});"else:@@ -88,15 +88,15 @@ class PrintStyle:def _close_html_log():if PrintStyle.log_file_path:with open(PrintStyle.log_file_path, "a") as f:- f.write("</pre></body></html>")+ f.write("</pre></body></html>")def get(self, *args, sep=' ', **kwargs):text = sep.join(map(str, args))return text, self._get_styled_text(text), self._get_html_styled_text(text)-+def print(self, *args, sep=' ', **kwargs):self._add_padding_if_needed()- if not PrintStyle.last_endline:+ if not PrintStyle.last_endline:print()self._log_html("<br>")plain_text, styled_text, html_text = self.get(*args, sep=sep, **kwargs)@@ -118,15 +118,31 @@ class PrintStyle:return bool(lines) and not lines[-1].strip()@staticmethod- def standard(text:str):+ def standard(text: str):PrintStyle().print(text)@staticmethod- def hint(text:str):+ def hint(text: str):PrintStyle(font_color="#6C3483", padding=True).print("Hint: "+text)@staticmethod- def error(text:str):+ def info(text: str):+ PrintStyle(font_color="#0000FF", padding=True).print("Info: "+text)++ @staticmethod+ def success(text: str):+ PrintStyle(font_color="#008000", padding=True).print("Success: "+text)++ @staticmethod+ def warning(text: str):+ PrintStyle(font_color="#FFA500", padding=True).print("Warning: "+text)++ @staticmethod+ def debug(text: str):+ PrintStyle(font_color="#808080", padding=True).print("Debug: "+text)++ @staticmethod+ def error(text: str):PrintStyle(font_color="red", padding=True).print("Error: "+text)# Ensure HTML file is closed properly when the program exitsdiff --git a/python/helpers/task_scheduler.py b/python/helpers/task_scheduler.pyindex bce416cbe..56e122e95 100644--- a/python/helpers/task_scheduler.py+++ b/python/helpers/task_scheduler.py@@ -1,28 +1,40 @@-import uuid-import random+import asyncioimport os-from datetime import datetime, timezone+import randomimport threading-import asyncio+import uuid+from datetime import datetime, timezone, timedelta+from enum import Enum+from os.path import exists+from typing import ClassVar, Literal, Optional, Union, Dict, Any, Type, TypeVar, cast+import nest_asyncionest_asyncio.apply()-from typing import Union, Literal, Optional-from crontab import CronTabfrom pydantic import BaseModel, Field, PrivateAttr-from python.helpers.files import get_abs_path, exists, write_file, read_file, make_dirs+from agent import Agent, AgentContext, UserMessagefrom initialize import initialize-from python.helpers.persist_chat import export_json_chat, load_json_chats, load_tmp_chats, save_tmp_chat+from python.helpers.persist_chat import load_tmp_chats, save_tmp_chatfrom python.helpers.print_style import PrintStylefrom python.helpers.defer import DeferredTask-from python.helpers.persist_chat import CHATS_FOLDER, TASKS_FOLDER-from python.helpers import errors+from python.helpers.files import make_dirs, write_file, get_abs_path, read_fileSCHEDULER_FOLDER = "memory/scheduler"+# ----------------------+# Task Models+# ----------------------++class TaskState(str, Enum):+ IDLE = "idle"+ RUNNING = "running"+ DISABLED = "disabled"+ ERROR = "error"++class TaskSchedule(BaseModel):minute: strhour: str@@ -36,7 +48,7 @@ class TaskSchedule(BaseModel):class AdHocTask(BaseModel):uuid: str = Field(default_factory=lambda: str(uuid.uuid4()))- state: Literal["idle", "running", "disabled"] = Field(default="idle")+ state: TaskState = Field(default=TaskState.IDLE)name: str = Field()system_prompt: strprompt: str@@ -66,16 +78,17 @@ class AdHocTask(BaseModel):def __init__(self, *args, **kwargs):super().__init__(*args, **kwargs)- self._lock = threading.Lock()+ self._lock = threading.RLock()def update(self,name: str | None = None,- state: Literal["idle", "running", "disabled"] | None = None,+ state: TaskState | None = None,system_prompt: str | None = None,prompt: str | None = None,attachments: list[str] | None = None,last_run: datetime | None = None,- last_result: str | None = None):+ last_result: str | None = None,+ token: str | None = None):with self._lock:if name is not None:self.name = name@@ -98,6 +111,9 @@ class AdHocTask(BaseModel):if last_result is not None:self.last_result = last_resultself.updated_at = datetime.now(timezone.utc)+ if token is not None:+ self.token = token+ self.updated_at = datetime.now(timezone.utc)def check_schedule(self) -> bool:with self._lock:@@ -106,7 +122,7 @@ class AdHocTask(BaseModel):class ScheduledTask(BaseModel):uuid: str = Field(default_factory=lambda: str(uuid.uuid4()))- state: Literal["idle", "running", "disabled"] = Field(default="idle")+ state: TaskState = Field(default=TaskState.IDLE)name: strschedule: TaskSchedulesystem_prompt: str@@ -136,11 +152,11 @@ class ScheduledTask(BaseModel):def __init__(self, *args, **kwargs):super().__init__(*args, **kwargs)- self._lock = threading.Lock()+ self._lock = threading.RLock()def update(self,name: str | None = None,- state: Literal["idle", "running", "disabled"] | None = None,+ state: TaskState | None = None,system_prompt: str | None = None,prompt: str | None = None,attachments: list[str] | None = None,@@ -176,10 +192,15 @@ class ScheduledTask(BaseModel):def check_schedule(self, frequency_seconds: float = 60.0) -> bool:with self._lock:crontab = CronTab(crontab=self.schedule.to_crontab())- next_run: float | None = crontab.next(now=datetime.now(timezone.utc), return_datetime=False)- if next_run is None:+ # Get next run time as seconds until next execution+ # Set reference time to now - 1 minute to avoid off-by-one+ next_run_seconds: Optional[float] = crontab.next(+ now=datetime.now(timezone.utc) - timedelta(seconds=frequency_seconds),+ return_datetime=False+ ) # type: ignore+ if next_run_seconds is None:return False- return next_run < frequency_seconds+ return next_run_seconds < frequency_secondsdef run(self):pass@@ -188,21 +209,36 @@ class ScheduledTask(BaseModel):class SchedulerTaskList(BaseModel):tasks: list[Union[ScheduledTask, AdHocTask]]+ # Singleton instance+ __instance: ClassVar[Optional["SchedulerTaskList"]] = PrivateAttr(default=None)+# lock: threading.Lock = Field(exclude=True, default=threading.Lock())@classmethoddef get(cls) -> "SchedulerTaskList":path = get_abs_path(SCHEDULER_FOLDER, "tasks.json")- if not exists(path):- make_dirs(path)- instance = asyncio.run(cls(tasks=[]).save())+ if cls.__instance is None:+ if not exists(path):+ make_dirs(path)+ cls.__instance = asyncio.run(cls(tasks=[]).save())+ else:+ cls.__instance = cls.model_validate_json(read_file(path))else:- instance = cls.model_validate_json(read_file(path))- return instance+ asyncio.run(cls.__instance.reload())+ return cls.__instancedef __init__(self, *args, **kwargs):super().__init__(*args, **kwargs)- self._lock = threading.Lock()+ self._lock = threading.RLock()++ async def reload(self) -> "SchedulerTaskList":+ path = get_abs_path(SCHEDULER_FOLDER, "tasks.json")+ if exists(path):+ with self._lock:+ data = self.__class__.model_validate_json(read_file(path))+ self.tasks.clear()+ self.tasks.extend(data.tasks)+ return selfasync def add_task(self, task: Union[ScheduledTask, AdHocTask]) -> "SchedulerTaskList":with self._lock:@@ -218,6 +254,39 @@ class SchedulerTaskList(BaseModel):write_file(path, self.model_dump_json())return self+ async def update_task_by_uuid(self, task_uuid: str, updater_func) -> Union[ScheduledTask, AdHocTask] | None:+ """+ Atomically update a task by UUID using the provided updater function.++ The updater_func should take the task as an argument and perform any necessary updates.+ This method ensures that the task is updated and saved atomically, preventing race conditions.++ Returns the updated task or None if not found.+ """+ with self._lock:+ # Reload to ensure we have the latest state+ await self.reload()++ # Find the task+ task = next((task for task in self.tasks if task.uuid == task_uuid), None)+ if task is None:+ return None++ # Apply the updates via the provided function+ updater_func(task)++ # Save the changes+ path = get_abs_path(SCHEDULER_FOLDER, "tasks.json")+ if not exists(path):+ make_dirs(path)+ write_file(path, self.model_dump_json())++ return task++ def get_tasks(self) -> list[Union[ScheduledTask, AdHocTask]]:+ with self._lock:+ return self.tasks+def get_due_tasks(self) -> list[Union[ScheduledTask, AdHocTask]]:with self._lock:return [task for task in self.tasks if task.check_schedule()]@@ -247,14 +316,44 @@ class TaskScheduler:_tasks: SchedulerTaskList_printer: PrintStyle+ _instance = None@classmethoddef get(cls) -> "TaskScheduler":- return cls()+ if cls._instance is None:+ cls._instance = cls()+ return cls._instancedef __init__(self):- self._tasks = SchedulerTaskList.get()- self._printer = PrintStyle(italic=True, font_color="green", padding=False)+ # Only initialize if this is a new instance+ if not hasattr(self, '_initialized'):+ self._tasks = SchedulerTaskList.get()+ self._printer = PrintStyle(italic=True, font_color="green", padding=False)+ self._initialized = True++ async def reload(self):+ await self._tasks.reload()++ def get_tasks(self) -> list[Union[ScheduledTask, AdHocTask]]:+ return self._tasks.get_tasks()++ async def add_task(self, task: Union[ScheduledTask, AdHocTask]) -> "TaskScheduler":+ await self._tasks.add_task(task)+ return self++ async def remove_task_by_uuid(self, task_uuid: str) -> "TaskScheduler":+ await self._tasks.remove_task_by_uuid(task_uuid)+ return self++ async def remove_task_by_name(self, name: str) -> "TaskScheduler":+ await self._tasks.remove_task_by_name(name)+ return self++ def get_task_by_uuid(self, task_uuid: str) -> Union[ScheduledTask, AdHocTask] | None:+ return self._tasks.get_task_by_uuid(task_uuid)++ def get_task_by_name(self, name: str) -> Union[ScheduledTask, AdHocTask] | None:+ return self._tasks.get_task_by_name(name)async def tick(self):for task in self._tasks.get_due_tasks():@@ -264,6 +363,8 @@ class TaskScheduler:task = self._tasks.get_task_by_uuid(task_uuid)if task is None:raise ValueError(f"Task with UUID {task_uuid} not found")++ # The actual state check and running will be handled in the _run_task methodawait self._run_task(task)async def run_task_by_name(self, name: str):@@ -272,30 +373,40 @@ class TaskScheduler:raise ValueError(f"Task with name {name} not found")await self._run_task(task)+ async def save(self):+ await self._tasks.save()++ async def update_task(self, task_uuid: str, **update_params) -> Union[ScheduledTask, AdHocTask] | None:+ """+ Atomically update a task by UUID with the provided parameters.+ This prevents race conditions when multiple processes update tasks concurrently.++ Returns the updated task or None if not found.+ """+ def _update_task(task):+ task.update(**update_params)++ return await self._tasks.update_task_by_uuid(task_uuid, _update_task)+async def __new_context(self, task: Union[ScheduledTask, AdHocTask]) -> AgentContext:config = initialize()context: AgentContext = AgentContext(config)context.id = task.uuid- # chat_json = export_json_chat(context)- # chat_file = get_abs_path(TASKS_FOLDER, task.uuid, "chat.json")- # make_dirs(chat_file)- # write_file(chat_file, chat_json)- save_tmp_chat(context, TASKS_FOLDER)+ # Save the context+ save_tmp_chat(context)return contextasync def _get_chat_context(self, task: Union[ScheduledTask, AdHocTask]) -> AgentContext:- ctxids = load_tmp_chats(TASKS_FOLDER)- # chat_file = get_abs_path(TASKS_FOLDER, task.uuid, "chat.json")- # if exists(chat_file):+ ctxids = load_tmp_chats()+if task.uuid in ctxids:- # chat = read_file(chat_file)context = AgentContext.get(task.uuid)if isinstance(context, AgentContext):self._printer.print(f"Scheduler Task {task.name} loaded from task {task.uuid}, context ok")context.id = task.uuid- save_tmp_chat(context, TASKS_FOLDER)+ save_tmp_chat(context)return contextelse:self._printer.print(@@ -309,42 +420,53 @@ class TaskScheduler:return await self.__new_context(task)async def _persist_chat(self, task: Union[ScheduledTask, AdHocTask], context: AgentContext):- # chat_json = export_json_chat(context)- # chat_file = get_abs_path(TASKS_FOLDER, task.uuid, "chat.json")- # make_dirs(chat_file)- # write_file(chat_file, chat_json)context.id = task.uuid- save_tmp_chat(context, TASKS_FOLDER)+ save_tmp_chat(context)async def _run_task(self, task: Union[ScheduledTask, AdHocTask]):- async def _run_task_wrapper(task: Union[ScheduledTask, AdHocTask]):- if task.state != "idle":- self._printer.print(f"Scheduler Task '{task.name}' state is '{task.state}', skipping")+ async def _run_task_wrapper(task_uuid: str):++ # preflight checks with a snapshot of the task+ task_snapshot: Union[ScheduledTask, AdHocTask] | None = self.get_task_by_uuid(task_uuid)+ if task_snapshot is None:+ self._printer.print(f"Scheduler Task with UUID '{task_uuid}' not found")+ return+ if not isinstance(task_snapshot, ScheduledTask):+ self._printer.error(f"Scheduler Task '{task_snapshot.name}' is not an ScheduledTask, this should not happen, skipping")+ return+ if task_snapshot.state == TaskState.RUNNING:+ self._printer.print(f"Scheduler Task '{task_snapshot.name}' already running, skipping")+ return+ if task_snapshot.state != TaskState.IDLE:+ self._printer.print(f"Scheduler Task '{task_snapshot.name}' state is '{task_snapshot.state}', skipping")return- if task.state == "running":- self._printer.print(f"Scheduler Task '{task.name}' already running, skipping")+ # Atomically fetch and check the task's current state+ current_task = await self.update_task(task_uuid, state=TaskState.RUNNING)+ if not current_task:+ self._printer.print(f"Scheduler Task with UUID '{task_uuid}' not found")+ return+ if current_task.state != TaskState.RUNNING:+ # This means the update failed due to state conflict+ self._printer.print(f"Scheduler Task '{current_task.name}' state is '{current_task.state}', skipping")returntry:- self._printer.print(f"Scheduler Task '{task.name}' started")+ self._printer.print(f"Scheduler Task '{current_task.name}' started")- task.update(state="running")- await self._tasks.save()-- context = await self._get_chat_context(task)+ context = await self._get_chat_context(current_task)agent = Agent(0, context.config, context)# Prepare attachment filenames for loggingattachment_filenames = []- if task.attachments:- for attachment in task.attachments:+ if current_task.attachments:+ for attachment in current_task.attachments:if os.path.exists(attachment):attachment_filenames.append(os.path.basename(attachment))self._printer.print("User message:")- self._printer.print(f"> {task.prompt}")+ self._printer.print(f"> {current_task.prompt}")if attachment_filenames:self._printer.print("Attachments:")for filename in attachment_filenames:@@ -354,40 +476,188 @@ class TaskScheduler:context.log.log(type="user",heading="User message",- content=task.prompt,+ content=current_task.prompt,kvps={"attachments": attachment_filenames},id=str(uuid.uuid4()),)agent.hist_add_user_message(UserMessage(- message=task.prompt,+ message=current_task.prompt,+ system_message=[current_task.system_prompt],attachments=[]))- await self._persist_chat(task, context)+ await self._persist_chat(current_task, context)result = await agent.monologue()- task.update(last_result="SUCCESS: " + result)- self._printer.print(f"Scheduler Task '{task.name}' completed: {result}")+ # Atomically update task state after completion+ await self.update_task(+ task_uuid,+ state=TaskState.IDLE,+ last_run=datetime.now(timezone.utc),+ last_result="SUCCESS: " + result+ )++ self._printer.print(f"Scheduler Task '{current_task.name}' completed: {result}")- await self._persist_chat(task, context)+ await self._persist_chat(current_task, context)except Exception as e:- self._printer.print(f"Scheduler Task '{task.name}' failed: {e}")- task.update(last_result=f"ERROR: {str(e)}")+ self._printer.print(f"Scheduler Task '{current_task.name}' failed: {e}")++ # Atomically update task state on error+ await self.update_task(+ task_uuid,+ state=TaskState.ERROR,+ last_result=f"ERROR: {str(e)}"+ )+if agent:agent.handle_critical_exception(e)- finally:- try:- task.update(- state="idle",- last_run=datetime.now(timezone.utc)- )- await self._tasks.save()- except Exception as e:- self._printer.print(f"Scheduler Task '{task.name}' failed to save: {e}")-deferred_task = DeferredTask(thread_name=self.__class__.__name__)- deferred_task.start_task(_run_task_wrapper, task)+ deferred_task.start_task(_run_task_wrapper, task.uuid)++ def serialize_all_tasks(self) -> list[Dict[str, Any]]:+ """+ Serialize all tasks in the scheduler to a list of dictionaries.+ """+ return serialize_tasks(self.get_tasks())++ def serialize_task(self, task_id: str) -> Optional[Dict[str, Any]]:+ """+ Serialize a specific task in the scheduler by UUID.+ Returns None if task is not found.+ """+ # Get task without locking, as get_task_by_uuid() is already thread-safe+ task = self.get_task_by_uuid(task_id)+ if task:+ return serialize_task(task)+ return None+++# ----------------------+# Task Serialization Helpers+# ----------------------++def serialize_datetime(dt: Optional[datetime]) -> Optional[str]:+ """Convert datetime to ISO format string or None if dt is None."""+ return dt.isoformat() if dt is not None else None+++def parse_datetime(dt_str: Optional[str]) -> Optional[datetime]:+ """Parse ISO format datetime string with validation or return None if dt_str is None."""+ if not dt_str:+ return None+ try:+ return datetime.fromisoformat(dt_str)+ except ValueError:+ raise ValueError(f"Invalid datetime format: {dt_str}. Expected ISO format.")+++def serialize_task_schedule(schedule: TaskSchedule) -> Dict[str, str]:+ """Convert TaskSchedule to a standardized dictionary format."""+ return {+ 'minute': schedule.minute,+ 'hour': schedule.hour,+ 'day': schedule.day,+ 'month': schedule.month,+ 'weekday': schedule.weekday+ }+++def parse_task_schedule(schedule_data: Dict[str, str]) -> TaskSchedule:+ """Parse dictionary into TaskSchedule with validation."""+ try:+ return TaskSchedule(+ minute=schedule_data.get('minute', '*'),+ hour=schedule_data.get('hour', '*'),+ day=schedule_data.get('day', '*'),+ month=schedule_data.get('month', '*'),+ weekday=schedule_data.get('weekday', '*')+ )+ except Exception as e:+ raise ValueError(f"Invalid schedule format: {e}")+++T = TypeVar('T', bound=Union[ScheduledTask, AdHocTask])+++def serialize_task(task: Union[ScheduledTask, AdHocTask]) -> Dict[str, Any]:+ """+ Standardized serialization for task objects with proper handling of all complex types.+ """+ # Start with a basic dictionary+ task_dict = {+ "uuid": task.uuid,+ "name": task.name,+ "state": task.state,+ "system_prompt": task.system_prompt,+ "prompt": task.prompt,+ "attachments": task.attachments,+ "created_at": serialize_datetime(task.created_at),+ "updated_at": serialize_datetime(task.updated_at),+ "last_run": serialize_datetime(task.last_run),+ "last_result": task.last_result+ }++ # Add type-specific fields+ if isinstance(task, ScheduledTask):+ task_dict['type'] = 'scheduled'+ task_dict['schedule'] = serialize_task_schedule(task.schedule)+ else:+ task_dict['type'] = 'adhoc'+ adhoc_task = cast(AdHocTask, task)+ task_dict['token'] = adhoc_task.token++ return task_dict+++def serialize_tasks(tasks: list[Union[ScheduledTask, AdHocTask]]) -> list[Dict[str, Any]]:+ """+ Serialize a list of tasks to a list of dictionaries.+ """+ return [serialize_task(task) for task in tasks]+++def deserialize_task(task_data: Dict[str, Any], task_class: Optional[Type[T]] = None) -> T:+ """+ Deserialize dictionary into appropriate task object with validation.+ If task_class is provided, uses that type. Otherwise determines type from data.+ """+ task_type_str = task_data.get('type', '')+ determined_class = None++ if not task_class:+ # Determine task class from data+ if task_type_str == 'scheduled':+ determined_class = cast(Type[T], ScheduledTask)+ elif task_type_str == 'adhoc':+ determined_class = cast(Type[T], AdHocTask)+ else:+ raise ValueError(f"Unknown task type: {task_type_str}")+ else:+ determined_class = task_class++ common_args = {+ "uuid": task_data.get("uuid"),+ "name": task_data.get("name"),+ "state": TaskState(task_data.get("state", TaskState.IDLE)),+ "system_prompt": task_data.get("system_prompt", ""),+ "prompt": task_data.get("prompt", ""),+ "attachments": task_data.get("attachments", []),+ "created_at": parse_datetime(task_data.get("created_at")),+ "updated_at": parse_datetime(task_data.get("updated_at")),+ "last_run": parse_datetime(task_data.get("last_run")),+ "last_result": task_data.get("last_result")+ }++ # Add type-specific fields+ if determined_class == ScheduledTask:+ schedule_data = task_data.get("schedule", {})+ common_args["schedule"] = parse_task_schedule(schedule_data)+ return ScheduledTask(**common_args) # type: ignore+ else:+ common_args["token"] = task_data.get("token", "")+ return AdHocTask(**common_args) # type: ignorediff --git a/run_ui.py b/run_ui.pyindex da5e46c84..0aecbeec6 100644--- a/run_ui.py+++ b/run_ui.py@@ -167,9 +167,6 @@ def run():# initialize contexts from persisted chatspersist_chat.load_tmp_chats()- # initialize contexts from persisted tasks- persist_chat.load_tmp_tasks()-except Exception as e:PrintStyle().error(errors.format_error(e))diff --git a/test_scheduler.py b/test_scheduler.pynew file mode 100644index 000000000..e0cae14ad--- /dev/null+++ b/test_scheduler.py@@ -0,0 +1,16 @@+from python.helpers.task_scheduler import ScheduledTask, TaskSchedule, SchedulerTaskList, TaskState+import asyncio++slist = SchedulerTaskList.get()++print(slist.model_dump_json(indent=4))++for task in slist.tasks:+ t = slist.get_task_by_uuid(task.uuid)+ t.update(state=TaskState.DISABLED)+ print("-" * 100)+ print(t.model_dump_json(indent=4))++print("-" * 100)++print(slist.model_dump_json(indent=4))diff --git a/webui/css/modals.css b/webui/css/modals.cssindex c90c6e110..86a193c55 100644--- a/webui/css/modals.css+++ b/webui/css/modals.css@@ -18,20 +18,33 @@.modal-container {background-color: var(--color-panel);border-radius: 12px;- width: 90%;- max-width: 800px;+ width: 1100px; /* Reduced from 1200px to 1100px */max-height: 90vh;display: flex;flex-direction: column;overflow: hidden;box-shadow: 0 4px 23px rgba(0, 0, 0, 0.2);- transition: all 0.3s ease;+ box-sizing: border-box;}.light-mode .modal-container {background-color: var(--color-panel-light);}+/* Mobile Viewport Behavior */+@media (max-width: 1280px) {+ .modal-container {+ width: 95%; /* Take up most of the screen on mobile */+ min-width: unset; /* Remove min-width constraints */+ max-width: 95%; /* Ensure consistent width */+ }++ /* Ensure section content can scroll horizontally */+ .section {+ overflow-x: auto;+ }+}+/* Modal Header */.modal-header {display: grid;@@ -77,21 +90,20 @@.modal-description {padding: 0.8rem 1rem 0 1rem;flex-grow: 1;- transition: all 0.3s ease;}/* Modal Content */.modal-content {padding: 0.5rem 1.5rem 0 1.5rem;overflow-y: auto;+ overflow-x: hidden;height: calc(90vh);flex-grow: 1;background-clip: border-box;border: 6px solid transparent;- transition: all 0.3s ease;margin-bottom: 0;- padding-bottom: 0;-+ padding-bottom: 10px;+ box-sizing: border-box;}.modal-content::-webkit-scrollbar {diff --git a/webui/css/settings.css b/webui/css/settings.cssindex e5c1c97be..f2aab3182 100644--- a/webui/css/settings.css+++ b/webui/css/settings.css@@ -74,6 +74,14 @@ textarea:focus {background-color: #151515;}+/* Button Disabled State */+.btn-disabled,+.btn-ok.btn-disabled {+ opacity: 0.5;+ cursor: not-allowed;+ pointer-events: none;+}+/* Toggle Switch Styles */.toggle {position: relative;@@ -376,3 +384,417 @@ nav ul li a img {max-width: 80px;}}++/* Scheduler Task List - updated with guaranteed width handling */+.scheduler-task-list {+ width: 100%;+ min-width: 100%;+ margin: 0;+ border-collapse: separate;+ border-spacing: 0;+ white-space: nowrap;+ padding-bottom: 8px;+ table-layout: auto;+}++.scheduler-task-list th,+.scheduler-task-list td {+ padding: 8px 12px;+ text-align: left;+ vertical-align: middle;+ border-bottom: 1px solid var(--color-border);+}++/* Ensure columns have proper min-width */+.scheduler-task-list th:nth-child(1),+.scheduler-task-list td:nth-child(1) {+ min-width: 150px;+ max-width: 200px;+ overflow: hidden;+ text-overflow: ellipsis;+}++.scheduler-task-list th:nth-child(2),+.scheduler-task-list td:nth-child(2) {+ min-width: 100px;+}++.scheduler-task-list th:nth-child(3),+.scheduler-task-list td:nth-child(3) {+ min-width: 100px;+}++.scheduler-task-list th:nth-child(4),+.scheduler-task-list td:nth-child(4) {+ min-width: 150px;+}++.scheduler-task-list th:nth-child(5),+.scheduler-task-list td:nth-child(5) {+ min-width: 180px;+}++.scheduler-task-list th:nth-child(6),+.scheduler-task-list td:nth-child(6) {+ min-width: 160px;+ white-space: nowrap;+}++/* Task actions container */+.scheduler-task-actions {+ display: flex;+ justify-content: flex-end;+ gap: 10px;+ flex-wrap: nowrap;+}++/* Scheduler form styles */+.scheduler-form {+ display: flex;+ flex-direction: column;+ gap: 1.5rem;+ padding: 1rem 0;+}++.scheduler-form-header {+ display: flex;+ justify-content: space-between;+ align-items: center;+ margin-bottom: 1.5rem;+}++.scheduler-form-title {+ font-size: 1.25rem;+ font-weight: bold;+ color: var(--color-primary);+ margin: 0;+}++.scheduler-form-actions {+ display: flex;+ gap: 0.8rem;+ justify-content: flex-end;+ align-items: center;+}++.scheduler-form-grid {+ display: grid;+ grid-template-columns: 1fr;+ gap: 1.5rem;+ overflow-x: auto;+}++.scheduler-form-field {+ display: grid;+ grid-template-columns: 1fr 2fr;+ gap: 1rem;+ align-items: flex-start;+}++@media (max-width: 768px) {+ .scheduler-form-header {+ flex-direction: column;+ align-items: flex-start;+ gap: 1rem;+ }++ .scheduler-form-actions {+ align-self: flex-end;+ }++ .scheduler-form-field {+ grid-template-columns: 1fr;+ gap: 0.5rem;+ }+}++/* Section Styles */+.section {+ margin-bottom: 2rem;+ padding: 1rem;+ padding-bottom: 0;+ border: 1px solid var(--color-border);+ border-radius: 0.5rem;+ overflow-x: visible; /* Desktop: No horizontal scroll */+ width: 100%; /* Fill available width */+ min-width: min-content;+ display: block;+ box-sizing: border-box;+}++.section-title {+ font-size: 1.25rem;+ font-weight: bold;+ color: var(--color-primary);+ margin-bottom: 0.5rem;+}++.section-description {+ color: var(--color-text);+ margin-bottom: 1rem;+}++/* Scheduler container - updated with guaranteed width handling */+.scheduler-container {+ width: 100%;+ box-sizing: border-box;+ display: block;+ padding: 0.5rem 0;+}++/* Scheduler task actions and buttons */+.scheduler-task-action {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ background-color: transparent;+ border: 1px solid var(--color-border);+ color: var(--color-text);+ padding: 4px;+ border-radius: 4px;+ cursor: pointer;+ transition: all 0.2s ease;+ width: 28px;+ height: 28px;+ flex-shrink: 0;+}++.scheduler-task-action:hover {+ background-color: var(--color-secondary);+}++/* Adjust media queries to handle small screens */+@media (max-width: 768px) {+ .scheduler-task-list {+ min-width: 700px;+ }++ .scheduler-detail-view {+ min-width: 650px;+ }+}++/* Scrollbar styling for better visibility */+.section::-webkit-scrollbar {+ height: 10px; /* Taller scrollbar for better usability */+ background-color: rgba(0,0,0,0.1);+}++.section::-webkit-scrollbar-thumb {+ background-color: rgba(155, 155, 155, 0.7);+ border-radius: 5px;+}++.section::-webkit-scrollbar-thumb:hover {+ background-color: rgba(155, 155, 155, 0.9);+}++/* Mobile styles for scheduler sections */+@media (max-width: 1280px) {+ .scheduler-container {+ min-width: max-content; /* Allow expansion based on content */+ }++ .scheduler-task-list {+ min-width: max-content; /* Expand to fit content if needed */+ }++ /* Scrollbar styling for mobile view */+ .section::-webkit-scrollbar {+ height: 10px;+ background-color: rgba(0,0,0,0.1);+ }++ .section::-webkit-scrollbar-thumb {+ background-color: rgba(155, 155, 155, 0.7);+ border-radius: 5px;+ }++ .section::-webkit-scrollbar-thumb:hover {+ background-color: rgba(155, 155, 155, 0.9);+ }+}++/* Scheduler form field styling to match standard field styling */+.scheduler-form-label {+ font-weight: bold;+ color: var(--color-primary);+ margin-bottom: 0.25rem; /* Add consistent spacing between label and help text */+}++.scheduler-form-help {+ color: var(--color-text);+ font-size: 0.875rem;+ opacity: 0.8;+ margin: 0.25rem 0 0.5rem 0; /* Match the spacing of field-description */+}++/* Label and help text wrapper for tighter grouping */+.label-help-wrapper {+ margin-bottom: 0.5rem;+}++.label-help-wrapper .scheduler-form-label {+ margin-bottom: 2px;+}++.label-help-wrapper .scheduler-form-help {+ margin-top: 0;+ margin-bottom: 0;+}++/* Scheduler detail header styling */+.scheduler-detail-header {+ display: flex;+ justify-content: flex-start;+ align-items: center;+ flex-wrap: wrap;+ gap: 10px;+ width: 100%;+}++.scheduler-detail-header .scheduler-detail-title {+ margin-right: auto;+}++/* Responsive adjustments for headers */+@media (max-width: 768px) {+ .scheduler-form-header {+ flex-direction: column;+ align-items: flex-start;+ gap: 1rem;+ }++ .scheduler-form-actions {+ align-self: flex-end;+ }++ .scheduler-detail-header {+ flex-direction: row; /* Keep in row even on mobile */+ align-items: center;+ flex-wrap: wrap;+ gap: 0.5rem;+ }++ .scheduler-detail-header .btn {+ margin-left: auto; /* Push to right edge */+ }++ .scheduler-form-field {+ grid-template-columns: 1fr;+ gap: 0.5rem;+ }+}++/* Input group for token field with generate button */+.input-group {+ display: flex;+ gap: 8px;+ width: 100%;+}++.input-group input[type="text"] {+ flex: 1;+ min-width: 0; /* Allows the input to shrink below its content size */+}++/* Specific styling for the Generate button in token field */+.input-group .scheduler-task-action {+ white-space: nowrap;+ padding: 4px 10px;+ width: auto;+ height: auto;+ background-color: var(--color-secondary);+ font-size: 0.9rem;+}++.input-group .scheduler-task-action:hover {+ background-color: var(--color-accent);+ color: var(--color-bg);+}++/* Ensure parent container allows proper flow */+.scheduler-form-field .input-group {+ max-width: 100%;+ overflow: hidden;+}++/* Adjustments for mobile */+@media (max-width: 768px) {+ .input-group .scheduler-task-action {+ padding: 4px 8px;+ font-size: 0.8rem;+ }+}++@media (max-width: 480px) {+ .input-group {+ flex-direction: column;+ }++ .input-group .scheduler-task-action {+ align-self: flex-start;+ }+}++/* Task state selector styling */+.scheduler-state-selector {+ display: flex;+ gap: 10px;+ flex-wrap: wrap;+}++.scheduler-state-selector .scheduler-status-badge {+ cursor: pointer;+ transition: all 0.2s ease;+ opacity: 0.7;+ border: 1px solid transparent;+}++.scheduler-state-selector .scheduler-status-badge:hover {+ opacity: 0.9;+ transform: scale(1.05);+}++.scheduler-status-selected {+ opacity: 1 !important;+ transform: scale(1.05);+ box-shadow: 0 0 0 2px var(--color-bg), 0 0 0 4px var(--color-border);+ border: 2px solid var(--color-border) !important;+ outline: none;+}++/* Make status badges in selector more prominent */+.scheduler-state-selector .scheduler-status-idle,+.scheduler-state-selector .scheduler-status-running,+.scheduler-state-selector .scheduler-status-disabled,+.scheduler-state-selector .scheduler-status-error {+ font-weight: 600;+ padding: 6px 12px;+}++.light-mode .scheduler-status-selected {+ box-shadow: 0 0 0 2px var(--color-bg-light), 0 0 0 4px var(--color-accent);+}++/* State explanation styling */+.scheduler-state-explanation {+ margin-top: 10px;+ font-size: 0.85rem;+ color: var(--color-text-secondary);+ line-height: 1.4;+ min-height: 1.4em; /* Ensure consistent height even when changing descriptions */+ transition: all 0.2s ease;+}++.scheduler-state-explanation span {+ display: block;+ padding: 4px 8px;+ background-color: rgba(0, 0, 0, 0.05);+ border-radius: 4px;+ margin-top: 8px;+}++.light-mode .scheduler-state-explanation span {+ background-color: rgba(255, 255, 255, 0.3);+}diff --git a/webui/index.css b/webui/index.cssindex aa36d293b..7719fc601 100644--- a/webui/index.css+++ b/webui/index.css@@ -217,15 +217,22 @@ body,gap: 0;}+/* Update the chat-list-button padding to accommodate the vertical layout */.chat-list-button {display: block;width: 100%;- padding: 1px 5px;+ padding: 8px 5px;cursor: pointer;overflow: hidden;position: relative;- transition: background-color 0.2s;border-radius: 4px;+ transition: background-color 0.2s ease-in-out;+}++/* Add some more padding to the list items to accommodate the vertical layout */+.chat-list-button.has-task-container {+ padding-top: 6px;+ padding-bottom: 6px;}/* Subtle background on hover for the entire row */@@ -2160,11 +2167,6 @@ a:active {display: none !important;}-/* Add new styles for reasoning and deepsearchbutton */-.ml-auto {- margin-left: auto;-}-/* Remove unnecessary specific media query that was causing issues */@media (max-width: 480px) {.text-button svg {@@ -2186,6 +2188,7 @@ a:active {justify-content: flex-end;}+/* Tasks list container - similar to chats list */.tasks-list-container {max-height: 300px;@@ -2217,17 +2220,58 @@ a:active {}.task-name {- display: inline-block;- max-width: 160px;+ display: block;+ width: 100%;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;+ padding: 3px 0;+ margin-left: 10px;cursor: pointer;- padding: 3px 5px;border-radius: 4px;transition: background-color 0.2s;- margin-right: 60px; /* Make space for future buttons */- font-size: var(--font-size-small); /* Match config button font size */+ font-size: var(--font-size-small);+ margin-bottom: 2px;+}++.task-info-line {+ display: flex;+ justify-content: space-between;+ align-items: center;+ width: 100%;+ margin-top: 2px;+ margin-left: 5px;+}++.task-detail-button {+ background: transparent;+ border: 1px solid rgba(255, 255, 255, 0.2);+ color: #999;+ cursor: pointer;+ padding: 5px;+ margin-left: auto;+ border-radius: 4px;+ display: flex;+ align-items: center;+ justify-content: center;+ transition: all 0.2s ease;+}++.task-detail-button:hover {+ color: #fff;+ background-color: rgba(255, 255, 255, 0.15);+ border-color: rgba(255, 255, 255, 0.3);+}++.light-mode .task-detail-button {+ color: #666;+ border: 1px solid rgba(0, 0, 0, 0.1);+}++.light-mode .task-detail-button:hover {+ color: #222;+ background-color: rgba(0, 0, 0, 0.08);+ border-color: rgba(0, 0, 0, 0.2);}.task-name:hover {@@ -2407,16 +2451,585 @@ a:active {background-color: var(--color-border);}-/* Add some padding to the list items to accommodate the stripe */-.chat-list-button {- padding-left: 5px;+/* Make sure the chat container has proper spacing */+.chat-container, .task-container {+ display: flex;+ align-items: center;+ width: 100%;+ justify-content: space-between;+}++/* Settings Modal Styles */+.settings-modal {+ position: fixed;+ top: 0;+ left: 0;+ right: 0;+ bottom: 0;+ z-index: 1000;+ background-color: rgba(0, 0, 0, 0.75);+ display: flex;+ justify-content: center;+ align-items: center;+ overflow: auto;+ padding: 24px;+}++.settings-modal-close {+ position: absolute;+ top: 8px;+ right: 16px;+ border: none;+ background: transparent;+ font-size: 24px;+ cursor: pointer;+ color: var(--color-text-secondary);+}++.settings-modal-title {+ margin-top: 0;+ margin-bottom: 24px;+ font-size: 1.8rem;+ text-align: center;+ border-bottom: 1px solid var(--color-border);+ padding-bottom: 12px;+}++.settings-modal-content {+ background-color: var(--color-panel);+ color: var(--color-text);+ width: 100%;+ max-width: 800px;+ height: auto;+ max-height: 90vh;+ border-radius: 8px;+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);+ padding: 24px;+ position: relative;+ overflow: auto;+}++/* Settings Tabs */+.settings-tabs {+ display: flex;+ border-bottom: 1px solid var(--color-border);+ margin-bottom: 24px;+ gap: 8px;+ overflow-x: auto;+ scrollbar-width: none;+ -ms-overflow-style: none;+}++.settings-tabs::-webkit-scrollbar {+ display: none;+}++.settings-tab {+ padding: 8px 16px;+ cursor: pointer;+ border-bottom: 3px solid transparent;+ color: var(--color-text-secondary);+ transition: all 0.2s ease;+ white-space: nowrap;+}++.settings-tab:hover {+ color: var(--color-text);+}++.settings-tab.active {+ border-bottom-color: var(--color-primary);+ color: var(--color-primary);+ font-weight: 500;+}++/* Settings Sections */+nav ul {+ display: grid;+ grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));+ gap: 1rem;+ padding: 0;+ margin: 0 0 1rem 0;+ list-style: none;+}++/* Add specific styling for the nav element itself to ensure spacing */+nav {+margin-bottom: 1rem;+}++nav ul li a {+ display: flex;+ flex-direction: column;+ align-items: center;+ padding: 1rem;+ border-radius: 0.5rem;+ background-color: var(--color-bg-secondary);+ text-decoration: none;+ color: var(--color-text);+ transition: background-color 0.2s ease;+}++nav ul li a:hover {+ background-color: var(--color-bg-tertiary);+}++nav ul li a img {+ width: 50px;+ height: 50px;+ margin-bottom: 0.5rem;+ filter: var(--svg-filter);+}++.section {+ margin-bottom: 3rem;+ animation: fadeIn 0.3s ease;+ width: 100%;+}++.section-title {+ margin-top: 0;+ margin-bottom: 0.5rem;+ font-size: 1.5rem;+ font-weight: 500;+ color: var(--color-primary);+ border-bottom: 1px solid var(--color-border);+ padding-bottom: 0.5rem;+}++.section-description {+ margin-bottom: 1.5rem;+ color: var(--color-text-secondary);+}++.scheduler-header {+ display: flex;+ justify-content: space-between;+ align-items: center;+ margin-bottom: 20px;+}++.scheduler-header h2 {+ margin: 0;+ font-size: 1.2rem;+ font-weight: 500;+}++.scheduler-filters {+ display: flex;+ gap: 20px;+ margin-bottom: 20px;+ flex-wrap: wrap;+}++.scheduler-filter-group {+ display: flex;+ align-items: center;+ gap: 8px;+}++.scheduler-filter-label {+ font-weight: 500;+ color: var(--color-text-secondary);+}++.scheduler-filter-select {+ padding: 6px 8px;border-radius: 4px;- transition: background-color 0.2s ease-in-out;+ border: 1px solid var(--color-border);+ background-color: var(--color-bg-secondary);+ color: var(--color-text);}-/* Make sure the chat container has proper spacing */-.chat-container, .task-container {+.scheduler-task-list {+ width: 100%;+ border-collapse: collapse;+ margin: 1rem 0;+ font-size: 0.9rem;+ overflow-x: auto;+ table-layout: fixed;+}++.scheduler-task-list th,+.scheduler-task-list td {+ padding: 0.75rem;+ text-align: left;+ border-bottom: 1px solid var(--color-border);+ vertical-align: middle;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+}++.scheduler-task-list th:nth-child(1), /* Name */+.scheduler-task-list td:nth-child(1) {+ width: 25%;+}++.scheduler-task-list th:nth-child(2), /* State */+.scheduler-task-list td:nth-child(2) {+ width: 10%;+}++.scheduler-task-list th:nth-child(3), /* Type */+.scheduler-task-list td:nth-child(3) {+ width: 10%;+}++.scheduler-task-list th:nth-child(4), /* Schedule */+.scheduler-task-list td:nth-child(4) {+ width: 20%;+}++.scheduler-task-list th:nth-child(5), /* Last Run */+.scheduler-task-list td:nth-child(5) {+ width: 20%;+}++.scheduler-task-list th:nth-child(6), /* Actions */+.scheduler-task-list td:nth-child(6) {+ width: 15%;+ text-align: right;+}++.scheduler-task-list th {+ background-color: var(--color-bg-secondary);+ font-weight: 500;+ cursor: pointer;+ user-select: none;+}++.scheduler-task-list th:hover {+ background-color: var(--color-bg-tertiary);+}++.scheduler-task-actions {+ display: flex;+ gap: 8px;+}++.scheduler-task-action {+ padding: 4px;+ background: none;+ border: none;+ color: var(--color-text-secondary);+ cursor: pointer;+ border-radius: 4px;+}++.scheduler-task-action:hover {+ background-color: var(--color-bg-tertiary);+ color: var(--color-text);+}++.scheduler-status-badge {+ display: inline-block;+ padding: 4px 8px;+ border-radius: 4px;+ font-size: 12px;+ font-weight: 500;+ text-transform: capitalize;+ white-space: nowrap;+}++.scheduler-status-idle {+ background-color: rgba(0, 100, 0, 0.2);+ color: #2a9d8f; /* Dark green that works with both light and dark themes */+ border: 1px solid rgba(42, 157, 143, 0.3);+}++.scheduler-status-running {+ background-color: rgba(0, 60, 120, 0.2);+ color: #4361ee; /* Dark blue that works with both light and dark themes */+ border: 1px solid rgba(67, 97, 238, 0.3);+}++.scheduler-status-disabled {+ background-color: rgba(70, 70, 70, 0.2);+ color: #6c757d; /* Dark grey that works with both light and dark themes */+ border: 1px solid rgba(108, 117, 125, 0.3);+}++.scheduler-status-error {+ background-color: rgba(120, 0, 0, 0.2);+ color: #e63946; /* Dark red that works with both light and dark themes */+ border: 1px solid rgba(230, 57, 70, 0.3);+}++/* Light mode adjustments */+.light-mode .scheduler-status-idle {+ background-color: rgba(42, 157, 143, 0.1);+ color: #1a6f65; /* Darker green for light mode */+}++.light-mode .scheduler-status-running {+ background-color: rgba(67, 97, 238, 0.1);+ color: #2540b3; /* Darker blue for light mode */+}++.light-mode .scheduler-status-disabled {+ background-color: rgba(108, 117, 125, 0.1);+ color: #495057; /* Darker grey for light mode */+}++.light-mode .scheduler-status-error {+ background-color: rgba(230, 57, 70, 0.1);+ color: #c5283d; /* Darker red for light mode */+}++.scheduler-empty {+ text-align: center;+ padding: 40px 0;+ color: var(--color-text-secondary);+}++.scheduler-empty-icon {+ font-size: 32px;+ margin-bottom: 10px;+}++.scheduler-empty-text {+ margin-bottom: 20px;+}++.scheduler-loading {+ text-align: center;+ padding: 40px 0;+ color: var(--color-text-secondary);+}++.scheduler-task-details {+ padding: 16px;+ background-color: var(--color-bg-secondary);+ border-radius: 4px;+}++.scheduler-details-grid {+ display: grid;+ grid-template-columns: 120px 1fr;+ gap: 8px 16px;+ margin-bottom: 16px;+}++.scheduler-details-label {+ font-weight: 500;+ color: var(--color-text-secondary);+ display: flex;+ align-items: center;+}++.scheduler-details-value {+ color: var(--color-text);+ word-break: break-word;+}++.scheduler-details-actions {+ display: flex;+ justify-content: flex-end;+}++.scheduler-form {+ background-color: var(--color-bg-secondary);+ border-radius: 4px;+ padding: 20px;+ margin-bottom: 20px;+}++.scheduler-form-title {+ font-size: 1.2rem;+ font-weight: 500;+ margin-bottom: 20px;+ padding-bottom: 10px;+ border-bottom: 1px solid var(--color-border);+}++.scheduler-form-grid {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: 16px;+ margin-bottom: 20px;+}++.scheduler-form-field {+ display: flex;+ flex-direction: column;+ gap: 6px;+}++.full-width {+ grid-column: 1 / -1;+}++.scheduler-form-label {+ font-weight: 500;+}++.scheduler-form-help {+ font-size: 12px;+ color: var(--color-text-secondary);+}++.scheduler-form-actions {+ display: flex;+ justify-content: flex-end;+ gap: 12px;+}++.scheduler-schedule-builder {+ display: grid;+ grid-template-columns: repeat(5, 1fr);+ gap: 12px;+}++.scheduler-schedule-field {+ display: flex;+ flex-direction: column;+ gap: 4px;+ max-width: 70px; /* Limit width of schedule fields */+}++.scheduler-schedule-field input {+ width: 100%;+ min-width: 0; /* Allow shrinking below content size */+ font-size: 0.9rem; /* Slightly reduce font size for better fit */+}++.scheduler-schedule-label {+ font-size: 12px;+ color: var(--color-text-secondary);+}++.input-group {+ display: flex;+ gap: 8px;+}++/* Sort indicators */+.scheduler-sort-indicator {+ display: inline-block;+ margin-left: 4px;+ transition: transform 0.2s ease;+}++.scheduler-sort-desc {+ transform: rotate(180deg);+}++/* Responsive adjustments */+@media (max-width: 768px) {+ .scheduler-form-grid {+ grid-template-columns: 1fr;+ }++ .scheduler-schedule-builder {+ grid-template-columns: 1fr 1fr;+ }++ .scheduler-filters {+ flex-direction: column;+ gap: 12px;+ }++ .scheduler-task-actions {+ flex-wrap: wrap;+ }+}++@media (max-width: 480px) {+ nav ul li a {+ flex-direction: row;+ justify-content: flex-start;+ gap: 1rem;+ padding: 0.75rem 1rem;+ }++ nav ul li a img {+ margin-bottom: 0;+ width: 30px;+ height: 30px;+ }+}++/* Add row hover effect for task list rows matching left panel hover */+.scheduler-task-list tbody tr {+ cursor: pointer;+ transition: background-color 0.2s ease;+}++.scheduler-task-list tbody tr:hover {+ background-color: rgba(255, 255, 255, 0.03);+}++.light-mode .scheduler-task-list tbody tr:hover {+ background-color: rgba(0, 0, 0, 0.02);+}++.scheduler-task-list th {+ background-color: var(--color-bg-secondary);+ font-weight: 500;+ cursor: pointer;+ user-select: none;+}++.scheduler-task-list th:hover {+ background-color: var(--color-bg-tertiary);+}++/* Task detail view styling */+.scheduler-detail-view {+ background-color: var(--color-bg-secondary);+ border-radius: 4px;+ padding: 20px;+ margin-bottom: 20px;+ animation: fadeIn 0.3s ease;+}++.scheduler-detail-header {display: flex;+ justify-content: flex-start;align-items: center;+ margin-bottom: 20px;+ padding-bottom: 10px;+ border-bottom: 1px solid var(--color-border);+ flex-wrap: wrap;+ gap: 10px;+}++.scheduler-detail-header .scheduler-detail-title {+ font-size: 1.4rem;+ font-weight: 500;+ margin: 0;+ margin-right: auto;+}++.scheduler-detail-header .scheduler-status-badge {+ margin-right: 10px;+}++.scheduler-detail-content {+ margin-bottom: 20px;+}++/* Task Scheduler Styles */++.scheduler-no-schedule {+ color: var(--color-text-secondary);+ opacity: 0.7;+ font-style: italic;+}++.task-container-vertical {+ display: flex;+ flex-direction: column;width: 100%;+ gap: 6px;+}++/* Smaller status badge for task list */+.scheduler-status-badge-small {+ font-size: 10px;+ padding: 2px 6px;+ margin-right: 5px;+ min-width: 40px;+ text-align: center;}diff --git a/webui/index.html b/webui/index.htmlindex 99acf9526..24a1a8b4d 100644--- a/webui/index.html+++ b/webui/index.html@@ -38,6 +38,7 @@<script type="text/javascript" src="js/settings.js"></script><script type="text/javascript" src="js/file_browser.js"></script><script type="text/javascript" src="js/modal.js"></script>+ <script type="text/javascript" src="js/scheduler.js"></script><script type="module" src="js/speech.js"></script><script type="module" src="js/history.js"></script>@@ -118,18 +119,42 @@</div><!-- Tasks List -->- <div class="config-section" id="tasks-section" x-data="{ tasks: [], selected: '' }"+ <div class="config-section" id="tasks-section" x-data="{+ tasks: [],+ selected: '',+ openTaskDetail(taskId) {+ window.openTaskDetail(taskId);+ }+ }"style="display: none;"><div class="tasks-list-container"><ul class="config-list" x-show="tasks.length > 0"><template x-for="task in tasks"><li>- <div :class="{'chat-list-button': true, 'font-bold': task.id === selected}"+ <div :class="{'chat-list-button': true, 'font-bold': task.id === selected, 'has-task-container': true}"@click="selected = task.id; selectChat(task.id)">- <div class="chat-container">+ <!-- Task container with a vertical layout -->+ <div class="task-container task-container-vertical">+ <!-- Task name on its own line with full width --><span class="task-name"x-text="task.name || `Task #${task.id.substring(0,8)}`":data-task-id="task.id"></span>+ <!-- Second line with status badge and action button -->+ <div class="task-info-line">+ <!-- Status badge (reusing scheduler styling) -->+ <span class="scheduler-status-badge scheduler-status-badge-small"+ :class="task.state ? `scheduler-status-${task.state}` : 'scheduler-status-idle'"+ x-text="task.state || 'idle'"></span>+ <!-- Action button -->+ <button class="task-detail-button"+ @click.stop="openTaskDetail(task.id)"+ title="View task details">+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"></path>+ <path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"></path>+ </svg>+ </button>+ </div></div></div></li>@@ -473,10 +498,15 @@:class="{'active': activeTab === 'developer'}"@click="switchTab('developer')"title="Developer">Developer</div>+ <div class="settings-tab"+ :class="{'active': activeTab === 'scheduler'}"+ @click="switchTab('scheduler')"+ title="Task Scheduler">Task Scheduler</div></div></div>- <div id="settings-sections">+ <!-- Display settings sections for agent, external, developer tabs -->+ <div id="settings-sections" x-show="activeTab !== 'scheduler'"><nav><ul><template x-for="(section, index) in filteredSections" :key="section.title">@@ -490,94 +520,568 @@</template></ul></nav>++ <template x-for="(section, sectionIndex) in filteredSections" :key="sectionIndex">+ <div :id="'section' + (sectionIndex + 1)" class="section">+ <div class="section-title" x-text="section.title"></div>+ <div class="section-description" x-html="section.description"></div>++ <template x-for="(field, fieldIndex) in section.fields" :key="fieldIndex">+ <div :class="{'field': true, 'field-full': field.type === 'textarea'}">+ <div class="field-label">+ <div class="field-title" x-text="field.title"></div>+ <div class="field-description" x-html="field.description || ''"></div>+ </div>++ <div class="field-control">+ <!-- Input field -->+ <template x-if="field.type === 'text'">+ <input type="text" :class="field.classes" :value="field.value"+ :readonly="field.readonly === true"+ @input="field.value = $event.target.value">+ </template>++ <!-- Number field -->+ <template x-if="field.type === 'number'">+ <input type="number" :class="field.classes" :value="field.value"+ :readonly="field.readonly === true"+ @input="field.value = $event.target.value"+ :min="field.min" :max="field.max" :step="field.step">+ </template>+++ <!-- Password field -->+ <template x-if="field.type === 'password'">+ <input type="password" :class="field.classes" :value="field.value"+ :readonly="field.readonly === true"+ @input="field.value = $event.target.value">+ </template>++ <!-- Textarea field -->+ <template x-if="field.type === 'textarea'">+ <textarea :class="field.classes" :value="field.value"+ :readonly="field.readonly === true"+ @input="field.value = $event.target.value"></textarea>+ </template>++ <!-- Switch field -->+ <template x-if="field.type === 'switch'">+ <label class="toggle">+ <input type="checkbox" :checked="field.value"+ :disabled="field.readonly === true"+ @change="field.value = $event.target.checked">+ <span class="toggler"></span>+ </label>+ </template>++ <!-- Range field -->+ <template x-if="field.type === 'range'">+ <div class="field-control">+ <input type="range" :min="field.min" :max="field.max"+ :step="field.step" :value="field.value"+ :disabled="field.readonly === true"+ @input="field.value = $event.target.value"+ :class="field.classes">+ <span class="range-value" x-text="field.value"></span>+ </div>+ </template>++ <!-- Button field -->+ <template x-if="field.type === 'button'">+ <button class="btn btn-field" :class="field.classes"+ :disabled="field.readonly === true"+ @click="handleFieldButton(field)" x-text="field.value"></button>+ </template>++ <!-- Select field -->+ <template x-if="field.type === 'select'">+ <select :class="field.classes" x-model="field.value"+ :disabled="field.readonly === true">+ <template x-for="option in field.options" :key="option.value">+ <option :value="option.value" x-text="option.label"+ :selected="option.value === field.value"></option>+ </template>+ </select>+ </template>+ </div>+ </div>+ </template>+ </div>+ </template></div>- <template x-for="(section, sectionIndex) in filteredSections" :key="sectionIndex">- <div :id="'section' + (sectionIndex + 1)" class="section">- <div class="section-title" x-text="section.title"></div>- <div class="section-description" x-html="section.description"></div>-- <template x-for="(field, fieldIndex) in section.fields" :key="fieldIndex">- <div :class="{'field': true, 'field-full': field.type === 'textarea'}">- <div class="field-label">- <div class="field-title" x-text="field.title"></div>- <div class="field-description" x-html="field.description || ''"></div>++ <!-- Task Scheduler Tab Content -->+ <div id="scheduler-tab-content" x-show="activeTab === 'scheduler'" x-cloak>+ <!-- Settings section structure for task scheduler -->+ <nav>+ <ul>+ <li>+ <a href="#section-task-scheduler">+ <img src="/public/task_scheduler.svg" alt="Task Scheduler">+ <span>Task Scheduler</span>+ </a>+ </li>+ </ul>+ </nav>++ <div id="section-task-scheduler" class="section"+ x-data="schedulerSettings"+ x-init="$watch('activeTab', (val) => { if(val === 'scheduler') { fetchTasks(); } })">+ <div class="section-title">Task Scheduler</div>+ <div class="section-description">Manage scheduled tasks and automated processes for Agent Zero.</div>++ <!-- Create Task Form -->+ <div class="scheduler-form" x-show="isCreating">+ <div class="scheduler-form-header">+ <div class="scheduler-form-title">Create New Task</div>+ <div class="scheduler-form-actions">+ <button class="btn btn-ok btn-field" @click="saveTask()">+ Save+ </button>+ <button class="btn btn-cancel" @click="cancelEdit()">+ Cancel+ </button></div>+ </div>- <div class="field-control">- <!-- Input field -->- <template x-if="field.type === 'text'">- <input type="text" :class="field.classes" :value="field.value"- :readonly="field.readonly === true"- @input="field.value = $event.target.value">- </template>+ <div class="scheduler-form-grid">+ <!-- Task Name -->+ <div class="scheduler-form-field">+ <div class="label-help-wrapper">+ <label class="scheduler-form-label">Task Name</label>+ <div class="scheduler-form-help">A unique name to identify this task</div>+ </div>+ <input type="text" x-model="editingTask.name" placeholder="Enter task name">+ </div>- <!-- Number field -->- <template x-if="field.type === 'number'">- <input type="number" :class="field.classes" :value="field.value"- :readonly="field.readonly === true"- @input="field.value = $event.target.value"- :min="field.min" :max="field.max" :step="field.step">- </template>+ <!-- Task Type (only editable when creating) -->+ <div class="scheduler-form-field">+ <div class="label-help-wrapper">+ <label class="scheduler-form-label">Task Type</label>+ <div class="scheduler-form-help">Task type cannot be changed after creation</div>+ </div>+ <select x-model="editingTask.type" :disabled="!isCreating">+ <option value="scheduled">Scheduled Task</option>+ <option value="adhoc">Ad-hoc Task</option>+ </select>+ </div>++ <!-- Task State in Create Form - Add after Task Type -->+ <div class="scheduler-form-field" x-show="isCreating">+ <div class="label-help-wrapper">+ <label class="scheduler-form-label">State</label>+ <div class="scheduler-form-help">Select the initial state of the task</div>+ </div>+ <div>+ <div class="scheduler-state-selector">+ <span class="scheduler-status-badge scheduler-status-idle"+ :class="{'scheduler-status-selected': editingTask.state === 'idle'}"+ @click="editingTask.state = 'idle'">idle</span>+ <span class="scheduler-status-badge scheduler-status-running"+ :class="{'scheduler-status-selected': editingTask.state === 'running'}"+ @click="editingTask.state = 'running'">running</span>+ <span class="scheduler-status-badge scheduler-status-disabled"+ :class="{'scheduler-status-selected': editingTask.state === 'disabled'}"+ @click="editingTask.state = 'disabled'">disabled</span>+ <span class="scheduler-status-badge scheduler-status-error"+ :class="{'scheduler-status-selected': editingTask.state === 'error'}"+ @click="editingTask.state = 'error'">error</span>+ </div>+ <div class="scheduler-state-explanation">+ <span x-show="editingTask.state === 'idle'"><strong>idle</strong>: ready to run</span>+ <span x-show="editingTask.state === 'running'"><strong>running</strong>: currently executing</span>+ <span x-show="editingTask.state === 'disabled'"><strong>disabled</strong>: won't execute automatically</span>+ <span x-show="editingTask.state === 'error'"><strong>error</strong>: task encountered an error</span>+ </div>+ </div>+ </div>+ <!-- Schedule (for scheduled tasks) -->+ <div class="scheduler-form-field full-width" x-show="editingTask && editingTask.type === 'scheduled'">+ <div class="label-help-wrapper">+ <label class="scheduler-form-label">Schedule (Cron Expression)</label>+ <div class="scheduler-form-help">Format: minute hour day month weekday (e.g., "* * * * *" for every minute)</div>+ </div>+ <div class="scheduler-schedule-builder">+ <div class="scheduler-schedule-field">+ <span class="scheduler-schedule-label">Minute</span>+ <input type="text" x-model="editingTask.schedule.minute" placeholder="*" maxlength="9">+ </div>+ <div class="scheduler-schedule-field">+ <span class="scheduler-schedule-label">Hour</span>+ <input type="text" x-model="editingTask.schedule.hour" placeholder="*" maxlength="9">+ </div>+ <div class="scheduler-schedule-field">+ <span class="scheduler-schedule-label">Day</span>+ <input type="text" x-model="editingTask.schedule.day" placeholder="*" maxlength="9">+ </div>+ <div class="scheduler-schedule-field">+ <span class="scheduler-schedule-label">Month</span>+ <input type="text" x-model="editingTask.schedule.month" placeholder="*" maxlength="9">+ </div>+ <div class="scheduler-schedule-field">+ <span class="scheduler-schedule-label">Weekday</span>+ <input type="text" x-model="editingTask.schedule.weekday" placeholder="*" maxlength="9">+ </div>+ </div>+ </div>- <!-- Password field -->- <template x-if="field.type === 'password'">- <input type="password" :class="field.classes" :value="field.value"- :readonly="field.readonly === true"- @input="field.value = $event.target.value">- </template>+ <!-- Token (for ad-hoc tasks) -->+ <div class="scheduler-form-field full-width" x-show="editingTask.type === 'adhoc'">+ <div class="label-help-wrapper">+ <label class="scheduler-form-label">Token</label>+ <div class="scheduler-form-help">Token used to trigger this task externally</div>+ </div>+ <div class="input-group">+ <input type="text" x-model="editingTask.token" placeholder="Token for ad-hoc task">+ <button class="scheduler-task-action" @click="editingTask.token = generateRandomToken()">+ Generate+ </button>+ </div>+ </div>- <!-- Textarea field -->- <template x-if="field.type === 'textarea'">- <textarea :class="field.classes" :value="field.value"- :readonly="field.readonly === true"- @input="field.value = $event.target.value"></textarea>- </template>+ <!-- System Prompt -->+ <div class="scheduler-form-field full-width">+ <div class="label-help-wrapper">+ <label class="scheduler-form-label">System Prompt</label>+ <div class="scheduler-form-help">System-level instructions for the assistant</div>+ </div>+ <textarea x-model="editingTask.system_prompt" placeholder="System instructions for the AI"></textarea>+ </div>- <!-- Switch field -->- <template x-if="field.type === 'switch'">- <label class="toggle">- <input type="checkbox" :checked="field.value"- :disabled="field.readonly === true"- @change="field.value = $event.target.checked">- <span class="toggler"></span>- </label>- </template>+ <!-- User Prompt -->+ <div class="scheduler-form-field full-width">+ <div class="label-help-wrapper">+ <label class="scheduler-form-label">User Prompt</label>+ <div class="scheduler-form-help">The main task prompt that will be executed</div>+ </div>+ <textarea x-model="editingTask.prompt" placeholder="User message for the AI"></textarea>+ </div>- <!-- Range field -->- <template x-if="field.type === 'range'">- <div class="field-control">- <input type="range" :min="field.min" :max="field.max"- :step="field.step" :value="field.value"- :disabled="field.readonly === true"- @input="field.value = $event.target.value"- :class="field.classes">- <span class="range-value" x-text="field.value"></span>+ <!-- Attachments Field -->+ <div class="scheduler-form-field full-width">+ <div class="label-help-wrapper">+ <label class="scheduler-form-label">Attachments</label>+ <div class="scheduler-form-help">Container file paths or URLs, one per line</div>+ </div>+ <textarea x-model="attachmentsText" placeholder="Enter file paths or URLs, one per line"></textarea>+ </div>+ </div>+ </div>++ <!-- Edit Task Form -->+ <div class="scheduler-form" x-show="isEditing">+ <div class="scheduler-form-header">+ <div class="scheduler-form-title">Edit Task</div>+ <div class="scheduler-form-actions">+ <button class="btn btn-ok btn-field" @click="saveTask()">+ Save+ </button>+ <button class="btn btn-cancel" @click="cancelEdit()">+ Cancel+ </button>+ </div>+ </div>++ <div class="scheduler-form-grid">+ <!-- Task Name -->+ <div class="scheduler-form-field">+ <div class="label-help-wrapper">+ <label class="scheduler-form-label">Task Name</label>+ <div class="scheduler-form-help">A unique name to identify this task</div>+ </div>+ <input type="text" x-model="editingTask.name" placeholder="Enter task name">+ </div>++ <!-- Task Type (disabled when editing) -->+ <div class="scheduler-form-field">+ <div class="label-help-wrapper">+ <label class="scheduler-form-label">Task Type</label>+ <div class="scheduler-form-help">Task type cannot be changed after creation</div>+ </div>+ <select x-model="editingTask.type" disabled>+ <option value="scheduled">Scheduled Task</option>+ <option value="adhoc">Ad-hoc Task</option>+ </select>+ </div>++ <!-- Task State in Edit Form - Add after Task Type -->+ <div class="scheduler-form-field" x-show="isEditing">+ <div class="label-help-wrapper">+ <label class="scheduler-form-label">State</label>+ <div class="scheduler-form-help">Change the task's state</div>+ </div>+ <div>+ <div class="scheduler-state-selector">+ <span class="scheduler-status-badge scheduler-status-idle"+ :class="{'scheduler-status-selected': editingTask.state === 'idle'}"+ @click="editingTask.state = 'idle'">idle</span>+ <span class="scheduler-status-badge scheduler-status-running"+ :class="{'scheduler-status-selected': editingTask.state === 'running'}"+ @click="editingTask.state = 'running'">running</span>+ <span class="scheduler-status-badge scheduler-status-disabled"+ :class="{'scheduler-status-selected': editingTask.state === 'disabled'}"+ @click="editingTask.state = 'disabled'">disabled</span>+ <span class="scheduler-status-badge scheduler-status-error"+ :class="{'scheduler-status-selected': editingTask.state === 'error'}"+ @click="editingTask.state = 'error'">error</span></div>- </template>+ <div class="scheduler-state-explanation">+ <span x-show="editingTask.state === 'idle'"><strong>idle</strong>: ready to run</span>+ <span x-show="editingTask.state === 'running'"><strong>running</strong>: currently executing</span>+ <span x-show="editingTask.state === 'disabled'"><strong>disabled</strong>: won't execute automatically</span>+ <span x-show="editingTask.state === 'error'"><strong>error</strong>: task encountered an error</span>+ </div>+ </div>+ </div>- <!-- Button field -->- <template x-if="field.type === 'button'">- <button class="btn btn-field" :class="field.classes"- :disabled="field.readonly === true"- @click="handleFieldButton(field)" x-text="field.value"></button>- </template>+ <!-- Schedule (for scheduled tasks) -->+ <div class="scheduler-form-field full-width" x-show="editingTask && editingTask.type === 'scheduled'">+ <div class="label-help-wrapper">+ <label class="scheduler-form-label">Schedule (Cron Expression)</label>+ <div class="scheduler-form-help">Format: minute hour day month weekday (e.g., "* * * * *" for every minute)</div>+ </div>+ <div class="scheduler-schedule-builder">+ <div class="scheduler-schedule-field">+ <span class="scheduler-schedule-label">Minute</span>+ <input type="text" x-model="editingTask.schedule.minute" placeholder="*" maxlength="9">+ </div>+ <div class="scheduler-schedule-field">+ <span class="scheduler-schedule-label">Hour</span>+ <input type="text" x-model="editingTask.schedule.hour" placeholder="*" maxlength="9">+ </div>+ <div class="scheduler-schedule-field">+ <span class="scheduler-schedule-label">Day</span>+ <input type="text" x-model="editingTask.schedule.day" placeholder="*" maxlength="9">+ </div>+ <div class="scheduler-schedule-field">+ <span class="scheduler-schedule-label">Month</span>+ <input type="text" x-model="editingTask.schedule.month" placeholder="*" maxlength="9">+ </div>+ <div class="scheduler-schedule-field">+ <span class="scheduler-schedule-label">Weekday</span>+ <input type="text" x-model="editingTask.schedule.weekday" placeholder="*" maxlength="9">+ </div>+ </div>+ </div>++ <!-- Token (for ad-hoc tasks) -->+ <div class="scheduler-form-field full-width" x-show="editingTask.type === 'adhoc'">+ <div class="label-help-wrapper">+ <label class="scheduler-form-label">Token</label>+ <div class="scheduler-form-help">Token used to trigger this task externally</div>+ </div>+ <div class="input-group">+ <input type="text" x-model="editingTask.token" placeholder="Token for ad-hoc task">+ <button class="scheduler-task-action" @click="editingTask.token = generateRandomToken()">+ Generate+ </button>+ </div>+ </div>++ <!-- System Prompt -->+ <div class="scheduler-form-field full-width">+ <div class="label-help-wrapper">+ <label class="scheduler-form-label">System Prompt</label>+ <div class="scheduler-form-help">System-level instructions for the assistant</div>+ </div>+ <textarea x-model="editingTask.system_prompt" placeholder="System instructions for the AI"></textarea>+ </div>++ <!-- User Prompt -->+ <div class="scheduler-form-field full-width">+ <div class="label-help-wrapper">+ <label class="scheduler-form-label">User Prompt</label>+ <div class="scheduler-form-help">The main task prompt that will be executed</div>+ </div>+ <textarea x-model="editingTask.prompt" placeholder="User message for the AI"></textarea>+ </div>- <!-- Select field -->- <template x-if="field.type === 'select'">- <select :class="field.classes" x-model="field.value"- :disabled="field.readonly === true">- <template x-for="option in field.options" :key="option.value">- <option :value="option.value" x-text="option.label"- :selected="option.value === field.value"></option>- </template>- </select>+ <!-- Attachments Field -->+ <div class="scheduler-form-field full-width">+ <div class="label-help-wrapper">+ <label class="scheduler-form-label">Attachments</label>+ <div class="scheduler-form-help">Container file paths or URLs, one per line</div>+ </div>+ <textarea x-model="attachmentsText" placeholder="Enter file paths or URLs, one per line"></textarea>+ </div>+ </div>+ </div>++ <!-- Task List View -->+ <div class="scheduler-container" x-show="!isCreating && !isEditing && viewMode === 'list'">+ <!-- Header with Actions -->+ <div class="scheduler-header">+ <h2>Task Management</h2>+ <div class="scheduler-actions">+ <button class="btn btn-ok" @click="startCreateTask()">+ New Task+ </button>+ </div>+ </div>++ <!-- Filters -->+ <div class="scheduler-filters">+ <div class="scheduler-filter-group">+ <span class="scheduler-filter-label">Type:</span>+ <select class="scheduler-filter-select" x-model="filterType">+ <option value="all">All Types</option>+ <option value="scheduled">Scheduled</option>+ <option value="adhoc">Ad-hoc</option>+ </select>+ </div>++ <div class="scheduler-filter-group">+ <span class="scheduler-filter-label">State:</span>+ <select class="scheduler-filter-select" x-model="filterState">+ <option value="all">All States</option>+ <option value="idle">Idle</option>+ <option value="running">Running</option>+ <option value="disabled">Disabled</option>+ <option value="error">Error</option>+ </select>+ </div>+ </div>++ <!-- Loading State -->+ <div class="scheduler-loading" x-show="isLoading">+ Loading tasks...+ </div>++ <!-- Empty State -->+ <div class="scheduler-empty" x-show="!isLoading && filteredTasks.length === 0">+ <div class="scheduler-empty-icon">📋</div>+ <div class="scheduler-empty-text">No tasks found</div>+ <button class="btn btn-ok" @click="startCreateTask()">Create your first task</button>+ </div>++ <!-- Task List Table -->+ <table class="scheduler-task-list" x-show="!isLoading && filteredTasks.length > 0">+ <thead>+ <tr>+ <th @click="changeSort('name')">+ Name+ <span class="scheduler-sort-indicator" x-show="sortField === 'name'"+ :class="{'scheduler-sort-desc': sortDirection === 'desc'}">↑</span>+ </th>+ <th @click="changeSort('state')">+ State+ <span class="scheduler-sort-indicator" x-show="sortField === 'state'"+ :class="{'scheduler-sort-desc': sortDirection === 'desc'}">↑</span>+ </th>+ <th>Type</th>+ <th>Schedule</th>+ <th @click="changeSort('last_run')">+ Last Run+ <span class="scheduler-sort-indicator" x-show="sortField === 'last_run'"+ :class="{'scheduler-sort-desc': sortDirection === 'desc'}">↑</span>+ </th>+ <th>Actions</th>+ </tr>+ </thead>+ <tbody>+ <template x-for="task in filteredTasks" :key="task.uuid">+ <tr @click="showTaskDetail(task.uuid)">+ <td>+ <span x-text="task.name"></span>+ </td>+ <td>+ <span class="scheduler-status-badge" :class="getStateBadgeClass(task.state)" x-text="task.state"></span>+ </td>+ <td x-text="task.type"></td>+ <td>+ <span x-show="task.type === 'scheduled'" x-text="formatSchedule(task)"></span>+ <span x-show="task.type === 'adhoc'" class="scheduler-no-schedule">—</span>+ </td>+ <td x-text="formatDate(task.last_run)"></td>+ <td @click.stop>+ <div class="scheduler-task-actions">+ <button class="scheduler-task-action" @click="runTask(task.uuid)" title="Run Task">+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" width="16" height="16">+ <path d="M8 5v14l11-7z"/>+ </svg>+ </button>+ <button class="scheduler-task-action" @click="resetTaskState(task.uuid)" title="Reset State">+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" width="16" height="16">+ <path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/>+ </svg>+ </button>+ <button class="scheduler-task-action" @click="startEditTask(task.uuid)" title="Edit Task">+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" width="16" height="16">+ <path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/>+ </svg>+ </button>+ <button class="scheduler-task-action" @click="deleteTask(task.uuid)" title="Delete Task">+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" width="16" height="16">+ <path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/>+ </svg>+ </button>+ </div>+ </td>+ </tr></template>+ </tbody>+ </table>+ </div>++ <!-- Task Detail View -->+ <div class="scheduler-detail-view" x-show="!isCreating && !isEditing && viewMode === 'detail' && selectedTaskForDetail">+ <div class="scheduler-detail-header">+ <h2 class="scheduler-detail-title" x-text="selectedTaskForDetail ? selectedTaskForDetail.name : ''"></h2>+ <div class="scheduler-status-badge"+ :class="selectedTaskForDetail ? getStateBadgeClass(selectedTaskForDetail.state) : ''"+ x-text="selectedTaskForDetail ? selectedTaskForDetail.state : ''"></div>+ <button class="btn btn-cancel" @click="closeTaskDetail()">Close</button></div>- </template>++ <div class="scheduler-detail-content">+ <div class="scheduler-details-grid">+ <div class="scheduler-details-label">Type:</div>+ <div class="scheduler-details-value" x-text="selectedTaskForDetail ? selectedTaskForDetail.type : ''"></div>++ <div class="scheduler-details-label">Created:</div>+ <div class="scheduler-details-value" x-text="selectedTaskForDetail ? formatDate(selectedTaskForDetail.created_at) : ''"></div>++ <div class="scheduler-details-label">Last Updated:</div>+ <div class="scheduler-details-value" x-text="selectedTaskForDetail ? formatDate(selectedTaskForDetail.updated_at) : ''"></div>++ <div class="scheduler-details-label">Last Run:</div>+ <div class="scheduler-details-value" x-text="selectedTaskForDetail ? formatDate(selectedTaskForDetail.last_run) : ''"></div>++ <div class="scheduler-details-label" x-show="selectedTaskForDetail && selectedTaskForDetail.type === 'scheduled'">Schedule:</div>+ <div class="scheduler-details-value" x-show="selectedTaskForDetail && selectedTaskForDetail.type === 'scheduled'" x-text="selectedTaskForDetail ? formatSchedule(selectedTaskForDetail) : ''"></div>++ <div class="scheduler-details-label" x-show="selectedTaskForDetail && selectedTaskForDetail.type === 'adhoc'">Token:</div>+ <div class="scheduler-details-value" x-show="selectedTaskForDetail && selectedTaskForDetail.type === 'adhoc'" x-text="selectedTaskForDetail ? selectedTaskForDetail.token : ''"></div>++ <div class="scheduler-details-label">Last Result:</div>+ <div class="scheduler-details-value" x-text="selectedTaskForDetail && selectedTaskForDetail.last_result ? selectedTaskForDetail.last_result : 'No results yet'"></div>++ <div class="scheduler-details-label">System Prompt:</div>+ <div class="scheduler-details-value" x-text="selectedTaskForDetail ? selectedTaskForDetail.system_prompt : ''"></div>++ <div class="scheduler-details-label">User Prompt:</div>+ <div class="scheduler-details-value" x-text="selectedTaskForDetail ? selectedTaskForDetail.prompt : ''"></div>++ <div class="scheduler-details-label">Attachments:</div>+ <div class="scheduler-details-value">+ <template x-if="selectedTaskForDetail && selectedTaskForDetail.attachments && selectedTaskForDetail.attachments.length > 0">+ <div>+ <template x-for="(attachment, index) in selectedTaskForDetail.attachments" :key="index">+ <div x-text="attachment"></div>+ </template>+ </div>+ </template>+ <template x-if="!selectedTaskForDetail || !selectedTaskForDetail.attachments || selectedTaskForDetail.attachments.length === 0">+ <div>No attachments</div>+ </template>+ </div>+ </div>+ </div>+ </div></div>- </template>+ </div></div><div class="modal-footer">diff --git a/webui/index.js b/webui/index.jsindex b25053e64..e6452d981 100644--- a/webui/index.js+++ b/webui/index.js@@ -392,28 +392,18 @@ async function poll() {const tasksAD = Alpine.$data(tasksSection);let tasks = response.tasks || [];- // Only update the tasks array if it's actually different- // This prevents unnecessary reactivity triggers- const currentTaskIds = new Set((tasksAD.tasks || []).map(t => t.id));- const newTaskIds = new Set(tasks.map(t => t.id));-- // Check if the sets are different sizes or have different contents- const needsUpdate = currentTaskIds.size !== newTaskIds.size ||- tasks.some(task => !currentTaskIds.has(task.id));-- if (needsUpdate) {- if (tasks.length > 0) {- // Sort the tasks by creation time- const sortedTasks = [...tasks].sort((a, b) =>- (b.created_at || 0) - (a.created_at || 0)- );-- // Use a clean array assignment to avoid duplicating elements- tasksAD.tasks = sortedTasks;- } else {- // Make sure to use a new empty array instance- tasksAD.tasks = [];- }+ // Always update tasks to ensure state changes are reflected+ if (tasks.length > 0) {+ // Sort the tasks by creation time+ const sortedTasks = [...tasks].sort((a, b) =>+ (b.created_at || 0) - (a.created_at || 0)+ );++ // Assign the sorted tasks to the Alpine data+ tasksAD.tasks = sortedTasks;+ } else {+ // Make sure to use a new empty array instance+ tasksAD.tasks = [];}}@@ -1251,3 +1241,57 @@ function initializeActiveTab() {* - Tasks use the same context system as chats for communication with the backend* - Future support for renaming and deletion will be implemented later*/++// Open the scheduler detail view for a specific task+function openTaskDetail(taskId) {+ // Wait for Alpine.js to be fully loaded+ if (window.Alpine) {+ // Get the settings modal button and click it to ensure all init logic happens+ const settingsButton = document.getElementById('settings');+ if (settingsButton) {+ // Programmatically click the settings button+ settingsButton.click();++ // Now get a reference to the modal element+ const modalEl = document.getElementById('settingsModal');+ if (!modalEl) {+ console.error('Settings modal element not found after clicking button');+ return;+ }++ // Get the Alpine.js data for the modal+ const modalData = Alpine.$data(modalEl);++ // Use a timeout to ensure the modal is fully rendered+ setTimeout(() => {+ // Switch to the scheduler tab first+ modalData.switchTab('scheduler');++ // Use another timeout to ensure the scheduler component is initialized+ setTimeout(() => {+ // Get the scheduler component+ const schedulerComponent = document.querySelector('[x-data="schedulerSettings"]');+ if (!schedulerComponent) {+ console.error('Scheduler component not found');+ return;+ }++ // Get the Alpine.js data for the scheduler component+ const schedulerData = Alpine.$data(schedulerComponent);++ // Show the task detail view for the specific task+ schedulerData.showTaskDetail(taskId);++ console.log('Task detail view opened for task:', taskId);+ }, 50); // Give time for the scheduler tab to initialize+ }, 25); // Give time for the modal to render+ } else {+ console.error('Settings button not found');+ }+ } else {+ console.error('Alpine.js not loaded');+ }+}++// Make the function available globally+window.openTaskDetail = openTaskDetail;diff --git a/webui/js/scheduler.js b/webui/js/scheduler.jsnew file mode 100644index 000000000..ccae59d48--- /dev/null+++ b/webui/js/scheduler.js@@ -0,0 +1,659 @@+/**+ * Task Scheduler Component for Settings Modal+ * Manages scheduled and ad-hoc tasks through a dedicated settings tab+ */++// Add a document ready event handler to ensure the scheduler tab can be clicked on first load+document.addEventListener('DOMContentLoaded', function() {+ console.log('DOMContentLoaded: Setting up scheduler tab click handler');++ // Setup scheduler tab click handling+ const setupSchedulerTab = () => {+ const settingsModal = document.getElementById('settingsModal');+ if (!settingsModal) {+ setTimeout(setupSchedulerTab, 100);+ return;+ }++ console.log('Setting up click interceptor for scheduler tab');++ // Create a global event listener for clicks on the scheduler tab+ document.addEventListener('click', function(e) {+ // Find if the click was on the scheduler tab or its children+ const schedulerTab = e.target.closest('.settings-tab[title="Task Scheduler"]');+ if (!schedulerTab) return;++ console.log('Intercepted click on scheduler tab');+ e.preventDefault();+ e.stopPropagation();++ // Get the settings modal data+ try {+ const modalData = Alpine.$data(settingsModal);+ if (modalData.activeTab !== 'scheduler') {+ console.log(`Directly switching to scheduler tab via click interceptor.`);+ // Directly call the modal's switchTab method+ modalData.switchTab('scheduler');+ }+ } catch (err) {+ console.error('Error handling scheduler tab click:', err);+ }+ }, true); // Use capture phase to intercept before Alpine.js handlers+ };++ // Initialize the tab handling+ setupSchedulerTab();+});++document.addEventListener('alpine:init', () => {+ // Register as an Alpine component+ Alpine.data('schedulerSettings', () => ({+ tasks: [],+ isLoading: true,+ selectedTask: null,+ expandedTaskId: null,+ sortField: 'name',+ sortDirection: 'asc',+ filterType: 'all', // all, scheduled, adhoc+ filterState: 'all', // all, idle, running, disabled, error+ pollingInterval: null,+ editingTask: null,+ isCreating: false,+ isEditing: false,+ showLoadingState: false,+ viewMode: 'list', // Controls whether to show list or detail view+ selectedTaskForDetail: null, // Task object for detail view++ // Initialize the component+ init() {+ // Initialize editingTask with default values but ensure we're not in editing mode+ this.editingTask = {+ name: '',+ type: 'scheduled',+ state: 'idle', // Initialize with idle state+ schedule: {+ minute: '*',+ hour: '*',+ day: '*',+ month: '*',+ weekday: '*'+ },+ token: '',+ system_prompt: '',+ prompt: '',+ attachments: []+ };++ // Make sure we're in "list view" mode by default+ this.isCreating = false;+ this.isEditing = false;++ // Add a watcher for task type changes to initialize the appropriate properties+ this.$watch('editingTask.type', (newType) => {+ if (newType === 'scheduled' && !this.editingTask.schedule) {+ // Initialize schedule if changing to scheduled type+ this.editingTask.schedule = {+ minute: '*',+ hour: '*',+ day: '*',+ month: '*',+ weekday: '*'+ };+ } else if (newType === 'adhoc' && !this.editingTask.token) {+ // Initialize token if changing to adhoc type+ this.editingTask.token = this.generateRandomToken();+ }+ });++ // Use a small delay to ensure Alpine.js has fully initialized+ // before fetching tasks, which helps prevent layout shift+ setTimeout(() => {+ this.fetchTasks();+ }, 50);++ // Set up polling when component is active+ this.$watch('$store.root.activeTab', (newTab, oldTab) => {+ if (newTab === 'scheduler') {+ this.startPolling();+ } else if (oldTab === 'scheduler') {+ this.stopPolling();+ }+ });++ // Initial polling if tab is active on load+ if (this.$store.root.activeTab === 'scheduler') {+ this.startPolling();+ }+ },++ // Start polling for task updates+ startPolling() {+ this.fetchTasks();+ this.pollingInterval = setInterval(() => this.fetchTasks(), 5000); // Poll every 5 seconds+ },++ // Stop polling when tab is inactive+ stopPolling() {+ if (this.pollingInterval) {+ clearInterval(this.pollingInterval);+ this.pollingInterval = null;+ }+ },++ // Fetch tasks from API+ async fetchTasks() {+ this.isLoading = true;+ try {+ const response = await fetch('/scheduler_tasks_list', {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json'+ }+ });++ if (!response.ok) {+ throw new Error('Failed to fetch tasks');+ }++ const data = await response.json();+ console.log('Tasks fetched from backend:', data.tasks);+ this.tasks = data.tasks || [];+ } catch (error) {+ console.error('Error fetching tasks:', error);+ showToast('Failed to fetch tasks: ' + error.message, 'error');+ } finally {+ this.isLoading = false;+ }+ },++ // Computed property for filtered tasks+ get filteredTasks() {+ return this.tasks+ .filter(task => {+ // Filter by type+ if (this.filterType !== 'all') {+ if (this.filterType === 'scheduled' && !task.schedule) return false;+ if (this.filterType === 'adhoc' && !task.token) return false;+ }++ // Filter by state+ if (this.filterState !== 'all' && task.state !== this.filterState) {+ return false;+ }++ return true;+ })+ .sort((a, b) => {+ // Handle sorting+ let valueA, valueB;++ switch (this.sortField) {+ case 'name':+ valueA = a.name.toLowerCase();+ valueB = b.name.toLowerCase();+ break;+ case 'state':+ valueA = a.state;+ valueB = b.state;+ break;+ case 'last_run':+ valueA = a.last_run ? new Date(a.last_run).getTime() : 0;+ valueB = b.last_run ? new Date(b.last_run).getTime() : 0;+ break;+ default:+ valueA = a.name.toLowerCase();+ valueB = b.name.toLowerCase();+ }++ // Determine sort direction+ const direction = this.sortDirection === 'asc' ? 1 : -1;++ // Compare values+ if (valueA < valueB) return -1 * direction;+ if (valueA > valueB) return 1 * direction;+ return 0;+ });+ },++ // Change sort field/direction+ changeSort(field) {+ if (this.sortField === field) {+ // Toggle direction if already sorting by this field+ this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';+ } else {+ // Set new sort field and default to ascending+ this.sortField = field;+ this.sortDirection = 'asc';+ }+ },++ // Toggle expanded task row+ toggleTaskExpand(taskId) {+ if (this.expandedTaskId === taskId) {+ this.expandedTaskId = null;+ } else {+ this.expandedTaskId = taskId;+ }+ },++ // Show task detail view+ showTaskDetail(taskId) {+ const task = this.tasks.find(t => t.uuid === taskId);+ if (!task) {+ showToast('Task not found', 'error');+ return;+ }++ // Create a copy of the task to avoid modifying the original+ this.selectedTaskForDetail = JSON.parse(JSON.stringify(task));++ // Ensure attachments is always an array+ if (!this.selectedTaskForDetail.attachments) {+ this.selectedTaskForDetail.attachments = [];+ }++ this.viewMode = 'detail';+ },++ // Close detail view and return to list+ closeTaskDetail() {+ this.selectedTaskForDetail = null;+ this.viewMode = 'list';+ },++ // Format date for display+ formatDate(dateString) {+ if (!dateString) return 'Never';++ const date = new Date(dateString);+ return date.toLocaleString();+ },++ // Format schedule for display+ formatSchedule(task) {+ if (!task.schedule) return 'None';++ let schedule = '';+ if (typeof task.schedule === 'string') {+ schedule = task.schedule;+ } else if (typeof task.schedule === 'object') {+ schedule = `${task.schedule.minute || '*'} ${task.schedule.hour || '*'} ${task.schedule.day || '*'} ${task.schedule.month || '*'} ${task.schedule.weekday || '*'}`;+ }++ return schedule;+ },++ // Get CSS class for state badge+ getStateBadgeClass(state) {+ switch (state) {+ case 'idle': return 'scheduler-status-idle';+ case 'running': return 'scheduler-status-running';+ case 'disabled': return 'scheduler-status-disabled';+ case 'error': return 'scheduler-status-error';+ default: return '';+ }+ },++ // Create a new task+ startCreateTask() {+ this.isCreating = true;+ this.isEditing = false;+ document.querySelector('[x-data="schedulerSettings"]')?.setAttribute('data-editing-state', 'creating');+ this.editingTask = {+ name: '',+ type: 'scheduled',+ state: 'idle', // Initialize with idle state+ schedule: {+ minute: '*',+ hour: '*',+ day: '*',+ month: '*',+ weekday: '*'+ },+ token: this.generateRandomToken(), // Generate token even for scheduled tasks to prevent undefined errors+ system_prompt: '',+ prompt: '',+ attachments: [], // Always initialize as an empty array+ };+ },++ // Edit an existing task+ async startEditTask(taskId) {+ const task = this.tasks.find(t => t.uuid === taskId);+ if (!task) {+ showToast('Task not found', 'error');+ return;+ }++ this.isCreating = false;+ this.isEditing = true;+ document.querySelector('[x-data="schedulerSettings"]')?.setAttribute('data-editing-state', 'editing');++ // Create a deep copy to avoid modifying the original+ this.editingTask = JSON.parse(JSON.stringify(task));++ // Debug log+ console.log('Task data for editing:', task);+ console.log('Attachments from task:', task.attachments);++ // Ensure state is set with a default if missing+ if (!this.editingTask.state) this.editingTask.state = 'idle';++ // Ensure attachments is always an array+ if (!this.editingTask.attachments) {+ this.editingTask.attachments = [];+ } else if (typeof this.editingTask.attachments === 'string') {+ // Handle case where attachments might be stored as a string+ this.editingTask.attachments = this.editingTask.attachments+ .split('\n')+ .map(line => line.trim())+ .filter(line => line.length > 0);+ } else if (!Array.isArray(this.editingTask.attachments)) {+ // If not an array or string, set to empty array+ this.editingTask.attachments = [];+ }++ // Ensure appropriate properties are initialized based on task type+ if (this.editingTask.type === 'scheduled') {+ // Ensure proper structure for schedule+ if (typeof this.editingTask.schedule === 'string') {+ const parts = this.editingTask.schedule.split(' ');+ this.editingTask.schedule = {+ minute: parts[0] || '*',+ hour: parts[1] || '*',+ day: parts[2] || '*',+ month: parts[3] || '*',+ weekday: parts[4] || '*'+ };+ } else if (!this.editingTask.schedule) {+ // Initialize schedule if it doesn't exist+ this.editingTask.schedule = {+ minute: '*',+ hour: '*',+ day: '*',+ month: '*',+ weekday: '*'+ };+ }+ // Initialize token for scheduled tasks to prevent undefined errors if UI accesses it+ if (!this.editingTask.token) {+ this.editingTask.token = '';+ }+ } else if (this.editingTask.type === 'adhoc') {+ // Initialize token if it doesn't exist+ if (!this.editingTask.token) {+ this.editingTask.token = this.generateRandomToken();+ }+ // Initialize schedule for adhoc tasks to prevent undefined errors when UI accesses schedule properties+ if (!this.editingTask.schedule) {+ this.editingTask.schedule = {+ minute: '*',+ hour: '*',+ day: '*',+ month: '*',+ weekday: '*'+ };+ }+ }+ },++ // Cancel editing+ cancelEdit() {+ // Reset to initial state but keep default values to prevent errors+ this.editingTask = {+ name: '',+ type: 'scheduled',+ state: 'idle', // Initialize with idle state+ schedule: {+ minute: '*',+ hour: '*',+ day: '*',+ month: '*',+ weekday: '*'+ },+ token: '',+ system_prompt: '',+ prompt: '',+ attachments: [], // Always initialize as an empty array+ };+ this.isCreating = false;+ this.isEditing = false;+ document.querySelector('[x-data="schedulerSettings"]')?.removeAttribute('data-editing-state');+ },++ // Save task (create new or update existing)+ async saveTask() {+ // Validate task data+ if (!this.editingTask.name.trim()) {+ showToast('Task name is required', 'error');+ return;+ }++ try {+ let apiEndpoint, taskData;++ // Prepare task data+ taskData = {+ name: this.editingTask.name,+ system_prompt: this.editingTask.system_prompt || '',+ prompt: this.editingTask.prompt || '',+ state: this.editingTask.state || 'idle' // Include state in task data+ };++ // Process attachments - now always stored as array+ taskData.attachments = Array.isArray(this.editingTask.attachments)+ ? this.editingTask.attachments+ .map(line => typeof line === 'string' ? line.trim() : line)+ .filter(line => line && line.trim().length > 0)+ : [];++ // Handle schedule based on task type+ if (this.editingTask.type === 'scheduled') {+ // Ensure schedule is properly formatted as an object+ if (typeof this.editingTask.schedule === 'string') {+ // Parse string schedule into object+ const parts = this.editingTask.schedule.split(' ');+ taskData.schedule = {+ minute: parts[0] || '*',+ hour: parts[1] || '*',+ day: parts[2] || '*',+ month: parts[3] || '*',+ weekday: parts[4] || '*'+ };+ } else {+ // Use object schedule directly+ taskData.schedule = this.editingTask.schedule;+ }+ // Don't send token for scheduled tasks+ delete taskData.token;+ } else {+ // Ad-hoc task with token+ taskData.token = this.editingTask.token;+ // Don't send schedule for adhoc tasks+ delete taskData.schedule;+ }++ // Determine if creating or updating+ if (this.isCreating) {+ apiEndpoint = '/scheduler_task_create';+ } else {+ apiEndpoint = '/scheduler_task_update';+ taskData.task_id = this.editingTask.uuid;+ }++ // Make API request+ const response = await fetch(apiEndpoint, {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify(taskData)+ });++ if (!response.ok) {+ const errorData = await response.json();+ throw new Error(errorData.error || 'Failed to save task');+ }++ // Show success message+ showToast(this.isCreating ? 'Task created successfully' : 'Task updated successfully', 'success');++ // Refresh task list+ this.fetchTasks();++ // Reset form to default state without setting to null+ this.cancelEdit();+ document.querySelector('[x-data="schedulerSettings"]')?.removeAttribute('data-editing-state');+ } catch (error) {+ console.error('Error saving task:', error);+ showToast('Failed to save task: ' + error.message, 'error');+ }+ },++ // Run a task+ async runTask(taskId) {+ try {+ const response = await fetch('/scheduler_task_run', {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({ task_id: taskId })+ });++ if (!response.ok) {+ const errorData = await response.json();+ throw new Error(errorData.error || 'Failed to run task');+ }++ showToast('Task started successfully', 'success');++ // Refresh task list+ this.fetchTasks();+ } catch (error) {+ console.error('Error running task:', error);+ showToast('Failed to run task: ' + error.message, 'error');+ }+ },++ // Reset a task's state+ async resetTaskState(taskId) {+ try {+ const task = this.tasks.find(t => t.uuid === taskId);+ if (!task) {+ showToast('Task not found', 'error');+ return;+ }++ // Check if task is already in idle state+ if (task.state === 'idle') {+ showToast('Task is already in idle state', 'info');+ return;+ }++ this.showLoadingState = true;++ // Call API to update the task state+ const response = await fetch('/scheduler_task_update', {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({+ task_id: taskId,+ state: 'idle' // Always reset to idle state+ })+ });++ if (!response.ok) {+ const errorData = await response.json();+ throw new Error(errorData.error || 'Failed to reset task state');+ }++ showToast('Task state reset to idle', 'success');++ // Refresh task list+ await this.fetchTasks();+ this.showLoadingState = false;+ } catch (error) {+ console.error('Error resetting task state:', error);+ showToast('Failed to reset task state: ' + error.message, 'error');+ this.showLoadingState = false;+ }+ },++ // Delete a task+ async deleteTask(taskId) {+ // Confirm deletion+ if (!confirm('Are you sure you want to delete this task? This action cannot be undone.')) {+ return;+ }++ try {+ const response = await fetch('/scheduler_task_delete', {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({ task_id: taskId })+ });++ if (!response.ok) {+ const errorData = await response.json();+ throw new Error(errorData.error || 'Failed to delete task');+ }++ showToast('Task deleted successfully', 'success');++ // Refresh task list+ this.fetchTasks();++ // Close expanded view if this task was expanded+ if (this.expandedTaskId === taskId) {+ this.expandedTaskId = null;+ }+ } catch (error) {+ console.error('Error deleting task:', error);+ showToast('Failed to delete task: ' + error.message, 'error');+ }+ },++ // Generate a random token for ad-hoc tasks+ generateRandomToken() {+ const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';+ let token = '';+ for (let i = 0; i < 16; i++) {+ token += characters.charAt(Math.floor(Math.random() * characters.length));+ }+ return token;+ },++ // Computed property for attachments text representation+ get attachmentsText() {+ // Ensure we always have an array to work with+ const attachments = Array.isArray(this.editingTask.attachments)+ ? this.editingTask.attachments+ : [];++ console.log('attachmentsText getter called, source:', this.editingTask.attachments);++ // Join array items with newlines+ return attachments.join('\n');+ },++ // Setter for attachments text - preserves empty lines during editing+ set attachmentsText(value) {+ console.log('attachmentsText setter called with:', value);++ if (typeof value === 'string') {+ // Just split by newlines without filtering to preserve editing experience+ this.editingTask.attachments = value.split('\n');+ } else {+ // Fallback to empty array if not a string+ this.editingTask.attachments = [];+ }++ console.log('editingTask.attachments is now:', this.editingTask.attachments);+ }+ }));+});diff --git a/webui/js/settings.js b/webui/js/settings.jsindex 7c23cc623..333a468e6 100644--- a/webui/js/settings.js+++ b/webui/js/settings.js@@ -19,20 +19,29 @@ const settingsModalProxy = {// Switch tab methodswitchTab(tabName) {+ console.log(`Switching tab from ${this.activeTab} to ${tabName}`);this.activeTab = tabName;localStorage.setItem('settingsActiveTab', tabName);- // Auto-scroll active tab into view (added after a small delay to ensure DOM updates)+ // Auto-scroll active tab into view after a short delay to ensure DOM updatessetTimeout(() => {const activeTab = document.querySelector('.settings-tab.active');if (activeTab) {+ console.log(`Scrolling active tab into view: ${activeTab.textContent}`);activeTab.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' });+ } else {+ console.warn('No active tab found to scroll into view');}++ // Debug the scheduler tab specifically+ const schedulerTab = document.querySelector('.settings-tab[title="Task Scheduler"]');+ console.log('Scheduler tab:', schedulerTab);+ console.log('Scheduler tab active?', schedulerTab && schedulerTab.classList.contains('active'));}, 10);},async openModal() {-+ console.log('Settings modal opening');const modalEl = document.getElementById('settingsModal');const modalAD = Alpine.$data(modalEl);@@ -40,9 +49,7 @@ const settingsModalProxy = {try {const set = await sendJsonData("/settings_get", null);- // Restore active tab from localStorage or use default- this.activeTab = localStorage.getItem('settingsActiveTab') || 'agent';-+ // First load the settings data without setting the active tabconst settings = {"title": "Settings","buttons": [@@ -61,8 +68,66 @@ const settingsModalProxy = {"sections": set.settings.sections}- modalAD.isOpen = true; // Update directly- modalAD.settings = settings; // Update directly+ // Update modal data+ modalAD.isOpen = true;+ modalAD.settings = settings;++ // Now set the active tab after the modal is open+ // This ensures Alpine reactivity works as expected+ setTimeout(() => {+ // Get stored tab or default to 'agent'+ const savedTab = localStorage.getItem('settingsActiveTab') || 'agent';+ console.log(`Setting initial tab to: ${savedTab}`);++ // Directly set the active tab+ modalAD.activeTab = savedTab;+ localStorage.setItem('settingsActiveTab', savedTab);++ // Add a small delay *after* setting the tab to ensure scrolling works+ setTimeout(() => {+ const activeTabElement = document.querySelector('.settings-tab.active');+ if (activeTabElement) {+ activeTabElement.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' });+ }+ // Debug log+ const schedulerTab = document.querySelector('.settings-tab[title="Task Scheduler"]');+ console.log(`Current active tab after direct set: ${modalAD.activeTab}`);+ console.log('Scheduler tab active after direct initialization?',+ schedulerTab && schedulerTab.classList.contains('active'));+ }, 10); // Small delay just for scrolling++ }, 5); // Keep a minimal delay for modal opening reactivity++ // Add a watcher to disable the Save button when a task is being created or edited+ const schedulerComponent = document.querySelector('[x-data="schedulerSettings"]');+ if (schedulerComponent) {+ // Watch for changes to the scheduler's editing state+ const checkSchedulerEditingState = () => {+ const schedulerData = Alpine.$data(schedulerComponent);+ if (schedulerData) {+ // If we're on the scheduler tab and creating/editing a task, disable the Save button+ const saveButton = document.querySelector('.modal-footer button.btn-ok');+ if (saveButton && modalAD.activeTab === 'scheduler' &&+ (schedulerData.isCreating || schedulerData.isEditing)) {+ saveButton.disabled = true;+ saveButton.classList.add('btn-disabled');+ } else if (saveButton) {+ saveButton.disabled = false;+ saveButton.classList.remove('btn-disabled');+ }+ }+ };++ // Add a mutation observer to detect changes in the scheduler component's state+ const observer = new MutationObserver(checkSchedulerEditingState);+ observer.observe(schedulerComponent, { attributes: true, subtree: true, childList: true });++ // Also watch for tab changes to update button state+ modalAD.$watch('activeTab', checkSchedulerEditingState);++ // Initial check+ setTimeout(checkSchedulerEditingState, 100);+ }return new Promise(resolve => {this.resolvePromise = resolve;@@ -124,3 +189,257 @@ const settingsModalProxy = {// document.addEventListener('alpine:init', () => {// Alpine.store('settingsModal', initSettingsModal());// });++document.addEventListener('alpine:init', function () {+ Alpine.store('root', {+ activeTab: localStorage.getItem('settingsActiveTab') || 'agent',+ isOpen: false,++ toggleSettings() {+ this.isOpen = !this.isOpen;+ }+ });++ Alpine.data('settingsModal', function () {+ return {+ settingsData: {},+ filteredSections: [],+ activeTab: 'agent',+ isLoading: true,++ async init() {+ // Watch store tab changes+ this.$watch('$store.root.activeTab', (newTab) => {+ this.activeTab = newTab;+ localStorage.setItem('settingsActiveTab', newTab);+ this.updateFilteredSections();+ });++ // Load settings+ await this.fetchSettings();+ this.activeTab = this.$store.root.activeTab;+ this.updateFilteredSections();+ },++ switchTab(tab) {+ this.$store.root.activeTab = tab;+ },++ async fetchSettings() {+ try {+ this.isLoading = true;+ const response = await fetch('/api/settings_get', {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json'+ }+ });++ if (response.ok) {+ const data = await response.json();+ if (data && data.settings) {+ this.settingsData = data.settings;+ } else {+ console.error('Invalid settings data format');+ }+ } else {+ console.error('Failed to fetch settings:', response.statusText);+ }+ } catch (error) {+ console.error('Error fetching settings:', error);+ } finally {+ this.isLoading = false;+ }+ },++ updateFilteredSections() {+ // Filter sections based on active tab+ if (this.activeTab === 'agent') {+ this.filteredSections = this.settingsData.sections?.filter(section =>+ section.group === 'agent'+ ) || [];+ } else if (this.activeTab === 'external') {+ this.filteredSections = this.settingsData.sections?.filter(section =>+ section.group === 'external'+ ) || [];+ } else if (this.activeTab === 'developer') {+ this.filteredSections = this.settingsData.sections?.filter(section =>+ section.group === 'developer'+ ) || [];+ } else {+ // For any other tab, show nothing since those tabs have custom UI+ this.filteredSections = [];+ }+ },++ async saveSettings() {+ try {+ // First validate+ for (const section of this.settingsData.sections) {+ for (const field of section.fields) {+ if (field.required && (!field.value || field.value.trim() === '')) {+ showToast(`${field.title} in ${section.title} is required`, 'error');+ return;+ }+ }+ }++ // Prepare data+ const formData = {};+ for (const section of this.settingsData.sections) {+ for (const field of section.fields) {+ formData[field.id] = field.value;+ }+ }++ // Send request+ const response = await fetch('/api/settings_save', {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify(formData)+ });++ if (response.ok) {+ showToast('Settings saved successfully', 'success');+ // Refresh settings+ await this.fetchSettings();+ } else {+ const errorData = await response.json();+ throw new Error(errorData.error || 'Failed to save settings');+ }+ } catch (error) {+ console.error('Error saving settings:', error);+ showToast('Failed to save settings: ' + error.message, 'error');+ }+ },++ // Handle special button field actions+ handleFieldButton(field) {+ if (field.action === 'test_connection') {+ this.testConnection(field);+ } else if (field.action === 'reveal_token') {+ this.revealToken(field);+ } else if (field.action === 'generate_token') {+ this.generateToken(field);+ } else {+ console.warn('Unknown button action:', field.action);+ }+ },++ // Test API connection+ async testConnection(field) {+ try {+ field.testResult = 'Testing...';+ field.testStatus = 'loading';++ // Find the API key field+ let apiKey = '';+ for (const section of this.settingsData.sections) {+ for (const f of section.fields) {+ if (f.id === field.target) {+ apiKey = f.value;+ break;+ }+ }+ }++ if (!apiKey) {+ throw new Error('API key is required');+ }++ // Send test request+ const response = await fetch('/api/test_connection', {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json'+ },+ body: JSON.stringify({+ service: field.service,+ api_key: apiKey+ })+ });++ const data = await response.json();++ if (response.ok && data.success) {+ field.testResult = 'Connection successful!';+ field.testStatus = 'success';+ } else {+ throw new Error(data.error || 'Connection failed');+ }+ } catch (error) {+ console.error('Connection test failed:', error);+ field.testResult = `Failed: ${error.message}`;+ field.testStatus = 'error';+ }+ },++ // Reveal token temporarily+ revealToken(field) {+ // Find target field+ for (const section of this.settingsData.sections) {+ for (const f of section.fields) {+ if (f.id === field.target) {+ // Toggle field type+ f.type = f.type === 'password' ? 'text' : 'password';++ // Update button text+ field.value = f.type === 'password' ? 'Show' : 'Hide';++ break;+ }+ }+ }+ },++ // Generate random token+ generateToken(field) {+ // Find target field+ for (const section of this.settingsData.sections) {+ for (const f of section.fields) {+ if (f.id === field.target) {+ // Generate random token+ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';+ let token = '';+ for (let i = 0; i < 32; i++) {+ token += chars.charAt(Math.floor(Math.random() * chars.length));+ }++ // Set field value+ f.value = token;+ break;+ }+ }+ }+ },++ closeModal() {+ this.$store.root.isOpen = false;+ }+ };+ });+});++// Show toast notification+function showToast(message, type = 'info') {+ const toast = document.createElement('div');+ toast.className = `toast toast-${type}`;+ toast.textContent = message;++ document.body.appendChild(toast);++ // Trigger animation+ setTimeout(() => {+ toast.classList.add('show');+ }, 10);++ // Remove after delay+ setTimeout(() => {+ toast.classList.remove('show');+ setTimeout(() => {+ document.body.removeChild(toast);+ }, 300);+ }, 3000);+}diff --git a/webui/public/schedule.svg b/webui/public/schedule.svgnew file mode 100644index 000000000..089188ae1--- /dev/null+++ b/webui/public/schedule.svg@@ -0,0 +1,2 @@+<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->+<svg fill="#000000" width="800px" height="800px" viewBox="0 0 14 14" role="img" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="m 8.9994537,13.238438 c -0.0393,-0.07725 -0.213095,-0.409163 -0.386333,-0.73767 -0.173254,-0.328507 -0.307642,-0.604662 -0.298641,-0.613662 0.01605,-0.01605 1.642563,0.0489 1.659979,0.0663 0.0045,0.0045 -0.0489,0.0984 -0.119703,0.207904 -0.07065,0.109352 -0.119552,0.208039 -0.108452,0.219125 0.048,0.04815 0.6568033,0.04065 0.8887233,-0.0105 0.277896,-0.0618 0.671129,-0.24986 0.858978,-0.410738 0.147453,-0.126303 0.169323,-0.134553 0.169323,-0.06375 0,0.153783 0.187939,0.329766 0.355072,0.332482 0.06615,0.0011 0.0612,0.012 -0.05385,0.111902 -0.589122,0.51418 -1.481475,0.774016 -2.2191153,0.646153 -0.104552,-0.01815 -0.233,-0.0402 -0.285306,-0.04905 -0.08625,-0.015 -0.103352,-0.0015 -0.184084,0.136203 -0.0489,0.0837 -0.115052,0.186829 -0.147003,0.229159 l -0.05805,0.07695 -0.0714,-0.140403 z m -1.176609,-1.49553 c -0.148053,-0.23828 -0.246275,-0.45739 -0.333127,-0.743266 -0.07455,-0.2453 -0.08505,-0.335046 -0.087,-0.738884 -0.0015,-0.3858833 0.009,-0.4993003 0.06885,-0.7065743 0.178369,-0.6201433 0.520046,-1.1357488 0.984591,-1.485736 0.09885,-0.074402 0.182598,-0.1365028 0.186198,-0.1378528 0.003,-0.00136 -0.0282,-0.1152023 -0.07065,-0.2528151 -0.04245,-0.1377028 -0.07035,-0.2572553 -0.0618,-0.2657005 0.0252,-0.025201 1.6001573,0.3539173 1.6001573,0.3852529 0,0.0159 -0.2377693,0.2806257 -0.5283853,0.588312 -0.290616,0.3077013 -0.545817,0.5787568 -0.567102,0.6023373 -0.0312,0.034651 -0.0525,-0.003 -0.110252,-0.1981391 -0.0393,-0.1326027 -0.07755,-0.2410249 -0.0849,-0.2410249 -0.048,0 -0.254751,0.197044 -0.378428,0.3606674 -0.337462,0.4464695 -0.472105,0.8850038 -0.447444,1.4573551 0.012,0.290466 0.0321,0.399008 0.110102,0.608262 0.0522,0.140103 0.132603,0.314571 0.178849,0.387713 0.103052,0.163218 0.103052,0.165963 0.003,0.165963 -0.137253,0 -0.268371,0.09015 -0.325477,0.223925 l -0.0534,0.124952 -0.08385,-0.134852 z m 4.1891653,0.0771 c 0,-0.0171 -0.0357,-0.370687 -0.0792,-0.785731 -0.04365,-0.415058 -0.0792,-0.779415 -0.0792,-0.809671 0,-0.04755 0.0315,-0.04035 0.22985,0.0516 l 0.229834,0.106652 0.009,-0.141603 C 12.339844,9.9851577 12.245794,9.6008647 12.086532,9.2786274 11.876977,8.8544788 11.547031,8.524592 11.123077,8.3152928 10.957819,8.2336911 10.737014,8.1511594 10.632387,8.131839 10.341051,8.0779879 10.349856,8.083988 10.423958,7.9897861 c 0.078,-0.099152 0.0852,-0.2624603 0.0174,-0.393668 -0.0468,-0.090302 -0.0459,-0.093452 0.02385,-0.093302 0.146703,4.5e-4 0.606552,0.1299026 0.832742,0.2344098 0.303996,0.1404028 0.490315,0.2695405 0.75669,0.5242607 0.570477,0.5455311 0.847562,1.1963501 0.856293,2.0112414 l 0.0045,0.376643 0.243575,0.114752 0.243575,0.114752 -0.664484,0.475525 c -0.690194,0.493915 -0.72615,0.516985 -0.72615,0.465564 z M 2.1445312,0.99804688 A 0.3678473,0.3678473 0 0 0 2.125,1 0.3678473,0.3678473 0 0 0 1.84375,1.375 l 0,11.25 A 0.3678473,0.3678473 0 0 0 2.21875,13 l 4.3359375,0 0,-0.75 -3.9609375,0 0,-10.53125 8.8125,0 0,4.8066406 0.75,0 0,-5.1503906 A 0.3678473,0.3678473 0 0 0 11.78125,1 l -9.5625,0 a 0.3678473,0.3678473 0 0 0 -0.074219,-0.001953 z M 11.125,1.9375 9.1875,1.96875 l 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 0,0.21875 -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 0,0.1875 -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 0,0.1875 -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 0,0.1875 -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z M 5.15625,2.875 l -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 2.875,0 L 6.125,2.90625 6.125,3 8.03125,2.96875 l 0,-0.09375 z m -2.875,0.21875 -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 2.875,0 L 6.125,3.125 l 0,0.09375 1.90625,-0.03125 0,-0.09375 z m -2.875,0.1875 -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 2.875,0 -1.90625,0.03125 0,0.09375 1.90625,-0.03125 0,-0.09375 z m -2.875,0.1875 -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 2.875,0 L 6.125,3.5 l 0,0.09375 1.90625,-0.03125 0,-0.09375 z m -2.875,0.1875 -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 2.875,0 -1.90625,0.03125 0,0.09375 1.90625,-0.03125 0,-0.09375 z m -4.96875,0.9375 0,0.125 0,5.03125 0,0.09375 0.125,0 3.3671875,0 0,-0.21875 -1.4296875,0 c -4.249e-4,-0.00853 8.041e-4,-0.024839 0,-0.0625 -7.696e-4,-0.036006 -0.00862,-0.1745288 -0.015625,-0.2539062 0.2701075,-0.00208 1.0622819,-0.00278 1.4453125,-0.00586 l 0,-0.1152344 c -0.3845771,-4.38e-5 -1.1803643,-4.158e-4 -1.4511719,0 -0.00371,-0.065008 -0.00913,-0.067093 -0.00977,-0.15625 -1.268e-4,-0.017828 1.122e-4,-0.106098 0,-0.125 0.2718265,-4.227e-4 1.0741495,-4.7e-5 1.4609375,0 l 0,-0.09375 c -0.3867797,-4.7e-5 -1.1890846,-4.227e-4 -1.4609375,0 -2.542e-4,-0.049319 1.733e-4,-0.2559925 0,-0.3125 0.2673701,-4.484e-4 1.0794915,-3.2e-5 1.4609375,0 l 0,-0.09375 c -0.3814388,-3.2e-5 -1.193539,-4.484e-4 -1.4609375,0 -1.359e-4,-0.052881 8.09e-5,-0.2220683 0,-0.28125 0.2673701,-4.484e-4 1.0794915,-3.2e-5 1.4609375,0 l 0,-0.1035156 c -0.381437,0.00311 -1.19354,0.00383 -1.4609375,0.00586 -7.05e-5,-0.068278 1.55e-5,-0.2358458 0,-0.3125 0.2673692,-0.00203 1.0794932,-0.00275 1.4609375,-0.00586 l 0,-0.1152344 c -0.3814388,-3.2e-5 -1.193539,-4.484e-4 -1.4609375,0 3.1e-6,-0.080027 -4.39e-5,-0.2234405 0,-0.3125 0.2695936,-4.355e-4 1.0768252,-3.96e-5 1.4609375,0 l 0,-0.09375 c -0.3841045,-3.96e-5 -1.1913165,-4.355e-4 -1.4609375,0 5.48e-5,-0.09301 -8.28e-5,-0.2135038 0,-0.3164062 0.2673692,-0.00203 1.0794932,-0.00275 1.4609375,-0.00586 l 0,-0.1152344 c -0.3814388,-3.2e-5 -1.193539,-4.484e-4 -1.4609375,0 9.86e-5,-0.1160496 -1.137e-4,-0.2151978 0,-0.34375 0.3979705,-6.423e-4 1.4981572,-2.581e-4 2.15625,0 -3.95e-5,0.04455 3.82e-5,0.076117 0,0.1191406 l 0.09375,0 c 3.81e-5,-0.043028 -3.94e-5,-0.074586 0,-0.1191406 0.4569181,1.902e-4 0.8659677,-2.833e-4 1.46875,0 -3.87e-5,0.044384 3.74e-5,0.076277 0,0.1191406 l 0.1054688,0 c -3.809e-4,-0.042866 3.698e-4,-0.074754 0,-0.1191406 0.7658707,3.498e-4 0.8031403,-2.94e-5 1.8320312,0 l 0,0.1191406 0.21875,0 0,-1.8066406 0,-0.125 -0.125,0 -7.65625,0 -0.125,0 z M 3.28125,4.8125 5,4.8125 c -3.7e-6,0.1416371 3.03e-5,0.1165691 0,0.25 -0.1462573,2.639e-4 -0.6962545,-4.758e-4 -0.8125,0 -0.4739238,0.00194 -0.7250132,-0.00146 -0.84375,0 -0.039579,4.862e-4 -0.047915,1.621e-4 -0.0625,0 l 0,-0.25 z m 1.8125,0 2.15625,0 c -3.7e-6,0.1416371 3.03e-5,0.1165691 0,0.25 -0.6580745,-2.627e-4 -1.7583068,-6.427e-4 -2.15625,0 3.02e-5,-0.133429 -3.7e-6,-0.1083692 0,-0.25 z m 2.25,0 1.46875,0 c -7.1e-6,0.1414487 3.22e-5,0.1168235 0,0.25 -0.6050101,-2.842e-4 -1.0117629,1.933e-4 -1.46875,0 3.02e-5,-0.133429 -3.7e-6,-0.1083692 0,-0.25 z m 1.5625,0 1.84375,0 0,0.25 c -1.0439245,-2.01e-5 -1.0701095,3.527e-4 -1.8417969,0 -2.113e-4,-0.1331757 -0.00191,-0.1085562 -0.00195,-0.25 z m -5.625,0.34375 c 0.014645,1.613e-4 0.023103,4.84e-4 0.0625,0 0.118191,-0.00145 0.3699627,0.00194 0.84375,0 0.116212,-4.758e-4 0.6662595,2.639e-4 0.8125,0 -5.29e-5,0.1772845 8.69e-5,0.177026 0,0.3398438 C 4.8468448,5.4972449 4.2769664,5.4995057 4.15625,5.5 3.6823262,5.50194 3.4312368,5.49854 3.3125,5.5 c -0.019789,2.431e-4 -0.019067,4.89e-5 -0.03125,0 l 0,-0.34375 z m 1.8125,0 c 0.3979028,-6.427e-4 1.4981507,-2.627e-4 2.15625,0 -5.14e-5,0.1721901 8.36e-5,0.1715435 0,0.3300781 -0.6623331,0.00479 -1.7550131,0.00667 -2.15625,0.00977 8.67e-5,-0.1628235 -5.28e-5,-0.1625599 0,-0.3398438 z m 2.25,0 c 0.4570048,1.933e-4 0.8637209,-2.842e-4 1.46875,0 -5.2e-5,0.1677598 8.11e-5,0.1676002 0,0.3222656 -0.608386,0.00261 -1.0088341,0.0026 -1.46875,0.00586 8.28e-5,-0.1576805 -5.09e-5,-0.1569543 0,-0.328125 z m 1.5664062,0 c 0.7711585,3.523e-4 0.7970432,-2e-5 1.8398438,0 l 0,0.3125 c -1.0466803,7.13e-5 -1.0630407,0.0066 -1.8378906,0.00977 C 8.9115346,5.3238465 8.9105029,5.3240081 8.9101562,5.15625 Z M 3.28125,5.59375 c 0.012304,4.54e-5 0.011551,2.42e-4 0.03125,0 0.118191,-0.00145 0.3699627,0.00194 0.84375,0 0.1206817,-4.942e-4 0.6906117,2.665e-4 0.84375,0 -8.66e-5,0.1459986 1.014e-4,0.1780905 0,0.3125 -0.1531523,2.662e-4 -0.7236003,-4.918e-4 -0.84375,0 -0.4739238,0.00194 -0.6937632,-0.00146 -0.8125,0 -0.029684,3.646e-4 -0.04059,1.462e-4 -0.0625,0 l 0,-0.3125 z m 1.8125,0 c 0.4011985,-6.239e-4 1.4938905,-2.699e-4 2.15625,0 -8.66e-5,0.1459987 1.014e-4,0.1780905 0,0.3125 -0.6622889,-2.653e-4 -1.7549089,-6.236e-4 -2.15625,0 1.012e-4,-0.1344194 -8.64e-5,-0.1664948 0,-0.3125 z m 2.25,0 c 0.4599352,1.979e-4 0.8603429,-2.834e-4 1.46875,0 -8.61e-5,0.1455683 9.99e-5,0.1785471 0,0.3125 -0.6060777,-2.826e-4 -1.0089482,1.948e-4 -1.46875,0 1.012e-4,-0.1344194 -8.64e-5,-0.1664948 0,-0.3125 z m 1.5683594,0 c 0.7748709,3.503e-4 0.7912313,-1.01e-5 1.8378906,0 l 0,0.3125 c -1.0359246,-1.98e-5 -1.0647996,3.493e-4 -1.8359375,0 -7.889e-4,-0.1339616 -0.00133,-0.1669262 -0.00195,-0.3125 z M 3.28125,6 c 0.02208,1.419e-4 0.032952,3.63e-4 0.0625,0 C 3.461941,5.99855 3.6824627,6.00194 4.15625,6 4.2763651,5.9995082 4.8468646,6.0002662 5,6 c -1.038e-4,0.1310253 1.052e-4,0.1924473 0,0.3125 -0.1462397,2.635e-4 -0.6968003,-4.736e-4 -0.8125,0 -0.4739238,0.00194 -0.6937632,-0.00146 -0.8125,0 -0.059368,7.293e-4 -0.078397,-4.401e-4 -0.09375,0 l 0,-0.3125 z m 1.8125,0 C 5.4950521,5.9993764 6.5876862,5.9997347 7.25,6 c -1.038e-4,0.1310253 1.052e-4,0.1924473 0,0.3125 -0.6580683,-2.581e-4 -1.7582391,-6.423e-4 -2.15625,0 1.049e-4,-0.1200647 -1.036e-4,-0.1814642 0,-0.3125 z m 2.25,0 c 0.4598196,1.948e-4 0.8626535,-2.826e-4 1.46875,0 -1.021e-4,0.1305665 1.031e-4,0.1928939 0,0.3125 -0.6027633,-2.833e-4 -1.0118495,1.902e-4 -1.46875,0 1.049e-4,-0.1200647 -1.036e-4,-0.1814642 0,-0.3125 z M 8.9160156,6 C 9.686617,6.0003488 9.7151941,5.9999802 10.75,6 l 0,0.3125 c -1.0289065,-2.94e-5 -1.0661833,3.498e-4 -1.8320312,0 C 8.9170253,6.1928833 8.9168459,6.1305756 8.9160156,6 Z M 4.1875,6.40625 C 4.3031664,6.4057764 4.8537771,6.4065135 5,6.40625 4.999886,6.5347888 5.0000988,6.6339632 5,6.75 4.8605412,6.7502608 4.3305245,6.7495425 4.21875,6.75 3.7448262,6.75194 3.4937368,6.74854 3.375,6.75 3.315632,6.7507293 3.296603,6.78081 3.28125,6.78125 l 0,-0.34375 c 0.014263,-4.088e-4 0.034654,7.26e-4 0.09375,0 C 3.493191,6.43605 3.7137127,6.40819 4.1875,6.40625 Z M 5,6.8710938 c -8.3e-5,0.1028911 5.49e-5,0.2234053 0,0.3164062 -0.1462573,2.639e-4 -0.6962545,-4.758e-4 -0.8125,0 -0.4739238,0.00194 -0.6937632,-0.00146 -0.8125,0 -0.044526,5.47e-4 -0.070349,1.09e-4 -0.09375,0 l 0,-0.3125 c 0.014263,-4.088e-4 0.034654,7.26e-4 0.09375,0 0.118191,-0.00145 0.3699627,0.00194 0.84375,0 C 4.3304924,6.8745425 4.8605578,6.8721212 5,6.8710938 Z M 3.375,7.28125 c 0.118191,-0.00145 0.3387126,0.00194 0.8125,0 0.116212,-4.758e-4 0.6662596,2.639e-4 0.8125,0 -4.4e-5,0.089052 3.1e-6,0.2324761 0,0.3125 -0.1394588,2.608e-4 -0.6694755,-4.575e-4 -0.78125,0 -0.4739238,0.00194 -0.7250132,0.029791 -0.84375,0.03125 -0.059368,7.293e-4 -0.078397,-4.401e-4 -0.09375,0 l 0,-0.3203125 C 3.3045614,7.2960111 3.330678,7.2817945 3.375,7.28125 Z M 5,7.7148438 c 1.55e-5,0.076653 -7.07e-5,0.2442168 0,0.3125 -0.139459,0.00103 -0.6694753,0.00345 -0.78125,0.00391 -0.4739239,0.00194 -0.7250132,-0.00146 -0.84375,0 -0.059368,7.293e-4 -0.078397,-4.401e-4 -0.09375,0 l 0,-0.3125 c 0.014263,-4.088e-4 0.034654,7.26e-4 0.09375,0 0.118191,-0.00145 0.3699627,0.00194 0.84375,0 C 4.3304924,7.7182925 4.8605578,7.7158712 5,7.7148438 Z M 3.28125,8.125 c 0.014263,-4.088e-4 0.034654,7.26e-4 0.09375,0 0.118191,-0.00145 0.3699626,0.00194 0.84375,0 0.1117423,-4.575e-4 0.641808,2.608e-4 0.78125,0 8.1e-5,0.059188 -1.363e-4,0.2283563 0,0.28125 -0.1394588,2.608e-4 -0.6694755,-4.575e-4 -0.78125,0 -0.4739239,0.00194 -0.7250132,-0.00146 -0.84375,0 -0.059368,7.293e-4 -0.078397,-4.401e-4 -0.09375,0 l 0,-0.28125 z m 0,0.375 c 0.014263,-4.088e-4 0.034654,7.26e-4 0.09375,0 0.118191,-0.00145 0.3699626,0.00194 0.84375,0 0.1117423,-4.575e-4 0.641808,2.608e-4 0.78125,0 1.737e-4,0.056525 -2.548e-4,0.2631535 0,0.3125 -0.1531552,2.665e-4 -0.7230335,-4.942e-4 -0.84375,0 -0.4739238,0.00194 -0.7250132,-0.00146 -0.84375,0 -0.019789,2.431e-4 -0.019067,4.89e-5 -0.03125,0 l 0,-0.3125 z m 0,0.40625 c 0.012304,4.54e-5 0.011551,2.42e-4 0.03125,0 0.118191,-0.00145 0.3699627,0.00194 0.84375,0 0.1206817,-4.942e-4 0.6906117,2.665e-4 0.84375,0 1.124e-4,0.018914 -1.271e-4,0.1071585 0,0.125 6.353e-4,0.089208 1.048e-4,0.091337 0,0.15625 -0.1531523,2.662e-4 -0.7236003,-4.918e-4 -0.84375,0 -0.4739239,0.00194 -0.6937632,0.029791 -0.8125,0.03125 -0.029684,3.646e-4 -0.04059,1.462e-4 -0.0625,0 l 0,-0.3125 z M 5,9.3085938 C 4.9995442,9.3878171 4.999221,9.5260469 5,9.5625 5.0008143,9.600635 5.030731,9.61458 5.03125,9.625 l -1.75,0 0,-0.3125 c 0.02208,1.419e-4 0.032952,3.63e-4 0.0625,0 0.118191,-0.00145 0.3387126,0.00194 0.8125,0 C 4.2763651,9.3120082 4.8468647,9.3097369 5,9.3085938 Z m 1.25,0.7226562 -3.125,0.03125 0,0.09375 3.125,-0.03125 0,-0.09375 z M 3.125,10.25 l 0,0.125 3.125,-0.03125 0,-0.09375 -3.125,0 z m 3.125,0.1875 -3.125,0.03125 0,0.09375 3.125,-0.03125 0,-0.09375 z m 0,0.1875 -3.125,0.03125 0,0.09375 3.125,-0.03125 0,-0.09375 z m 0,0.1875 -3.125,0.03125 0,0.09375 3.125,-0.03125 0,-0.09375 z M 6.25,11 3.125,11.03125 3.125,11.125 6.25,11.09375 6.25,11 Z m 0,0.21875 -3.125,0.03125 0,0.09375 3.125,-0.03125 0,-0.09375 z m 0,0.1875 -3.125,0.03125 0,0.09375 L 6.25,11.5 l 0,-0.09375 z m 0,0.1875 -3.125,0.03125 0,0.09375 3.125,-0.03125 0,-0.09375 z m 0,0.1875 -3.125,0.03125 0,0.09375 3.125,-0.03125 0,-0.09375 z"/></svg>\ No newline at end of filediff --git a/webui/public/task_scheduler.svg b/webui/public/task_scheduler.svgnew file mode 100644index 000000000..089188ae1--- /dev/null+++ b/webui/public/task_scheduler.svg@@ -0,0 +1,2 @@+<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->+<svg fill="#000000" width="800px" height="800px" viewBox="0 0 14 14" role="img" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="m 8.9994537,13.238438 c -0.0393,-0.07725 -0.213095,-0.409163 -0.386333,-0.73767 -0.173254,-0.328507 -0.307642,-0.604662 -0.298641,-0.613662 0.01605,-0.01605 1.642563,0.0489 1.659979,0.0663 0.0045,0.0045 -0.0489,0.0984 -0.119703,0.207904 -0.07065,0.109352 -0.119552,0.208039 -0.108452,0.219125 0.048,0.04815 0.6568033,0.04065 0.8887233,-0.0105 0.277896,-0.0618 0.671129,-0.24986 0.858978,-0.410738 0.147453,-0.126303 0.169323,-0.134553 0.169323,-0.06375 0,0.153783 0.187939,0.329766 0.355072,0.332482 0.06615,0.0011 0.0612,0.012 -0.05385,0.111902 -0.589122,0.51418 -1.481475,0.774016 -2.2191153,0.646153 -0.104552,-0.01815 -0.233,-0.0402 -0.285306,-0.04905 -0.08625,-0.015 -0.103352,-0.0015 -0.184084,0.136203 -0.0489,0.0837 -0.115052,0.186829 -0.147003,0.229159 l -0.05805,0.07695 -0.0714,-0.140403 z m -1.176609,-1.49553 c -0.148053,-0.23828 -0.246275,-0.45739 -0.333127,-0.743266 -0.07455,-0.2453 -0.08505,-0.335046 -0.087,-0.738884 -0.0015,-0.3858833 0.009,-0.4993003 0.06885,-0.7065743 0.178369,-0.6201433 0.520046,-1.1357488 0.984591,-1.485736 0.09885,-0.074402 0.182598,-0.1365028 0.186198,-0.1378528 0.003,-0.00136 -0.0282,-0.1152023 -0.07065,-0.2528151 -0.04245,-0.1377028 -0.07035,-0.2572553 -0.0618,-0.2657005 0.0252,-0.025201 1.6001573,0.3539173 1.6001573,0.3852529 0,0.0159 -0.2377693,0.2806257 -0.5283853,0.588312 -0.290616,0.3077013 -0.545817,0.5787568 -0.567102,0.6023373 -0.0312,0.034651 -0.0525,-0.003 -0.110252,-0.1981391 -0.0393,-0.1326027 -0.07755,-0.2410249 -0.0849,-0.2410249 -0.048,0 -0.254751,0.197044 -0.378428,0.3606674 -0.337462,0.4464695 -0.472105,0.8850038 -0.447444,1.4573551 0.012,0.290466 0.0321,0.399008 0.110102,0.608262 0.0522,0.140103 0.132603,0.314571 0.178849,0.387713 0.103052,0.163218 0.103052,0.165963 0.003,0.165963 -0.137253,0 -0.268371,0.09015 -0.325477,0.223925 l -0.0534,0.124952 -0.08385,-0.134852 z m 4.1891653,0.0771 c 0,-0.0171 -0.0357,-0.370687 -0.0792,-0.785731 -0.04365,-0.415058 -0.0792,-0.779415 -0.0792,-0.809671 0,-0.04755 0.0315,-0.04035 0.22985,0.0516 l 0.229834,0.106652 0.009,-0.141603 C 12.339844,9.9851577 12.245794,9.6008647 12.086532,9.2786274 11.876977,8.8544788 11.547031,8.524592 11.123077,8.3152928 10.957819,8.2336911 10.737014,8.1511594 10.632387,8.131839 10.341051,8.0779879 10.349856,8.083988 10.423958,7.9897861 c 0.078,-0.099152 0.0852,-0.2624603 0.0174,-0.393668 -0.0468,-0.090302 -0.0459,-0.093452 0.02385,-0.093302 0.146703,4.5e-4 0.606552,0.1299026 0.832742,0.2344098 0.303996,0.1404028 0.490315,0.2695405 0.75669,0.5242607 0.570477,0.5455311 0.847562,1.1963501 0.856293,2.0112414 l 0.0045,0.376643 0.243575,0.114752 0.243575,0.114752 -0.664484,0.475525 c -0.690194,0.493915 -0.72615,0.516985 -0.72615,0.465564 z M 2.1445312,0.99804688 A 0.3678473,0.3678473 0 0 0 2.125,1 0.3678473,0.3678473 0 0 0 1.84375,1.375 l 0,11.25 A 0.3678473,0.3678473 0 0 0 2.21875,13 l 4.3359375,0 0,-0.75 -3.9609375,0 0,-10.53125 8.8125,0 0,4.8066406 0.75,0 0,-5.1503906 A 0.3678473,0.3678473 0 0 0 11.78125,1 l -9.5625,0 a 0.3678473,0.3678473 0 0 0 -0.074219,-0.001953 z M 11.125,1.9375 9.1875,1.96875 l 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 0,0.21875 -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 0,0.1875 -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 0,0.1875 -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 0,0.1875 -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z M 5.15625,2.875 l -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 2.875,0 L 6.125,2.90625 6.125,3 8.03125,2.96875 l 0,-0.09375 z m -2.875,0.21875 -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 2.875,0 L 6.125,3.125 l 0,0.09375 1.90625,-0.03125 0,-0.09375 z m -2.875,0.1875 -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 2.875,0 -1.90625,0.03125 0,0.09375 1.90625,-0.03125 0,-0.09375 z m -2.875,0.1875 -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 2.875,0 L 6.125,3.5 l 0,0.09375 1.90625,-0.03125 0,-0.09375 z m -2.875,0.1875 -1.9375,0.03125 0,0.09375 1.9375,-0.03125 0,-0.09375 z m 2.875,0 -1.90625,0.03125 0,0.09375 1.90625,-0.03125 0,-0.09375 z m -4.96875,0.9375 0,0.125 0,5.03125 0,0.09375 0.125,0 3.3671875,0 0,-0.21875 -1.4296875,0 c -4.249e-4,-0.00853 8.041e-4,-0.024839 0,-0.0625 -7.696e-4,-0.036006 -0.00862,-0.1745288 -0.015625,-0.2539062 0.2701075,-0.00208 1.0622819,-0.00278 1.4453125,-0.00586 l 0,-0.1152344 c -0.3845771,-4.38e-5 -1.1803643,-4.158e-4 -1.4511719,0 -0.00371,-0.065008 -0.00913,-0.067093 -0.00977,-0.15625 -1.268e-4,-0.017828 1.122e-4,-0.106098 0,-0.125 0.2718265,-4.227e-4 1.0741495,-4.7e-5 1.4609375,0 l 0,-0.09375 c -0.3867797,-4.7e-5 -1.1890846,-4.227e-4 -1.4609375,0 -2.542e-4,-0.049319 1.733e-4,-0.2559925 0,-0.3125 0.2673701,-4.484e-4 1.0794915,-3.2e-5 1.4609375,0 l 0,-0.09375 c -0.3814388,-3.2e-5 -1.193539,-4.484e-4 -1.4609375,0 -1.359e-4,-0.052881 8.09e-5,-0.2220683 0,-0.28125 0.2673701,-4.484e-4 1.0794915,-3.2e-5 1.4609375,0 l 0,-0.1035156 c -0.381437,0.00311 -1.19354,0.00383 -1.4609375,0.00586 -7.05e-5,-0.068278 1.55e-5,-0.2358458 0,-0.3125 0.2673692,-0.00203 1.0794932,-0.00275 1.4609375,-0.00586 l 0,-0.1152344 c -0.3814388,-3.2e-5 -1.193539,-4.484e-4 -1.4609375,0 3.1e-6,-0.080027 -4.39e-5,-0.2234405 0,-0.3125 0.2695936,-4.355e-4 1.0768252,-3.96e-5 1.4609375,0 l 0,-0.09375 c -0.3841045,-3.96e-5 -1.1913165,-4.355e-4 -1.4609375,0 5.48e-5,-0.09301 -8.28e-5,-0.2135038 0,-0.3164062 0.2673692,-0.00203 1.0794932,-0.00275 1.4609375,-0.00586 l 0,-0.1152344 c -0.3814388,-3.2e-5 -1.193539,-4.484e-4 -1.4609375,0 9.86e-5,-0.1160496 -1.137e-4,-0.2151978 0,-0.34375 0.3979705,-6.423e-4 1.4981572,-2.581e-4 2.15625,0 -3.95e-5,0.04455 3.82e-5,0.076117 0,0.1191406 l 0.09375,0 c 3.81e-5,-0.043028 -3.94e-5,-0.074586 0,-0.1191406 0.4569181,1.902e-4 0.8659677,-2.833e-4 1.46875,0 -3.87e-5,0.044384 3.74e-5,0.076277 0,0.1191406 l 0.1054688,0 c -3.809e-4,-0.042866 3.698e-4,-0.074754 0,-0.1191406 0.7658707,3.498e-4 0.8031403,-2.94e-5 1.8320312,0 l 0,0.1191406 0.21875,0 0,-1.8066406 0,-0.125 -0.125,0 -7.65625,0 -0.125,0 z M 3.28125,4.8125 5,4.8125 c -3.7e-6,0.1416371 3.03e-5,0.1165691 0,0.25 -0.1462573,2.639e-4 -0.6962545,-4.758e-4 -0.8125,0 -0.4739238,0.00194 -0.7250132,-0.00146 -0.84375,0 -0.039579,4.862e-4 -0.047915,1.621e-4 -0.0625,0 l 0,-0.25 z m 1.8125,0 2.15625,0 c -3.7e-6,0.1416371 3.03e-5,0.1165691 0,0.25 -0.6580745,-2.627e-4 -1.7583068,-6.427e-4 -2.15625,0 3.02e-5,-0.133429 -3.7e-6,-0.1083692 0,-0.25 z m 2.25,0 1.46875,0 c -7.1e-6,0.1414487 3.22e-5,0.1168235 0,0.25 -0.6050101,-2.842e-4 -1.0117629,1.933e-4 -1.46875,0 3.02e-5,-0.133429 -3.7e-6,-0.1083692 0,-0.25 z m 1.5625,0 1.84375,0 0,0.25 c -1.0439245,-2.01e-5 -1.0701095,3.527e-4 -1.8417969,0 -2.113e-4,-0.1331757 -0.00191,-0.1085562 -0.00195,-0.25 z m -5.625,0.34375 c 0.014645,1.613e-4 0.023103,4.84e-4 0.0625,0 0.118191,-0.00145 0.3699627,0.00194 0.84375,0 0.116212,-4.758e-4 0.6662595,2.639e-4 0.8125,0 -5.29e-5,0.1772845 8.69e-5,0.177026 0,0.3398438 C 4.8468448,5.4972449 4.2769664,5.4995057 4.15625,5.5 3.6823262,5.50194 3.4312368,5.49854 3.3125,5.5 c -0.019789,2.431e-4 -0.019067,4.89e-5 -0.03125,0 l 0,-0.34375 z m 1.8125,0 c 0.3979028,-6.427e-4 1.4981507,-2.627e-4 2.15625,0 -5.14e-5,0.1721901 8.36e-5,0.1715435 0,0.3300781 -0.6623331,0.00479 -1.7550131,0.00667 -2.15625,0.00977 8.67e-5,-0.1628235 -5.28e-5,-0.1625599 0,-0.3398438 z m 2.25,0 c 0.4570048,1.933e-4 0.8637209,-2.842e-4 1.46875,0 -5.2e-5,0.1677598 8.11e-5,0.1676002 0,0.3222656 -0.608386,0.00261 -1.0088341,0.0026 -1.46875,0.00586 8.28e-5,-0.1576805 -5.09e-5,-0.1569543 0,-0.328125 z m 1.5664062,0 c 0.7711585,3.523e-4 0.7970432,-2e-5 1.8398438,0 l 0,0.3125 c -1.0466803,7.13e-5 -1.0630407,0.0066 -1.8378906,0.00977 C 8.9115346,5.3238465 8.9105029,5.3240081 8.9101562,5.15625 Z M 3.28125,5.59375 c 0.012304,4.54e-5 0.011551,2.42e-4 0.03125,0 0.118191,-0.00145 0.3699627,0.00194 0.84375,0 0.1206817,-4.942e-4 0.6906117,2.665e-4 0.84375,0 -8.66e-5,0.1459986 1.014e-4,0.1780905 0,0.3125 -0.1531523,2.662e-4 -0.7236003,-4.918e-4 -0.84375,0 -0.4739238,0.00194 -0.6937632,-0.00146 -0.8125,0 -0.029684,3.646e-4 -0.04059,1.462e-4 -0.0625,0 l 0,-0.3125 z m 1.8125,0 c 0.4011985,-6.239e-4 1.4938905,-2.699e-4 2.15625,0 -8.66e-5,0.1459987 1.014e-4,0.1780905 0,0.3125 -0.6622889,-2.653e-4 -1.7549089,-6.236e-4 -2.15625,0 1.012e-4,-0.1344194 -8.64e-5,-0.1664948 0,-0.3125 z m 2.25,0 c 0.4599352,1.979e-4 0.8603429,-2.834e-4 1.46875,0 -8.61e-5,0.1455683 9.99e-5,0.1785471 0,0.3125 -0.6060777,-2.826e-4 -1.0089482,1.948e-4 -1.46875,0 1.012e-4,-0.1344194 -8.64e-5,-0.1664948 0,-0.3125 z m 1.5683594,0 c 0.7748709,3.503e-4 0.7912313,-1.01e-5 1.8378906,0 l 0,0.3125 c -1.0359246,-1.98e-5 -1.0647996,3.493e-4 -1.8359375,0 -7.889e-4,-0.1339616 -0.00133,-0.1669262 -0.00195,-0.3125 z M 3.28125,6 c 0.02208,1.419e-4 0.032952,3.63e-4 0.0625,0 C 3.461941,5.99855 3.6824627,6.00194 4.15625,6 4.2763651,5.9995082 4.8468646,6.0002662 5,6 c -1.038e-4,0.1310253 1.052e-4,0.1924473 0,0.3125 -0.1462397,2.635e-4 -0.6968003,-4.736e-4 -0.8125,0 -0.4739238,0.00194 -0.6937632,-0.00146 -0.8125,0 -0.059368,7.293e-4 -0.078397,-4.401e-4 -0.09375,0 l 0,-0.3125 z m 1.8125,0 C 5.4950521,5.9993764 6.5876862,5.9997347 7.25,6 c -1.038e-4,0.1310253 1.052e-4,0.1924473 0,0.3125 -0.6580683,-2.581e-4 -1.7582391,-6.423e-4 -2.15625,0 1.049e-4,-0.1200647 -1.036e-4,-0.1814642 0,-0.3125 z m 2.25,0 c 0.4598196,1.948e-4 0.8626535,-2.826e-4 1.46875,0 -1.021e-4,0.1305665 1.031e-4,0.1928939 0,0.3125 -0.6027633,-2.833e-4 -1.0118495,1.902e-4 -1.46875,0 1.049e-4,-0.1200647 -1.036e-4,-0.1814642 0,-0.3125 z M 8.9160156,6 C 9.686617,6.0003488 9.7151941,5.9999802 10.75,6 l 0,0.3125 c -1.0289065,-2.94e-5 -1.0661833,3.498e-4 -1.8320312,0 C 8.9170253,6.1928833 8.9168459,6.1305756 8.9160156,6 Z M 4.1875,6.40625 C 4.3031664,6.4057764 4.8537771,6.4065135 5,6.40625 4.999886,6.5347888 5.0000988,6.6339632 5,6.75 4.8605412,6.7502608 4.3305245,6.7495425 4.21875,6.75 3.7448262,6.75194 3.4937368,6.74854 3.375,6.75 3.315632,6.7507293 3.296603,6.78081 3.28125,6.78125 l 0,-0.34375 c 0.014263,-4.088e-4 0.034654,7.26e-4 0.09375,0 C 3.493191,6.43605 3.7137127,6.40819 4.1875,6.40625 Z M 5,6.8710938 c -8.3e-5,0.1028911 5.49e-5,0.2234053 0,0.3164062 -0.1462573,2.639e-4 -0.6962545,-4.758e-4 -0.8125,0 -0.4739238,0.00194 -0.6937632,-0.00146 -0.8125,0 -0.044526,5.47e-4 -0.070349,1.09e-4 -0.09375,0 l 0,-0.3125 c 0.014263,-4.088e-4 0.034654,7.26e-4 0.09375,0 0.118191,-0.00145 0.3699627,0.00194 0.84375,0 C 4.3304924,6.8745425 4.8605578,6.8721212 5,6.8710938 Z M 3.375,7.28125 c 0.118191,-0.00145 0.3387126,0.00194 0.8125,0 0.116212,-4.758e-4 0.6662596,2.639e-4 0.8125,0 -4.4e-5,0.089052 3.1e-6,0.2324761 0,0.3125 -0.1394588,2.608e-4 -0.6694755,-4.575e-4 -0.78125,0 -0.4739238,0.00194 -0.7250132,0.029791 -0.84375,0.03125 -0.059368,7.293e-4 -0.078397,-4.401e-4 -0.09375,0 l 0,-0.3203125 C 3.3045614,7.2960111 3.330678,7.2817945 3.375,7.28125 Z M 5,7.7148438 c 1.55e-5,0.076653 -7.07e-5,0.2442168 0,0.3125 -0.139459,0.00103 -0.6694753,0.00345 -0.78125,0.00391 -0.4739239,0.00194 -0.7250132,-0.00146 -0.84375,0 -0.059368,7.293e-4 -0.078397,-4.401e-4 -0.09375,0 l 0,-0.3125 c 0.014263,-4.088e-4 0.034654,7.26e-4 0.09375,0 0.118191,-0.00145 0.3699627,0.00194 0.84375,0 C 4.3304924,7.7182925 4.8605578,7.7158712 5,7.7148438 Z M 3.28125,8.125 c 0.014263,-4.088e-4 0.034654,7.26e-4 0.09375,0 0.118191,-0.00145 0.3699626,0.00194 0.84375,0 0.1117423,-4.575e-4 0.641808,2.608e-4 0.78125,0 8.1e-5,0.059188 -1.363e-4,0.2283563 0,0.28125 -0.1394588,2.608e-4 -0.6694755,-4.575e-4 -0.78125,0 -0.4739239,0.00194 -0.7250132,-0.00146 -0.84375,0 -0.059368,7.293e-4 -0.078397,-4.401e-4 -0.09375,0 l 0,-0.28125 z m 0,0.375 c 0.014263,-4.088e-4 0.034654,7.26e-4 0.09375,0 0.118191,-0.00145 0.3699626,0.00194 0.84375,0 0.1117423,-4.575e-4 0.641808,2.608e-4 0.78125,0 1.737e-4,0.056525 -2.548e-4,0.2631535 0,0.3125 -0.1531552,2.665e-4 -0.7230335,-4.942e-4 -0.84375,0 -0.4739238,0.00194 -0.7250132,-0.00146 -0.84375,0 -0.019789,2.431e-4 -0.019067,4.89e-5 -0.03125,0 l 0,-0.3125 z m 0,0.40625 c 0.012304,4.54e-5 0.011551,2.42e-4 0.03125,0 0.118191,-0.00145 0.3699627,0.00194 0.84375,0 0.1206817,-4.942e-4 0.6906117,2.665e-4 0.84375,0 1.124e-4,0.018914 -1.271e-4,0.1071585 0,0.125 6.353e-4,0.089208 1.048e-4,0.091337 0,0.15625 -0.1531523,2.662e-4 -0.7236003,-4.918e-4 -0.84375,0 -0.4739239,0.00194 -0.6937632,0.029791 -0.8125,0.03125 -0.029684,3.646e-4 -0.04059,1.462e-4 -0.0625,0 l 0,-0.3125 z M 5,9.3085938 C 4.9995442,9.3878171 4.999221,9.5260469 5,9.5625 5.0008143,9.600635 5.030731,9.61458 5.03125,9.625 l -1.75,0 0,-0.3125 c 0.02208,1.419e-4 0.032952,3.63e-4 0.0625,0 0.118191,-0.00145 0.3387126,0.00194 0.8125,0 C 4.2763651,9.3120082 4.8468647,9.3097369 5,9.3085938 Z m 1.25,0.7226562 -3.125,0.03125 0,0.09375 3.125,-0.03125 0,-0.09375 z M 3.125,10.25 l 0,0.125 3.125,-0.03125 0,-0.09375 -3.125,0 z m 3.125,0.1875 -3.125,0.03125 0,0.09375 3.125,-0.03125 0,-0.09375 z m 0,0.1875 -3.125,0.03125 0,0.09375 3.125,-0.03125 0,-0.09375 z m 0,0.1875 -3.125,0.03125 0,0.09375 3.125,-0.03125 0,-0.09375 z M 6.25,11 3.125,11.03125 3.125,11.125 6.25,11.09375 6.25,11 Z m 0,0.21875 -3.125,0.03125 0,0.09375 3.125,-0.03125 0,-0.09375 z m 0,0.1875 -3.125,0.03125 0,0.09375 L 6.25,11.5 l 0,-0.09375 z m 0,0.1875 -3.125,0.03125 0,0.09375 3.125,-0.03125 0,-0.09375 z m 0,0.1875 -3.125,0.03125 0,0.09375 3.125,-0.03125 0,-0.09375 z"/></svg>\ No newline at end of file