Agent Zero AI framework
refactor - plugin names and builtin plugins
frdel6515626242fb
diff --git a/helpers/email_client.py b/helpers/email_client.pyindex 11adc5a9a..96744d6cc 100644--- a/helpers/email_client.py+++ b/helpers/email_client.py@@ -1,587 +1,587 @@-import asyncio-import email-import os-import re-import uuid-from dataclasses import dataclass-from email.header import decode_header-from email.message import Message as EmailMessage-from fnmatch import fnmatch-from typing import Any, Dict, List, Optional, Tuple--import html2text-from bs4 import BeautifulSoup-from imapclient import IMAPClient--from helpers import files-from helpers.errors import RepairableException, format_error-from helpers.print_style import PrintStyle---@dataclass-class Message:- """Email message representation with sender, subject, body, and attachments."""- sender: str- subject: str- body: str- attachments: List[str]---class EmailClient:- """- Async email client for reading messages from IMAP and Exchange servers.-- """-- def __init__(- self,- account_type: str = "imap",- server: str = "",- port: int = 993,- username: str = "",- password: str = "",- options: Optional[Dict[str, Any]] = None,- ):- """- Initialize email client with connection parameters.-- Args:- account_type: Type of account - "imap" or "exchange"- server: Mail server address (e.g., "imap.gmail.com")- port: Server port (default 993 for IMAP SSL)- username: Email account username- password: Email account password- options: Optional configuration dict with keys:- - ssl: Use SSL/TLS (default: True)- - timeout: Connection timeout in seconds (default: 30)- """- self.account_type = account_type.lower()- self.server = server- self.port = port- self.username = username- self.password = password- self.options = options or {}-- # Default options- self.ssl = self.options.get("ssl", True)- self.timeout = self.options.get("timeout", 30)-- self.client: Optional[IMAPClient] = None- self.exchange_account = None-- async def connect(self) -> None:- """Establish connection to email server."""- try:- if self.account_type == "imap":- await self._connect_imap()- elif self.account_type == "exchange":- await self._connect_exchange()- else:- raise RepairableException(- f"Unsupported account type: {self.account_type}. "- "Supported types: 'imap', 'exchange'"- )- except Exception as e:- err = format_error(e)- PrintStyle.error(f"Failed to connect to email server: {err}")- raise RepairableException(f"Email connection failed: {err}") from e-- async def _connect_imap(self) -> None:- """Establish IMAP connection."""- loop = asyncio.get_event_loop()-- def _sync_connect():- client = IMAPClient(self.server, port=self.port, ssl=self.ssl, timeout=self.timeout)- # Increase line length limit to handle large emails (default is 10000)- # This fixes "line too long" errors for emails with large headers or embedded content- client._imap._maxline = 100000- client.login(self.username, self.password)- return client-- self.client = await loop.run_in_executor(None, _sync_connect)- PrintStyle.standard(f"Connected to IMAP server: {self.server}")-- async def _connect_exchange(self) -> None:- """Establish Exchange connection."""- try:- from exchangelib import Account, Configuration, Credentials, DELEGATE-- loop = asyncio.get_event_loop()-- def _sync_connect():- creds = Credentials(username=self.username, password=self.password)- config = Configuration(server=self.server, credentials=creds)- return Account(- primary_smtp_address=self.username,- config=config,- autodiscover=False,- access_type=DELEGATE- )-- self.exchange_account = await loop.run_in_executor(None, _sync_connect)- PrintStyle.standard(f"Connected to Exchange server: {self.server}")- except ImportError as e:- raise RepairableException(- "exchangelib not installed. Install with: pip install exchangelib>=5.4.3"- ) from e-- async def disconnect(self) -> None:- """Clean up connection."""- try:- if self.client:- loop = asyncio.get_event_loop()- await loop.run_in_executor(None, self.client.logout)- self.client = None- PrintStyle.standard("Disconnected from IMAP server")- elif self.exchange_account:- self.exchange_account = None- PrintStyle.standard("Disconnected from Exchange server")- except Exception as e:- PrintStyle.error(f"Error during disconnect: {format_error(e)}")-- async def read_messages(- self,- download_folder: str,- filter: Optional[Dict[str, Any]] = None,- ) -> List[Message]:- """- Read messages based on filter criteria.-- Args:- download_folder: Folder to save attachments (relative to /a0/)- filter: Filter criteria dict with keys:- - unread: Boolean to filter unread messages (default: True)- - sender: Sender pattern with wildcards (e.g., "*@company.com")- - subject: Subject pattern with wildcards (e.g., "*invoice*")- - since_date: Optional datetime for date filtering-- Returns:- List of Message objects with attachments saved to download_folder- """- filter = filter or {}-- if self.account_type == "imap":- return await self._fetch_imap_messages(download_folder, filter)- elif self.account_type == "exchange":- return await self._fetch_exchange_messages(download_folder, filter)- else:- raise RepairableException(f"Unsupported account type: {self.account_type}")-- async def _fetch_imap_messages(- self,- download_folder: str,- filter: Dict[str, Any],- ) -> List[Message]:- """Fetch messages from IMAP server."""- if not self.client:- raise RepairableException("IMAP client not connected. Call connect() first.")-- loop = asyncio.get_event_loop()- messages: List[Message] = []-- def _sync_fetch():- # Select inbox- self.client.select_folder("INBOX")-- # Build search criteria- search_criteria = []- if filter.get("unread", True):- search_criteria.append("UNSEEN")-- if filter.get("since_date"):- since_date = filter["since_date"]- search_criteria.append(["SINCE", since_date])-- # Search for messages- if not search_criteria:- search_criteria = ["ALL"]-- message_ids = self.client.search(search_criteria)- return message_ids-- message_ids = await loop.run_in_executor(None, _sync_fetch)-- if not message_ids:- PrintStyle.hint("No messages found matching criteria")- return messages-- PrintStyle.standard(f"Found {len(message_ids)} messages")-- # Fetch and process messages- for msg_id in message_ids:- try:- msg = await self._fetch_and_parse_imap_message(msg_id, download_folder, filter)- if msg:- messages.append(msg)- except Exception as e:- PrintStyle.error(f"Error processing message {msg_id}: {format_error(e)}")- continue-- return messages-- async def _fetch_and_parse_imap_message(- self,- msg_id: int,- download_folder: str,- filter: Dict[str, Any],- ) -> Optional[Message]:- """Fetch and parse a single IMAP message with retry logic for large messages."""- loop = asyncio.get_event_loop()-- def _sync_fetch():- try:- # Try standard RFC822 fetch first- return self.client.fetch([msg_id], ["RFC822"])[msg_id]- except Exception as e:- error_msg = str(e).lower()- # If "line too long" error, try fetching in parts- if "line too long" in error_msg or "fetch_failed" in error_msg:- PrintStyle.warning(f"Message {msg_id} too large for standard fetch, trying alternative method")- # Fetch headers and body separately to avoid line length issues- try:- envelope = self.client.fetch([msg_id], ["BODY.PEEK[]"])[msg_id]- return envelope- except Exception as e2:- PrintStyle.error(f"Alternative fetch also failed for message {msg_id}: {format_error(e2)}")- raise- raise-- try:- raw_msg = await loop.run_in_executor(None, _sync_fetch)-- # Extract email data from response- if b"RFC822" in raw_msg:- email_data = raw_msg[b"RFC822"]- elif b"BODY[]" in raw_msg:- email_data = raw_msg[b"BODY[]"]- else:- PrintStyle.error(f"Unexpected response format for message {msg_id}")- return None-- email_msg = email.message_from_bytes(email_data)-- # Apply sender filter- sender = self._decode_header(email_msg.get("From", ""))- if filter.get("sender") and not fnmatch(sender, filter["sender"]):- return None-- # Apply subject filter- subject = self._decode_header(email_msg.get("Subject", ""))- if filter.get("subject") and not fnmatch(subject, filter["subject"]):- return None-- # Parse message- return await self._parse_message(email_msg, download_folder)-- except Exception as e:- PrintStyle.error(f"Failed to fetch/parse message {msg_id}: {format_error(e)}")- return None-- async def _fetch_exchange_messages(- self,- download_folder: str,- filter: Dict[str, Any],- ) -> List[Message]:- """Fetch messages from Exchange server."""- if not self.exchange_account:- raise RepairableException("Exchange account not connected. Call connect() first.")-- from exchangelib import Q-- loop = asyncio.get_event_loop()- messages: List[Message] = []-- def _sync_fetch():- # Build query- query = None- if filter.get("unread", True):- query = Q(is_read=False)-- if filter.get("sender"):- sender_pattern = filter["sender"].replace("*", "")- sender_q = Q(sender__contains=sender_pattern)- query = query & sender_q if query else sender_q-- if filter.get("subject"):- subject_pattern = filter["subject"].replace("*", "")- subject_q = Q(subject__contains=subject_pattern)- query = query & subject_q if query else subject_q-- # Fetch messages from inbox- inbox = self.exchange_account.inbox- items = inbox.filter(query) if query else inbox.all()- return list(items)-- exchange_messages = await loop.run_in_executor(None, _sync_fetch)-- PrintStyle.standard(f"Found {len(exchange_messages)} Exchange messages")-- # Process messages- for ex_msg in exchange_messages:- try:- msg = await self._parse_exchange_message(ex_msg, download_folder)- if msg:- messages.append(msg)- except Exception as e:- PrintStyle.error(f"Error processing Exchange message: {format_error(e)}")- continue-- return messages-- async def _parse_exchange_message(- self,- ex_msg,- download_folder: str,- ) -> Message:- """Parse an Exchange message."""- loop = asyncio.get_event_loop()-- def _get_body():- return str(ex_msg.text_body or ex_msg.body or "")-- body = await loop.run_in_executor(None, _get_body)-- # Process HTML if present- if ex_msg.body and str(ex_msg.body).strip().startswith("<"):- body = self._html_to_text(str(ex_msg.body))-- # Save attachments- attachment_paths = []- if ex_msg.attachments:- for attachment in ex_msg.attachments:- if hasattr(attachment, "content"):- path = await self._save_attachment_bytes(- attachment.name,- attachment.content,- download_folder- )- attachment_paths.append(path)-- return Message(- sender=str(ex_msg.sender.email_address) if ex_msg.sender else "",- subject=str(ex_msg.subject or ""),- body=body,- attachments=attachment_paths- )-- async def _parse_message(- self,- email_msg: EmailMessage,- download_folder: str,- ) -> Message:- """- Parse email message and extract content with inline attachments.-- Processes multipart messages, converts HTML to text, and maintains- positional context for inline attachments.- """- sender = self._decode_header(email_msg.get("From", ""))- subject = self._decode_header(email_msg.get("Subject", ""))-- # Extract body and attachments- body = ""- attachment_paths: List[str] = []- cid_map: Dict[str, str] = {} # Map Content-ID to file paths- body_parts: List[str] = [] # Track parts in order-- if email_msg.is_multipart():- # Process parts in order to maintain attachment positions- for part in email_msg.walk():- content_type = part.get_content_type()- content_disposition = str(part.get("Content-Disposition", ""))-- # Skip multipart containers- if part.get_content_maintype() == "multipart":- continue-- # Handle attachments- if "attachment" in content_disposition or part.get("Content-ID"):- filename = part.get_filename()- if filename:- filename = self._decode_header(filename)- content = part.get_payload(decode=True)- if content:- path = await self._save_attachment_bytes(- filename, content, download_folder- )- attachment_paths.append(path)-- # Map Content-ID for inline images- cid = part.get("Content-ID")- if cid:- cid = cid.strip("<>")- cid_map[cid] = path-- # Add positional marker for non-cid attachments- # (cid attachments are positioned via HTML references)- if not cid and body_parts:- body_parts.append(f"\n[file://{path}]\n")-- # Handle body text- elif content_type == "text/plain":- if not body: # Use first text/plain as primary body- charset = part.get_content_charset() or "utf-8"- body = part.get_payload(decode=True).decode(charset, errors="ignore")- body_parts.append(body)-- elif content_type == "text/html":- if not body: # Use first text/html as primary body if no text/plain- charset = part.get_content_charset() or "utf-8"- html_content = part.get_payload(decode=True).decode(charset, errors="ignore")- body = self._html_to_text(html_content, cid_map)- body_parts.append(body)-- # Combine body parts if we built them up- if len(body_parts) > 1:- body = "".join(body_parts)- else:- # Single part message- content_type = email_msg.get_content_type()- charset = email_msg.get_content_charset() or "utf-8"- content = email_msg.get_payload(decode=True)- if content:- if content_type == "text/html":- body = self._html_to_text(content.decode(charset, errors="ignore"), cid_map)- else:- body = content.decode(charset, errors="ignore")-- return Message(- sender=sender,- subject=subject,- body=body,- attachments=attachment_paths- )-- def _html_to_text(self, html_content: str, cid_map: Optional[Dict[str, str]] = None) -> str:- """- Convert HTML to plain text with inline attachment references.-- Replaces inline images with [file:///a0/...] markers to maintain- positional context.- """- cid_map = cid_map or {}-- # Replace cid: references with file paths before conversion- if cid_map:- soup = BeautifulSoup(html_content, "html.parser")- for img in soup.find_all("img"):- src = img.get("src", "")- if src.startswith("cid:"):- cid = src[4:] # Remove "cid:" prefix- if cid in cid_map:- # Replace with file path marker- file_marker = f"[file://{cid_map[cid]}]"- img.replace_with(soup.new_string(file_marker))- html_content = str(soup)-- # Convert HTML to text- h = html2text.HTML2Text()- h.ignore_links = False- h.ignore_images = False- h.ignore_emphasis = False- h.body_width = 0 # Don't wrap lines-- text = h.handle(html_content)-- # Clean up extra whitespace- text = re.sub(r"\n{3,}", "\n\n", text) # Max 2 consecutive newlines- text = text.strip()-- return text-- async def _save_attachment_bytes(- self,- filename: str,- content: bytes,- download_folder: str,- ) -> str:- """- Save attachment to disk and return absolute path.-- Uses Agent Zero's file helpers for path management.- """- # Sanitize filename- filename = files.safe_file_name(filename)-- # Generate unique filename if needed- unique_id = uuid.uuid4().hex[:8]- name, ext = os.path.splitext(filename)- unique_filename = f"{name}_{unique_id}{ext}"-- # Build relative path and save- relative_path = os.path.join(download_folder, unique_filename)- files.write_file_bin(relative_path, content)-- # Return absolute path- abs_path = files.get_abs_path(relative_path)- return abs_path-- def _decode_header(self, header: str) -> str:- """Decode email header handling various encodings."""- if not header:- return ""-- decoded_parts = []- for part, encoding in decode_header(header):- if isinstance(part, bytes):- decoded_parts.append(part.decode(encoding or "utf-8", errors="ignore"))- else:- decoded_parts.append(str(part))-- return " ".join(decoded_parts)---async def read_messages(- account_type: str = "imap",- server: str = "",- port: int = 993,- username: str = "",- password: str = "",- download_folder: str = "usr/email",- options: Optional[Dict[str, Any]] = None,- filter: Optional[Dict[str, Any]] = None,-) -> List[Message]:- """- Convenience wrapper for reading email messages.-- Automatically handles connection and disconnection.-- Args:- account_type: "imap" or "exchange"- server: Mail server address- port: Server port (default 993 for IMAP SSL)- username: Email username- password: Email password- download_folder: Folder to save attachments (relative to /a0/)- options: Optional configuration dict- filter: Filter criteria dict-- Returns:- List of Message objects-- Example:- from helpers.email_client import read_messages- messages = await read_messages(- server="imap.gmail.com",- port=993,- username=secrets.get("EMAIL_USER"),- password=secrets.get("EMAIL_PASSWORD"),- download_folder="tmp/email/inbox",- filter={"unread": True, "sender": "*@company.com"}- )- """- client = EmailClient(- account_type=account_type,- server=server,- port=port,- username=username,- password=password,- options=options,- )-- try:- await client.connect()- messages = await client.read_messages(download_folder, filter)- return messages- finally:- await client.disconnect()+# import asyncio+# import email+# import os+# import re+# import uuid+# from dataclasses import dataclass+# from email.header import decode_header+# from email.message import Message as EmailMessage+# from fnmatch import fnmatch+# from typing import Any, Dict, List, Optional, Tuple++# import html2text+# from bs4 import BeautifulSoup+# from imapclient import IMAPClient++# from helpers import files+# from helpers.errors import RepairableException, format_error+# from helpers.print_style import PrintStyle+++# @dataclass+# class Message:+# """Email message representation with sender, subject, body, and attachments."""+# sender: str+# subject: str+# body: str+# attachments: List[str]+++# class EmailClient:+# """+# Async email client for reading messages from IMAP and Exchange servers.++# """++# def __init__(+# self,+# account_type: str = "imap",+# server: str = "",+# port: int = 993,+# username: str = "",+# password: str = "",+# options: Optional[Dict[str, Any]] = None,+# ):+# """+# Initialize email client with connection parameters.++# Args:+# account_type: Type of account - "imap" or "exchange"+# server: Mail server address (e.g., "imap.gmail.com")+# port: Server port (default 993 for IMAP SSL)+# username: Email account username+# password: Email account password+# options: Optional configuration dict with keys:+# - ssl: Use SSL/TLS (default: True)+# - timeout: Connection timeout in seconds (default: 30)+# """+# self.account_type = account_type.lower()+# self.server = server+# self.port = port+# self.username = username+# self.password = password+# self.options = options or {}++# # Default options+# self.ssl = self.options.get("ssl", True)+# self.timeout = self.options.get("timeout", 30)++# self.client: Optional[IMAPClient] = None+# self.exchange_account = None++# async def connect(self) -> None:+# """Establish connection to email server."""+# try:+# if self.account_type == "imap":+# await self._connect_imap()+# elif self.account_type == "exchange":+# await self._connect_exchange()+# else:+# raise RepairableException(+# f"Unsupported account type: {self.account_type}. "+# "Supported types: 'imap', 'exchange'"+# )+# except Exception as e:+# err = format_error(e)+# PrintStyle.error(f"Failed to connect to email server: {err}")+# raise RepairableException(f"Email connection failed: {err}") from e++# async def _connect_imap(self) -> None:+# """Establish IMAP connection."""+# loop = asyncio.get_event_loop()++# def _sync_connect():+# client = IMAPClient(self.server, port=self.port, ssl=self.ssl, timeout=self.timeout)+# # Increase line length limit to handle large emails (default is 10000)+# # This fixes "line too long" errors for emails with large headers or embedded content+# client._imap._maxline = 100000+# client.login(self.username, self.password)+# return client++# self.client = await loop.run_in_executor(None, _sync_connect)+# PrintStyle.standard(f"Connected to IMAP server: {self.server}")++# async def _connect_exchange(self) -> None:+# """Establish Exchange connection."""+# try:+# from exchangelib import Account, Configuration, Credentials, DELEGATE++# loop = asyncio.get_event_loop()++# def _sync_connect():+# creds = Credentials(username=self.username, password=self.password)+# config = Configuration(server=self.server, credentials=creds)+# return Account(+# primary_smtp_address=self.username,+# config=config,+# autodiscover=False,+# access_type=DELEGATE+# )++# self.exchange_account = await loop.run_in_executor(None, _sync_connect)+# PrintStyle.standard(f"Connected to Exchange server: {self.server}")+# except ImportError as e:+# raise RepairableException(+# "exchangelib not installed. Install with: pip install exchangelib>=5.4.3"+# ) from e++# async def disconnect(self) -> None:+# """Clean up connection."""+# try:+# if self.client:+# loop = asyncio.get_event_loop()+# await loop.run_in_executor(None, self.client.logout)+# self.client = None+# PrintStyle.standard("Disconnected from IMAP server")+# elif self.exchange_account:+# self.exchange_account = None+# PrintStyle.standard("Disconnected from Exchange server")+# except Exception as e:+# PrintStyle.error(f"Error during disconnect: {format_error(e)}")++# async def read_messages(+# self,+# download_folder: str,+# filter: Optional[Dict[str, Any]] = None,+# ) -> List[Message]:+# """+# Read messages based on filter criteria.++# Args:+# download_folder: Folder to save attachments (relative to /a0/)+# filter: Filter criteria dict with keys:+# - unread: Boolean to filter unread messages (default: True)+# - sender: Sender pattern with wildcards (e.g., "*@company.com")+# - subject: Subject pattern with wildcards (e.g., "*invoice*")+# - since_date: Optional datetime for date filtering++# Returns:+# List of Message objects with attachments saved to download_folder+# """+# filter = filter or {}++# if self.account_type == "imap":+# return await self._fetch_imap_messages(download_folder, filter)+# elif self.account_type == "exchange":+# return await self._fetch_exchange_messages(download_folder, filter)+# else:+# raise RepairableException(f"Unsupported account type: {self.account_type}")++# async def _fetch_imap_messages(+# self,+# download_folder: str,+# filter: Dict[str, Any],+# ) -> List[Message]:+# """Fetch messages from IMAP server."""+# if not self.client:+# raise RepairableException("IMAP client not connected. Call connect() first.")++# loop = asyncio.get_event_loop()+# messages: List[Message] = []++# def _sync_fetch():+# # Select inbox+# self.client.select_folder("INBOX")++# # Build search criteria+# search_criteria = []+# if filter.get("unread", True):+# search_criteria.append("UNSEEN")++# if filter.get("since_date"):+# since_date = filter["since_date"]+# search_criteria.append(["SINCE", since_date])++# # Search for messages+# if not search_criteria:+# search_criteria = ["ALL"]++# message_ids = self.client.search(search_criteria)+# return message_ids++# message_ids = await loop.run_in_executor(None, _sync_fetch)++# if not message_ids:+# PrintStyle.hint("No messages found matching criteria")+# return messages++# PrintStyle.standard(f"Found {len(message_ids)} messages")++# # Fetch and process messages+# for msg_id in message_ids:+# try:+# msg = await self._fetch_and_parse_imap_message(msg_id, download_folder, filter)+# if msg:+# messages.append(msg)+# except Exception as e:+# PrintStyle.error(f"Error processing message {msg_id}: {format_error(e)}")+# continue++# return messages++# async def _fetch_and_parse_imap_message(+# self,+# msg_id: int,+# download_folder: str,+# filter: Dict[str, Any],+# ) -> Optional[Message]:+# """Fetch and parse a single IMAP message with retry logic for large messages."""+# loop = asyncio.get_event_loop()++# def _sync_fetch():+# try:+# # Try standard RFC822 fetch first+# return self.client.fetch([msg_id], ["RFC822"])[msg_id]+# except Exception as e:+# error_msg = str(e).lower()+# # If "line too long" error, try fetching in parts+# if "line too long" in error_msg or "fetch_failed" in error_msg:+# PrintStyle.warning(f"Message {msg_id} too large for standard fetch, trying alternative method")+# # Fetch headers and body separately to avoid line length issues+# try:+# envelope = self.client.fetch([msg_id], ["BODY.PEEK[]"])[msg_id]+# return envelope+# except Exception as e2:+# PrintStyle.error(f"Alternative fetch also failed for message {msg_id}: {format_error(e2)}")+# raise+# raise++# try:+# raw_msg = await loop.run_in_executor(None, _sync_fetch)++# # Extract email data from response+# if b"RFC822" in raw_msg:+# email_data = raw_msg[b"RFC822"]+# elif b"BODY[]" in raw_msg:+# email_data = raw_msg[b"BODY[]"]+# else:+# PrintStyle.error(f"Unexpected response format for message {msg_id}")+# return None++# email_msg = email.message_from_bytes(email_data)++# # Apply sender filter+# sender = self._decode_header(email_msg.get("From", ""))+# if filter.get("sender") and not fnmatch(sender, filter["sender"]):+# return None++# # Apply subject filter+# subject = self._decode_header(email_msg.get("Subject", ""))+# if filter.get("subject") and not fnmatch(subject, filter["subject"]):+# return None++# # Parse message+# return await self._parse_message(email_msg, download_folder)++# except Exception as e:+# PrintStyle.error(f"Failed to fetch/parse message {msg_id}: {format_error(e)}")+# return None++# async def _fetch_exchange_messages(+# self,+# download_folder: str,+# filter: Dict[str, Any],+# ) -> List[Message]:+# """Fetch messages from Exchange server."""+# if not self.exchange_account:+# raise RepairableException("Exchange account not connected. Call connect() first.")++# from exchangelib import Q++# loop = asyncio.get_event_loop()+# messages: List[Message] = []++# def _sync_fetch():+# # Build query+# query = None+# if filter.get("unread", True):+# query = Q(is_read=False)++# if filter.get("sender"):+# sender_pattern = filter["sender"].replace("*", "")+# sender_q = Q(sender__contains=sender_pattern)+# query = query & sender_q if query else sender_q++# if filter.get("subject"):+# subject_pattern = filter["subject"].replace("*", "")+# subject_q = Q(subject__contains=subject_pattern)+# query = query & subject_q if query else subject_q++# # Fetch messages from inbox+# inbox = self.exchange_account.inbox+# items = inbox.filter(query) if query else inbox.all()+# return list(items)++# exchange_messages = await loop.run_in_executor(None, _sync_fetch)++# PrintStyle.standard(f"Found {len(exchange_messages)} Exchange messages")++# # Process messages+# for ex_msg in exchange_messages:+# try:+# msg = await self._parse_exchange_message(ex_msg, download_folder)+# if msg:+# messages.append(msg)+# except Exception as e:+# PrintStyle.error(f"Error processing Exchange message: {format_error(e)}")+# continue++# return messages++# async def _parse_exchange_message(+# self,+# ex_msg,+# download_folder: str,+# ) -> Message:+# """Parse an Exchange message."""+# loop = asyncio.get_event_loop()++# def _get_body():+# return str(ex_msg.text_body or ex_msg.body or "")++# body = await loop.run_in_executor(None, _get_body)++# # Process HTML if present+# if ex_msg.body and str(ex_msg.body).strip().startswith("<"):+# body = self._html_to_text(str(ex_msg.body))++# # Save attachments+# attachment_paths = []+# if ex_msg.attachments:+# for attachment in ex_msg.attachments:+# if hasattr(attachment, "content"):+# path = await self._save_attachment_bytes(+# attachment.name,+# attachment.content,+# download_folder+# )+# attachment_paths.append(path)++# return Message(+# sender=str(ex_msg.sender.email_address) if ex_msg.sender else "",+# subject=str(ex_msg.subject or ""),+# body=body,+# attachments=attachment_paths+# )++# async def _parse_message(+# self,+# email_msg: EmailMessage,+# download_folder: str,+# ) -> Message:+# """+# Parse email message and extract content with inline attachments.++# Processes multipart messages, converts HTML to text, and maintains+# positional context for inline attachments.+# """+# sender = self._decode_header(email_msg.get("From", ""))+# subject = self._decode_header(email_msg.get("Subject", ""))++# # Extract body and attachments+# body = ""+# attachment_paths: List[str] = []+# cid_map: Dict[str, str] = {} # Map Content-ID to file paths+# body_parts: List[str] = [] # Track parts in order++# if email_msg.is_multipart():+# # Process parts in order to maintain attachment positions+# for part in email_msg.walk():+# content_type = part.get_content_type()+# content_disposition = str(part.get("Content-Disposition", ""))++# # Skip multipart containers+# if part.get_content_maintype() == "multipart":+# continue++# # Handle attachments+# if "attachment" in content_disposition or part.get("Content-ID"):+# filename = part.get_filename()+# if filename:+# filename = self._decode_header(filename)+# content = part.get_payload(decode=True)+# if content:+# path = await self._save_attachment_bytes(+# filename, content, download_folder+# )+# attachment_paths.append(path)++# # Map Content-ID for inline images+# cid = part.get("Content-ID")+# if cid:+# cid = cid.strip("<>")+# cid_map[cid] = path++# # Add positional marker for non-cid attachments+# # (cid attachments are positioned via HTML references)+# if not cid and body_parts:+# body_parts.append(f"\n[file://{path}]\n")++# # Handle body text+# elif content_type == "text/plain":+# if not body: # Use first text/plain as primary body+# charset = part.get_content_charset() or "utf-8"+# body = part.get_payload(decode=True).decode(charset, errors="ignore")+# body_parts.append(body)++# elif content_type == "text/html":+# if not body: # Use first text/html as primary body if no text/plain+# charset = part.get_content_charset() or "utf-8"+# html_content = part.get_payload(decode=True).decode(charset, errors="ignore")+# body = self._html_to_text(html_content, cid_map)+# body_parts.append(body)++# # Combine body parts if we built them up+# if len(body_parts) > 1:+# body = "".join(body_parts)+# else:+# # Single part message+# content_type = email_msg.get_content_type()+# charset = email_msg.get_content_charset() or "utf-8"+# content = email_msg.get_payload(decode=True)+# if content:+# if content_type == "text/html":+# body = self._html_to_text(content.decode(charset, errors="ignore"), cid_map)+# else:+# body = content.decode(charset, errors="ignore")++# return Message(+# sender=sender,+# subject=subject,+# body=body,+# attachments=attachment_paths+# )++# def _html_to_text(self, html_content: str, cid_map: Optional[Dict[str, str]] = None) -> str:+# """+# Convert HTML to plain text with inline attachment references.++# Replaces inline images with [file:///a0/...] markers to maintain+# positional context.+# """+# cid_map = cid_map or {}++# # Replace cid: references with file paths before conversion+# if cid_map:+# soup = BeautifulSoup(html_content, "html.parser")+# for img in soup.find_all("img"):+# src = img.get("src", "")+# if src.startswith("cid:"):+# cid = src[4:] # Remove "cid:" prefix+# if cid in cid_map:+# # Replace with file path marker+# file_marker = f"[file://{cid_map[cid]}]"+# img.replace_with(soup.new_string(file_marker))+# html_content = str(soup)++# # Convert HTML to text+# h = html2text.HTML2Text()+# h.ignore_links = False+# h.ignore_images = False+# h.ignore_emphasis = False+# h.body_width = 0 # Don't wrap lines++# text = h.handle(html_content)++# # Clean up extra whitespace+# text = re.sub(r"\n{3,}", "\n\n", text) # Max 2 consecutive newlines+# text = text.strip()++# return text++# async def _save_attachment_bytes(+# self,+# filename: str,+# content: bytes,+# download_folder: str,+# ) -> str:+# """+# Save attachment to disk and return absolute path.++# Uses Agent Zero's file helpers for path management.+# """+# # Sanitize filename+# filename = files.safe_file_name(filename)++# # Generate unique filename if needed+# unique_id = uuid.uuid4().hex[:8]+# name, ext = os.path.splitext(filename)+# unique_filename = f"{name}_{unique_id}{ext}"++# # Build relative path and save+# relative_path = os.path.join(download_folder, unique_filename)+# files.write_file_bin(relative_path, content)++# # Return absolute path+# abs_path = files.get_abs_path(relative_path)+# return abs_path++# def _decode_header(self, header: str) -> str:+# """Decode email header handling various encodings."""+# if not header:+# return ""++# decoded_parts = []+# for part, encoding in decode_header(header):+# if isinstance(part, bytes):+# decoded_parts.append(part.decode(encoding or "utf-8", errors="ignore"))+# else:+# decoded_parts.append(str(part))++# return " ".join(decoded_parts)+++# async def read_messages(+# account_type: str = "imap",+# server: str = "",+# port: int = 993,+# username: str = "",+# password: str = "",+# download_folder: str = "usr/email",+# options: Optional[Dict[str, Any]] = None,+# filter: Optional[Dict[str, Any]] = None,+# ) -> List[Message]:+# """+# Convenience wrapper for reading email messages.++# Automatically handles connection and disconnection.++# Args:+# account_type: "imap" or "exchange"+# server: Mail server address+# port: Server port (default 993 for IMAP SSL)+# username: Email username+# password: Email password+# download_folder: Folder to save attachments (relative to /a0/)+# options: Optional configuration dict+# filter: Filter criteria dict++# Returns:+# List of Message objects++# Example:+# from helpers.email_client import read_messages+# messages = await read_messages(+# server="imap.gmail.com",+# port=993,+# username=secrets.get("EMAIL_USER"),+# password=secrets.get("EMAIL_PASSWORD"),+# download_folder="tmp/email/inbox",+# filter={"unread": True, "sender": "*@company.com"}+# )+# """+# client = EmailClient(+# account_type=account_type,+# server=server,+# port=port,+# username=username,+# password=password,+# options=options,+# )++# try:+# await client.connect()+# messages = await client.read_messages(download_folder, filter)+# return messages+# finally:+# await client.disconnect()diff --git a/helpers/files.py b/helpers/files.pyindex efef577ee..9178aa4d8 100644--- a/helpers/files.py+++ b/helpers/files.py@@ -18,6 +18,7 @@ AGENTS_DIR = "agents"PLUGINS_DIR = "plugins"PROJECTS_DIR = "projects"USER_DIR = "usr"+TEMP_DIR = "tmp"class VariablesPlugin(ABC):diff --git a/helpers/plugins.py b/helpers/plugins.pyindex 006d9125f..fe67e6fe6 100644--- a/helpers/plugins.py+++ b/helpers/plugins.py@@ -48,6 +48,7 @@ _last_frontend_reload_notification_at = 0.0class PluginMetadata(BaseModel):+ name: str = ""title: str = ""description: str = ""version: str = ""@@ -567,7 +568,7 @@ def send_frontend_reload_notification(plugin_names: list[str] | None = None):"""If the plugin changed has webui extensions, notify frontend to reload the page"""global _last_frontend_reload_notification_at- display_time = 3+ display_time = 5now = time.monotonic()if now - _last_frontend_reload_notification_at < display_time:returndiff --git a/plugins/chat_branching/api/branch_chat.py b/plugins/_chat_branching/api/branch_chat.pysimilarity index 100%rename from plugins/chat_branching/api/branch_chat.pyrename to plugins/_chat_branching/api/branch_chat.pydiff --git a/plugins/chat_branching/extensions/webui/set_messages_after_loop/inject-branch-buttons.js b/plugins/_chat_branching/extensions/webui/set_messages_after_loop/inject-branch-buttons.jssimilarity index 93%rename from plugins/chat_branching/extensions/webui/set_messages_after_loop/inject-branch-buttons.jsrename to plugins/_chat_branching/extensions/webui/set_messages_after_loop/inject-branch-buttons.jsindex a0c2a3123..c98f84f96 100644--- a/plugins/chat_branching/extensions/webui/set_messages_after_loop/inject-branch-buttons.js+++ b/plugins/_chat_branching/extensions/webui/set_messages_after_loop/inject-branch-buttons.js@@ -19,7 +19,7 @@ export default async function injectBranchButtons(context) {const ctxid = globalThis.getContext?.();if (!ctxid) throw new Error("No active chat");- const res = await callJsonApi("/plugins/chat_branching/branch_chat", {+ const res = await callJsonApi("/plugins/_chat_branching/branch_chat", {context: ctxid,log_no: logNo,});diff --git a/plugins/_chat_branching/extensions/webui/set_messages_after_loop/plugins.py b/plugins/_chat_branching/extensions/webui/set_messages_after_loop/plugins.pynew file mode 100644index 000000000..003c66500--- /dev/null+++ b/plugins/_chat_branching/extensions/webui/set_messages_after_loop/plugins.py@@ -0,0 +1,606 @@+from __future__ import annotations++import asyncio+import re, json, glob+import time+from pathlib import Path+from typing import (+ Any,+ Dict,+ Iterator,+ List,+ Literal,+ Optional,+ TYPE_CHECKING,+ TypedDict,+)++from helpers import files, notification, print_style, yaml as yaml_helper, cache+from pydantic import BaseModel, Field++from helpers.defer import DeferredTask++if TYPE_CHECKING:+ from agent import Agent++# Extracts target selector from <meta name="plugin-target" content="...">+_META_TARGET_RE = re.compile(+ r'<meta\s+name=["\']plugin-target["\']\s+content=["\']([^"\']+)["\']',+ re.IGNORECASE,+)++type ToggleState = Literal["enabled", "disabled", "advanced"]+++class PluginAssetFile(TypedDict):+ path: str+ project_name: str+ agent_profile: str+++META_FILE_NAME = "plugin.yaml"+CONFIG_FILE_NAME = "config.json"+CONFIG_DEFAULT_FILE_NAME = "default_config.yaml"+DISABLED_FILE_NAME = ".toggle-0"+ENABLED_FILE_NAME = ".toggle-1"+TOGGLE_FILE_PATTERN = ".toggle-[01]"+_last_frontend_reload_notification_at = 0.0+++class PluginMetadata(BaseModel):+ name: str = ""+ title: str = ""+ description: str = ""+ version: str = ""+ settings_sections: List[str] = Field(default_factory=list)+ per_project_config: bool = False+ per_agent_config: bool = False+ always_enabled: bool = False+++class PluginListItem(BaseModel):+ name: str+ path: str+ display_name: str = ""+ description: str = ""+ version: str = ""+ settings_sections: List[str] = Field(default_factory=list)+ per_project_config: bool = False+ per_agent_config: bool = False+ always_enabled: bool = False+ is_custom: bool = False+ has_main_screen: bool = False+ has_config_screen: bool = False+ has_readme: bool = False+ has_license: bool = False+ has_init_script: bool = False+ toggle_state: ToggleState = "disabled"+++def after_plugin_change(plugin_names: list[str] | None = None):+ clear_plugin_cache()+ send_frontend_reload_notification(plugin_names)+++def clear_plugin_cache():+ cache.clear("*(plugins)*")+++def get_plugin_roots(plugin_name: str = "") -> List[str]:+ """Plugin root directories, ordered by priority (user first)."""+ return [+ files.get_abs_path(files.USER_DIR, files.PLUGINS_DIR, plugin_name),+ files.get_abs_path(files.PLUGINS_DIR, plugin_name),+ ]+++def get_plugins_list():+ result: list[str] = []+ seen_names: set[str] = set()+ for root in get_plugin_roots():+ for dir in Path(root).iterdir():+ if not dir.is_dir() or dir.name.startswith("."):+ continue+ if dir.name in seen_names:+ continue+ if files.exists(str(dir), META_FILE_NAME):+ seen_names.add(dir.name)+ result.append(dir.name)+ result.sort(key=lambda p: Path(p).name)+ return result+++def get_enhanced_plugins_list(+ custom: bool = True, builtin: bool = True+) -> List[PluginListItem]:+ """Discover plugins by directory convention. First root wins on ID conflict."""+ results = []++ def load_plugins(root_path: str, is_custom: bool):+ for d in sorted(Path(root_path).iterdir(), key=lambda p: p.name):+ try:+ if not d.is_dir() or d.name.startswith("."):+ continue+ meta_file = str(d / META_FILE_NAME)+ if not files.exists(meta_file):+ continue+ meta = PluginMetadata.model_validate(files.read_file_yaml(meta_file))+ has_main_screen = files.exists(str(d / "webui" / "main.html"))+ has_config_screen = files.exists(str(d / "webui" / "config.html"))+ has_readme = files.exists(str(d / "README.md"))+ has_license = files.exists(str(d / "LICENSE"))+ has_init_script = files.exists(str(d / "initialize.py"))+ toggle_state = get_toggle_state(d.name)+ results.append(+ PluginListItem(+ name=d.name,+ path=str(d),+ display_name=meta.title or d.name,+ description=meta.description,+ version=meta.version,+ settings_sections=meta.settings_sections,+ per_project_config=meta.per_project_config,+ per_agent_config=meta.per_agent_config,+ always_enabled=meta.always_enabled,+ is_custom=is_custom,+ has_main_screen=has_main_screen,+ has_config_screen=has_config_screen,+ has_readme=has_readme,+ has_license=has_license,+ has_init_script=has_init_script,+ toggle_state=toggle_state,+ )+ )+ except Exception as e:+ print_style.PrintStyle.error(f"Failed to load plugin {d.name}: {e}")+ continue++ if custom:+ load_plugins(files.get_abs_path(files.USER_DIR, files.PLUGINS_DIR), True)+ if builtin:+ load_plugins(files.get_abs_path(files.PLUGINS_DIR), False)+ return results+++def get_plugin_meta(plugin_name: str):+ plugin_dir = find_plugin_dir(plugin_name)+ if not plugin_dir:+ return None+ return PluginMetadata.model_validate(+ files.read_file_yaml(files.get_abs_path(plugin_dir, META_FILE_NAME))+ )+++def find_plugin_dir(plugin_name: str):+ if not plugin_name:+ return None++ # check if the plugin is in the user directory+ user_plugin_path = files.get_abs_path(+ files.USER_DIR, files.PLUGINS_DIR, plugin_name, META_FILE_NAME+ )+ if files.exists(user_plugin_path):+ return files.get_abs_path(files.USER_DIR, files.PLUGINS_DIR, plugin_name)++ # check if the plugin is in the default directory+ default_plugin_path = files.get_abs_path(+ files.PLUGINS_DIR, plugin_name, META_FILE_NAME+ )+ if files.exists(default_plugin_path):+ return files.get_abs_path(files.PLUGINS_DIR, plugin_name)++ return None+++def delete_plugin(plugin_name: str):+ plugin_dir = find_plugin_dir(plugin_name)+ if not plugin_dir:+ raise FileNotFoundError(f"Plugin '{plugin_name}' not found")+ custom_plugins_dir = files.get_abs_path(files.USER_DIR, files.PLUGINS_DIR)+ if not files.is_in_dir(plugin_dir, custom_plugins_dir):+ raise ValueError("Only custom plugins can be deleted")+ send_frontend_reload_notification([plugin_name]) # send before deletion to properly check the extensions, second notification will be skipped automatically+ files.delete_dir(plugin_dir)+ after_plugin_change([plugin_name])+++def get_plugin_paths(*subpaths: str) -> List[str]:+ sub = "*/" + "/".join(subpaths) if subpaths else "*"+ paths: List[str] = []+ for root in get_plugin_roots():+ paths.extend(+ files.find_existing_paths_by_pattern(files.get_abs_path(root, sub))+ )+ return paths+++def get_enabled_plugin_paths(agent: Agent | None, *subpaths: str) -> List[str]:+ enabled = get_enabled_plugins(agent)+ paths: list[str] = []++ for plugin in enabled:+ base_dir = find_plugin_dir(plugin)+ if not base_dir:+ continue++ if not subpaths:+ if files.exists(base_dir):+ paths.append(base_dir)+ continue++ path_pattern = files.get_abs_path(base_dir, *subpaths)+ paths.extend(files.find_existing_paths_by_pattern(path_pattern))++ return paths+++def get_enabled_plugins(agent: Agent | None):+ plugins = get_plugins_list()+ active = []++ for plugin in plugins:+ # plugins are toggled via .enabled / .disabled files+ # every plugin is on by default, unless disabled in usr dir+ enabled = True++ # root plugin paths+ plugin_paths = get_plugin_roots(plugin)++ # + agent paths+ if agent:+ from helpers import subagents++ agent_paths = subagents.get_paths(+ agent,+ files.PLUGINS_DIR,+ plugin,+ must_exist_completely=True,+ include_default=False,+ include_user=False,+ include_plugins=False,+ include_project=True,+ )+ plugin_paths = agent_paths + plugin_paths++ # go through paths in reverse order and determine the state+ enabled = determined_toggle_from_paths(enabled, reversed(plugin_paths))++ if enabled:+ active.append(plugin)++ return active+++def determined_toggle_from_paths(default: bool, paths: Iterator[str]):+ enabled = default+ for plugin_path in paths:+ if enabled:+ enabled = not files.exists(+ files.get_abs_path(plugin_path, DISABLED_FILE_NAME)+ )+ else:+ enabled = files.exists(files.get_abs_path(plugin_path, ENABLED_FILE_NAME))+ return enabled+++def get_toggle_state(plugin_name: str) -> ToggleState:+ meta = get_plugin_meta(plugin_name)+ if not meta:+ return "disabled"+ if meta.always_enabled:+ return "enabled"++ # root plugin paths+ plugin_paths = get_plugin_roots(plugin_name)+ state = (+ "enabled"+ if determined_toggle_from_paths(True, reversed(plugin_paths))+ else "disabled"+ )++ # global toggles+ usr_toggles = [+ files.find_existing_paths_by_pattern(+ files.get_abs_path(files.PLUGINS_DIR, plugin_name, TOGGLE_FILE_PATTERN)+ ),+ files.find_existing_paths_by_pattern(+ files.get_abs_path(+ files.USER_DIR, files.PLUGINS_DIR, plugin_name, TOGGLE_FILE_PATTERN+ )+ ),+ ]++ # additional toggles in project/agent directories, return advanced+ if meta.per_agent_config or meta.per_project_config:+ configs = find_plugin_assets(+ TOGGLE_FILE_PATTERN,+ plugin_name=plugin_name,+ project_name="*" if meta.per_project_config else "",+ agent_profile="*" if meta.per_agent_config else "",+ only_first=False,+ )++ # Advanced if there are specific overrides (project or agent specific)+ if any(c.get("project_name") or c.get("agent_profile") for c in configs):+ state = "advanced"++ return state+++def toggle_plugin(+ plugin_name: str,+ enabled: bool,+ project_name: str = "",+ agent_profile: str = "",+ clear_overrides: bool = False,+):+ if clear_overrides:+ all_toggles = find_plugin_assets(+ TOGGLE_FILE_PATTERN,+ plugin_name=plugin_name,+ project_name="*",+ agent_profile="*",+ only_first=False,+ )+ for toggle in all_toggles:+ files.delete_file(toggle["path"])++ enabled_file = determine_plugin_asset_path(+ plugin_name, project_name, agent_profile, ENABLED_FILE_NAME+ )+ disabled_file = determine_plugin_asset_path(+ plugin_name, project_name, agent_profile, DISABLED_FILE_NAME+ )++ # ensure clean state by deleting both potential files first+ files.delete_file(enabled_file)+ files.delete_file(disabled_file)++ if enabled:+ files.write_file(enabled_file, "")+ else:+ files.write_file(disabled_file, "")+ after_plugin_change([plugin_name])+++def get_plugin_config(+ plugin_name: str,+ agent: Agent | None = None,+ project_name: str | None = None,+ agent_profile: str | None = None,+):++ if project_name is None and agent is not None:+ from helpers import projects++ project_name = projects.get_context_project_name(agent.context)+ if agent_profile is None and agent is not None:+ agent_profile = agent.config.profile++ # find config.json in all possible places+ file = find_plugin_asset(+ plugin_name,+ CONFIG_FILE_NAME,+ project_name=project_name or "",+ agent_profile=agent_profile or "",+ )+ file_path = file.get("path", "") if file else ""++ # use default config if not found+ if not file_path:+ file_path = files.get_abs_path(+ find_plugin_dir(plugin_name), CONFIG_DEFAULT_FILE_NAME+ )+ if file_path and files.exists(file_path):+ return (+ json.loads if file_path.lower().endswith(".json") else yaml_helper.loads+ )(files.read_file(file_path))+ return None+++def get_default_plugin_config(plugin_name: str):+ file_path = files.get_abs_path(+ find_plugin_dir(plugin_name), CONFIG_DEFAULT_FILE_NAME+ )+ if file_path and files.exists(file_path):+ return (+ json.loads if file_path.lower().endswith(".json") else yaml_helper.loads+ )(files.read_file(file_path))+ return None+++def save_plugin_config(+ plugin_name: str, project_name: str, agent_profile: str, settings: dict+):+ file_path = determine_plugin_asset_path(+ plugin_name, project_name, agent_profile, CONFIG_FILE_NAME+ )+ if file_path:+ files.write_file(file_path, json.dumps(settings))+ after_plugin_change([plugin_name])+++def find_plugin_asset(+ plugin_name: str, *subpaths: str, project_name="", agent_profile=""+):+ result = find_plugin_assets(+ *subpaths,+ plugin_name=plugin_name,+ project_name=project_name,+ agent_profile=agent_profile,+ only_first=True,+ )+ return result[0] if result else None+++def find_plugin_assets(+ *subpaths: str,+ plugin_name: str = "*",+ project_name: str = "*",+ agent_profile: str = "*",+ only_first: bool = False,+) -> list[PluginAssetFile]:+ from helpers import projects, subagents++ results: list[PluginAssetFile] = []++ def _collect(path: str, proj: str, profile: str) -> bool:+ is_glob = glob.has_magic(path)+ matched_paths = (+ files.find_existing_paths_by_pattern(path)+ if is_glob+ else ([path] if files.exists(path) else [])+ )++ need_proj = proj == "*"+ need_prof = profile == "*"++ def _after(s: str, marker: str, last: bool = False) -> str:+ i = s.rfind(marker) if last else s.find(marker)+ if i == -1:+ return ""+ start = i + len(marker)+ end = s.find("/", start)+ return s[start:] if end == -1 else s[start:end]++ for matched in matched_paths:+ inferred_proj = _after(matched, "/projects/") if need_proj else proj+ inferred_prof = (+ _after(matched, "/agents/", last=True) if need_prof else profile+ )+ results.append(+ {+ "project_name": inferred_proj,+ "agent_profile": inferred_prof,+ "path": matched,+ }+ )+ if only_first:+ return True+ return False++ # project/.a0proj/agents/<profile>/plugins/<plugin_name>/...+ if project_name:+ if agent_profile:+ path = projects.get_project_meta(+ project_name,+ files.AGENTS_DIR,+ agent_profile,+ files.PLUGINS_DIR,+ plugin_name,+ *subpaths,+ )+ if _collect(path, project_name, agent_profile):+ return results+ if not agent_profile or agent_profile == "*":+ # project/.a0proj/plugins/<plugin_name>/...+ path = projects.get_project_meta(+ project_name, files.PLUGINS_DIR, plugin_name, *subpaths+ )+ if _collect(path, project_name, ""):+ return results++ # usr/agents/<profile>/plugins/<plugin_name>/...+ if agent_profile:+ path = files.get_abs_path(+ subagents.USER_AGENTS_DIR,+ agent_profile,+ files.PLUGINS_DIR,+ plugin_name,+ *subpaths,+ )+ if _collect(path, "", agent_profile):+ return results++ # usr?/plugins/<any_plugin>/agents/<profile>/plugins/<plugin_name>/...+ for plugin_base in get_enabled_plugin_paths(None):+ path = files.get_abs_path(+ plugin_base,+ files.AGENTS_DIR,+ agent_profile,+ files.PLUGINS_DIR,+ plugin_name,+ *subpaths,+ )+ if _collect(path, "", agent_profile):+ return results++ # agents/<profile>/plugins/<plugin_name>/...+ path = files.get_abs_path(+ subagents.DEFAULT_AGENTS_DIR,+ agent_profile,+ files.PLUGINS_DIR,+ plugin_name,+ *subpaths,+ )+ if _collect(path, "", agent_profile):+ return results++ # usr/plugins/<plugin_name>/...+ path = files.get_abs_path(files.USER_DIR, files.PLUGINS_DIR, plugin_name, *subpaths)+ if _collect(path, "", ""):+ return results++ # plugins/<plugin_name>/...+ path = files.get_abs_path(files.PLUGINS_DIR, plugin_name, *subpaths)+ _collect(path, "", "")++ return results+++def determine_plugin_asset_path(+ plugin_name: str, project_name: str, agent_profile: str, *subpaths: str+):+ base_path = files.get_abs_path(files.USER_DIR)++ if project_name:+ from helpers import projects++ base_path = projects.get_project_meta(project_name)++ if agent_profile:+ base_path = files.get_abs_path(base_path, files.AGENTS_DIR, agent_profile)++ return files.get_abs_path(base_path, files.PLUGINS_DIR, plugin_name, *subpaths)+++def send_frontend_reload_notification(plugin_names: list[str] | None = None):+ """If the plugin changed has webui extensions, notify frontend to reload the page"""+ global _last_frontend_reload_notification_at++ display_time = 5+ now = time.monotonic()+ if now - _last_frontend_reload_notification_at < display_time:+ return++ if plugin_names:+ has_webui_extension = False+ for plugin_name in plugin_names:+ plugin_dir = find_plugin_dir(plugin_name)+ if plugin_dir and files.exists(+ files.get_abs_path(plugin_dir, "extensions", "webui")+ ):+ has_webui_extension = True+ break+ if not has_webui_extension:+ return++ async def _send_later():+ global _last_frontend_reload_notification_at++ await asyncio.sleep(1)++ _last_frontend_reload_notification_at = time.monotonic()++ notification.NotificationManager.send_notification(+ type=notification.NotificationType.INFO,+ priority=notification.NotificationPriority.NORMAL,+ title="Plugins with frontend extensions updated, page plugins/_plugin_scanmended",+ message="""<button type="button" class="button confirm" onclick="window.location.reload()"><span class="icon material-symbols-outlined">refresh</span>Reload page</button>""",+ detail="",+ display_time=display_time,+ group="plugins_changed",+ id="plugins_frontend_reload",+ )++ DeferredTask().start_task(_send_later)diff --git a/plugins/chat_branching/plugin.yaml b/plugins/_chat_branching/plugin.yamlsimilarity index 76%rename from plugins/chat_branching/plugin.yamlrename to plugins/_chat_branching/plugin.yamlindex 17c2c809c..8391da6e2 100644--- a/plugins/chat_branching/plugin.yaml+++ b/plugins/_chat_branching/plugin.yaml@@ -1,3 +1,4 @@+name: _chat_branchingtitle: Chat Branchingdescription: Branch a chat from any message, creating a new chat with history up to that point.version: 1.0.0\ No newline at end of filediff --git a/plugins/code_execution/default_config.yaml b/plugins/_code_execution/default_config.yamlsimilarity index 100%rename from plugins/code_execution/default_config.yamlrename to plugins/_code_execution/default_config.yamldiff --git a/plugins/code_execution/extensions/python/system_prompt/_20_code_execution_prompt.py b/plugins/_code_execution/extensions/python/system_prompt/_20_code_execution_prompt.pysimilarity index 87%rename from plugins/code_execution/extensions/python/system_prompt/_20_code_execution_prompt.pyrename to plugins/_code_execution/extensions/python/system_prompt/_20_code_execution_prompt.pyindex afe11541f..aafc18443 100644--- a/plugins/code_execution/extensions/python/system_prompt/_20_code_execution_prompt.py+++ b/plugins/_code_execution/extensions/python/system_prompt/_20_code_execution_prompt.py@@ -10,5 +10,8 @@ class CodeExecutionPrompt(Extension):loop_data: LoopData = LoopData(),**kwargs,):+ if not self.agent:+ return+system_prompt.append(self.agent.read_prompt("agent.system.tool.code_exe.md"))system_prompt.append(self.agent.read_prompt("agent.system.tool.input.md"))diff --git a/plugins/code_execution/extensions/webui/get_message_handler/code-exe-handler.js b/plugins/_code_execution/extensions/webui/get_message_handler/code-exe-handler.jssimilarity index 100%rename from plugins/code_execution/extensions/webui/get_message_handler/code-exe-handler.jsrename to plugins/_code_execution/extensions/webui/get_message_handler/code-exe-handler.jsdiff --git a/plugins/code_execution/helpers/__init__.py b/plugins/_code_execution/helpers/__init__.pysimilarity index 100%rename from plugins/code_execution/helpers/__init__.pyrename to plugins/_code_execution/helpers/__init__.pydiff --git a/plugins/code_execution/helpers/shell_local.py b/plugins/_code_execution/helpers/shell_local.pysimilarity index 90%rename from plugins/code_execution/helpers/shell_local.pyrename to plugins/_code_execution/helpers/shell_local.pyindex d81b1628d..797cc7fa0 100644--- a/plugins/code_execution/helpers/shell_local.py+++ b/plugins/_code_execution/helpers/shell_local.py@@ -5,8 +5,8 @@ import timeimport sysfrom typing import Optional, Tuplefrom helpers import runtime-from plugins.code_execution.helpers import tty_session-from plugins.code_execution.helpers.shell_ssh import clean_string+from plugins._code_execution.helpers import tty_session+from plugins._code_execution.helpers.shell_ssh import clean_stringclass LocalInteractiveSession:def __init__(self, cwd: str|None = None):diff --git a/plugins/code_execution/helpers/shell_ssh.py b/plugins/_code_execution/helpers/shell_ssh.pysimilarity index 100%rename from plugins/code_execution/helpers/shell_ssh.pyrename to plugins/_code_execution/helpers/shell_ssh.pydiff --git a/plugins/code_execution/helpers/tty_session.py b/plugins/_code_execution/helpers/tty_session.pysimilarity index 99%rename from plugins/code_execution/helpers/tty_session.pyrename to plugins/_code_execution/helpers/tty_session.pyindex 9e8e7a424..384daf552 100644--- a/plugins/code_execution/helpers/tty_session.py+++ b/plugins/_code_execution/helpers/tty_session.py@@ -22,7 +22,7 @@ class TTYSession:self.encoding = encodingself.echo = echo # ← store preferenceself._proc = None- self._buf = None+ self._buf: asyncio.Queue = None # type: ignoredef __del__(self):# Simple cleanup on object destructiondiff --git a/plugins/code_execution/plugin.yaml b/plugins/_code_execution/plugin.yamlsimilarity index 91%rename from plugins/code_execution/plugin.yamlrename to plugins/_code_execution/plugin.yamlindex a838ac29e..742072b26 100644--- a/plugins/code_execution/plugin.yaml+++ b/plugins/_code_execution/plugin.yaml@@ -1,3 +1,4 @@+name: _code_executiontitle: Code Executiondescription: Code execution tool supporting terminal, Python, and Node.js runtimes via local TTY or SSH.version: 1.0.0diff --git a/plugins/code_execution/prompts/agent.system.tool.code_exe.md b/plugins/_code_execution/prompts/agent.system.tool.code_exe.mdsimilarity index 100%rename from plugins/code_execution/prompts/agent.system.tool.code_exe.mdrename to plugins/_code_execution/prompts/agent.system.tool.code_exe.mddiff --git a/plugins/code_execution/prompts/agent.system.tool.input.md b/plugins/_code_execution/prompts/agent.system.tool.input.mdsimilarity index 100%rename from plugins/code_execution/prompts/agent.system.tool.input.mdrename to plugins/_code_execution/prompts/agent.system.tool.input.mddiff --git a/plugins/code_execution/prompts/fw.code.info.md b/plugins/_code_execution/prompts/fw.code.info.mdsimilarity index 100%rename from plugins/code_execution/prompts/fw.code.info.mdrename to plugins/_code_execution/prompts/fw.code.info.mddiff --git a/plugins/code_execution/prompts/fw.code.max_time.md b/plugins/_code_execution/prompts/fw.code.max_time.mdsimilarity index 100%rename from plugins/code_execution/prompts/fw.code.max_time.mdrename to plugins/_code_execution/prompts/fw.code.max_time.mddiff --git a/plugins/code_execution/prompts/fw.code.no_out_time.md b/plugins/_code_execution/prompts/fw.code.no_out_time.mdsimilarity index 100%rename from plugins/code_execution/prompts/fw.code.no_out_time.mdrename to plugins/_code_execution/prompts/fw.code.no_out_time.mddiff --git a/plugins/code_execution/prompts/fw.code.no_output.md b/plugins/_code_execution/prompts/fw.code.no_output.mdsimilarity index 100%rename from plugins/code_execution/prompts/fw.code.no_output.mdrename to plugins/_code_execution/prompts/fw.code.no_output.mddiff --git a/plugins/code_execution/prompts/fw.code.pause_dialog.md b/plugins/_code_execution/prompts/fw.code.pause_dialog.mdsimilarity index 100%rename from plugins/code_execution/prompts/fw.code.pause_dialog.mdrename to plugins/_code_execution/prompts/fw.code.pause_dialog.mddiff --git a/plugins/code_execution/prompts/fw.code.pause_time.md b/plugins/_code_execution/prompts/fw.code.pause_time.mdsimilarity index 100%rename from plugins/code_execution/prompts/fw.code.pause_time.mdrename to plugins/_code_execution/prompts/fw.code.pause_time.mddiff --git a/plugins/code_execution/prompts/fw.code.reset.md b/plugins/_code_execution/prompts/fw.code.reset.mdsimilarity index 100%rename from plugins/code_execution/prompts/fw.code.reset.mdrename to plugins/_code_execution/prompts/fw.code.reset.mddiff --git a/plugins/code_execution/prompts/fw.code.running.md b/plugins/_code_execution/prompts/fw.code.running.mdsimilarity index 100%rename from plugins/code_execution/prompts/fw.code.running.mdrename to plugins/_code_execution/prompts/fw.code.running.mddiff --git a/plugins/code_execution/prompts/fw.code.runtime_wrong.md b/plugins/_code_execution/prompts/fw.code.runtime_wrong.mdsimilarity index 100%rename from plugins/code_execution/prompts/fw.code.runtime_wrong.mdrename to plugins/_code_execution/prompts/fw.code.runtime_wrong.mddiff --git a/plugins/code_execution/tools/code_execution_tool.py b/plugins/_code_execution/tools/code_execution_tool.pysimilarity index 98%rename from plugins/code_execution/tools/code_execution_tool.pyrename to plugins/_code_execution/tools/code_execution_tool.pyindex da2058643..ed16caea5 100644--- a/plugins/code_execution/tools/code_execution_tool.py+++ b/plugins/_code_execution/tools/code_execution_tool.py@@ -11,8 +11,8 @@ from helpers.strings import truncate_text as truncate_text_stringfrom helpers.messages import truncate_text as truncate_text_agentfrom helpers import plugins-from plugins.code_execution.helpers.shell_local import LocalInteractiveSession-from plugins.code_execution.helpers.shell_ssh import SSHInteractiveSession+from plugins._code_execution.helpers.shell_local import LocalInteractiveSession+from plugins._code_execution.helpers.shell_ssh import SSHInteractiveSession@dataclass@@ -504,7 +504,7 @@ def _parse_timeouts(cfg: dict, prefix: str, defaults: tuple[int, ...]) -> dict:def _get_config(agent) -> dict:- cfg = plugins.get_plugin_config("code_execution", agent=agent) or {}+ cfg = plugins.get_plugin_config("_code_execution", agent=agent) or {}return {"ssh_enabled": _resolve_ssh_enabled(cfg.get("ssh_enabled", "auto")),diff --git a/plugins/code_execution/tools/input.py b/plugins/_code_execution/tools/input.pysimilarity index 89%rename from plugins/code_execution/tools/input.pyrename to plugins/_code_execution/tools/input.pyindex f8b73be29..283670fb6 100644--- a/plugins/code_execution/tools/input.py+++ b/plugins/_code_execution/tools/input.py@@ -1,5 +1,5 @@from helpers.tool import Tool, Response-from plugins.code_execution.tools.code_execution_tool import CodeExecution+from plugins._code_execution.tools.code_execution_tool import CodeExecutionclass Input(Tool):diff --git a/plugins/code_execution/webui/config.html b/plugins/_code_execution/webui/config.htmlsimilarity index 100%rename from plugins/code_execution/webui/config.htmlrename to plugins/_code_execution/webui/config.htmldiff --git a/plugins/error_retry/default_config.yaml b/plugins/_error_retry/default_config.yamlsimilarity index 100%rename from plugins/error_retry/default_config.yamlrename to plugins/_error_retry/default_config.yamldiff --git a/plugins/error_retry/extensions/python/agent_Agent_handle_exception_end/_80_retry_critical_exception.py b/plugins/_error_retry/extensions/python/agent_Agent_handle_exception_end/_80_retry_critical_exception.pysimilarity index 92%rename from plugins/error_retry/extensions/python/agent_Agent_handle_exception_end/_80_retry_critical_exception.pyrename to plugins/_error_retry/extensions/python/agent_Agent_handle_exception_end/_80_retry_critical_exception.pyindex 79938e222..599fcf986 100644--- a/plugins/error_retry/extensions/python/agent_Agent_handle_exception_end/_80_retry_critical_exception.py+++ b/plugins/_error_retry/extensions/python/agent_Agent_handle_exception_end/_80_retry_critical_exception.py@@ -7,7 +7,7 @@ from helpers.errors import RepairableException, HandledExceptionfrom helpers import errorsfrom helpers.print_style import PrintStyle-from plugins.error_retry.extensions.python.agent_Agent_monologue_start._10_reset_critical_exception_counter import DATA_NAME_COUNTER+from plugins._error_retry.extensions.python.agent_Agent_monologue_start._10_reset_critical_exception_counter import DATA_NAME_COUNTERclass RetryCriticalException(Extension):async def execute(self, data: dict = {}, **kwargs):diff --git a/plugins/error_retry/extensions/python/agent_Agent_monologue_start/_10_reset_critical_exception_counter.py b/plugins/_error_retry/extensions/python/agent_Agent_monologue_start/_10_reset_critical_exception_counter.pysimilarity index 100%rename from plugins/error_retry/extensions/python/agent_Agent_monologue_start/_10_reset_critical_exception_counter.pyrename to plugins/_error_retry/extensions/python/agent_Agent_monologue_start/_10_reset_critical_exception_counter.pydiff --git a/plugins/error_retry/plugin.yaml b/plugins/_error_retry/plugin.yamlsimilarity index 90%rename from plugins/error_retry/plugin.yamlrename to plugins/_error_retry/plugin.yamlindex d4c044ccb..5e8476343 100644--- a/plugins/error_retry/plugin.yaml+++ b/plugins/_error_retry/plugin.yaml@@ -1,3 +1,4 @@+name: _error_retrytitle: Error Retrydescription: Retry on critical exceptions before failingversion: 1.0.0diff --git a/plugins/error_retry/webui/config.html b/plugins/_error_retry/webui/config.htmlsimilarity index 100%rename from plugins/error_retry/webui/config.htmlrename to plugins/_error_retry/webui/config.htmldiff --git a/plugins/infection_check/README.md b/plugins/_infection_check/README.mdsimilarity index 100%rename from plugins/infection_check/README.mdrename to plugins/_infection_check/README.mddiff --git a/plugins/infection_check/default_config.yaml b/plugins/_infection_check/default_config.yamlsimilarity index 100%rename from plugins/infection_check/default_config.yamlrename to plugins/_infection_check/default_config.yamldiff --git a/plugins/infection_check/extensions/python/reasoning_stream_chunk/_50_infection_collect.py b/plugins/_infection_check/extensions/python/reasoning_stream_chunk/_50_infection_collect.pysimilarity index 83%rename from plugins/infection_check/extensions/python/reasoning_stream_chunk/_50_infection_collect.pyrename to plugins/_infection_check/extensions/python/reasoning_stream_chunk/_50_infection_collect.pyindex 06bea353f..b2684440f 100644--- a/plugins/infection_check/extensions/python/reasoning_stream_chunk/_50_infection_collect.py+++ b/plugins/_infection_check/extensions/python/reasoning_stream_chunk/_50_infection_collect.py@@ -1,6 +1,6 @@from helpers.extension import Extensionfrom agent import LoopData-from plugins.infection_check.helpers.checker import get_checker+from plugins._infection_check.helpers.checker import get_checkerclass InfectionCollectReasoning(Extension):diff --git a/plugins/infection_check/extensions/python/response_stream/_50_infection_analyze.py b/plugins/_infection_check/extensions/python/response_stream/_50_infection_analyze.pysimilarity index 88%rename from plugins/infection_check/extensions/python/response_stream/_50_infection_analyze.pyrename to plugins/_infection_check/extensions/python/response_stream/_50_infection_analyze.pyindex 21ba9b376..0b82640ad 100644--- a/plugins/infection_check/extensions/python/response_stream/_50_infection_analyze.py+++ b/plugins/_infection_check/extensions/python/response_stream/_50_infection_analyze.py@@ -1,6 +1,6 @@from helpers.extension import Extensionfrom agent import LoopData-from plugins.infection_check.helpers.checker import get_checker+from plugins._infection_check.helpers.checker import get_checkerclass InfectionAnalyzeThoughts(Extension):diff --git a/plugins/infection_check/extensions/python/response_stream_chunk/_50_infection_collect.py b/plugins/_infection_check/extensions/python/response_stream_chunk/_50_infection_collect.pysimilarity index 83%rename from plugins/infection_check/extensions/python/response_stream_chunk/_50_infection_collect.pyrename to plugins/_infection_check/extensions/python/response_stream_chunk/_50_infection_collect.pyindex f31653aa9..c17e6adf3 100644--- a/plugins/infection_check/extensions/python/response_stream_chunk/_50_infection_collect.py+++ b/plugins/_infection_check/extensions/python/response_stream_chunk/_50_infection_collect.py@@ -1,6 +1,6 @@from helpers.extension import Extensionfrom agent import LoopData-from plugins.infection_check.helpers.checker import get_checker+from plugins._infection_check.helpers.checker import get_checkerclass InfectionCollectResponse(Extension):diff --git a/plugins/infection_check/extensions/python/response_stream_end/_50_infection_analyze.py b/plugins/_infection_check/extensions/python/response_stream_end/_50_infection_analyze.pysimilarity index 80%rename from plugins/infection_check/extensions/python/response_stream_end/_50_infection_analyze.pyrename to plugins/_infection_check/extensions/python/response_stream_end/_50_infection_analyze.pyindex 5e6a4a999..2ab30847b 100644--- a/plugins/infection_check/extensions/python/response_stream_end/_50_infection_analyze.py+++ b/plugins/_infection_check/extensions/python/response_stream_end/_50_infection_analyze.py@@ -1,6 +1,6 @@from helpers.extension import Extensionfrom agent import LoopData-from plugins.infection_check.helpers.checker import get_checker+from plugins._infection_check.helpers.checker import get_checkerclass InfectionAnalyzeEnd(Extension):diff --git a/plugins/infection_check/extensions/python/tool_execute_before/_50_infection_check.py b/plugins/_infection_check/extensions/python/tool_execute_before/_50_infection_check.pysimilarity index 82%rename from plugins/infection_check/extensions/python/tool_execute_before/_50_infection_check.pyrename to plugins/_infection_check/extensions/python/tool_execute_before/_50_infection_check.pyindex 1f2b1fac4..e32a9b8a4 100644--- a/plugins/infection_check/extensions/python/tool_execute_before/_50_infection_check.py+++ b/plugins/_infection_check/extensions/python/tool_execute_before/_50_infection_check.py@@ -1,5 +1,5 @@from helpers.extension import Extension-from plugins.infection_check.helpers.checker import get_checker+from plugins._infection_check.helpers.checker import get_checkerclass InfectionAwaitCheck(Extension):diff --git a/plugins/infection_check/helpers/checker.py b/plugins/_infection_check/helpers/checker.pysimilarity index 99%rename from plugins/infection_check/helpers/checker.pyrename to plugins/_infection_check/helpers/checker.pyindex 3cbaa46a4..7c1bb175f 100644--- a/plugins/infection_check/helpers/checker.py+++ b/plugins/_infection_check/helpers/checker.py@@ -13,7 +13,7 @@ if TYPE_CHECKING:from agent import Agentfrom helpers.log import LogItem-PLUGIN_NAME = "infection_check"+PLUGIN_NAME = "_infection_check"DATA_KEY = f"_plugin.{PLUGIN_NAME}"DATA_KEY_PASSED = f"{DATA_KEY}.passed"DATA_KEY_MONO = f"{DATA_KEY}.mono"diff --git a/plugins/infection_check/plugin.yaml b/plugins/_infection_check/plugin.yamlsimilarity index 88%rename from plugins/infection_check/plugin.yamlrename to plugins/_infection_check/plugin.yamlindex b8e07b28a..90121463a 100644--- a/plugins/infection_check/plugin.yaml+++ b/plugins/_infection_check/plugin.yaml@@ -1,3 +1,4 @@+name: _infection_checktitle: Infection Checkdescription: Safety check for prompt injection from external sources.version: 1.0.0diff --git a/plugins/infection_check/webui/config.html b/plugins/_infection_check/webui/config.htmlsimilarity index 100%rename from plugins/infection_check/webui/config.htmlrename to plugins/_infection_check/webui/config.htmldiff --git a/plugins/memory/api/import_knowledge.py b/plugins/_memory/api/import_knowledge.pysimilarity index 95%rename from plugins/memory/api/import_knowledge.pyrename to plugins/_memory/api/import_knowledge.pyindex 1fa546cae..698aa999d 100644--- a/plugins/memory/api/import_knowledge.py+++ b/plugins/_memory/api/import_knowledge.py@@ -1,7 +1,7 @@from helpers.api import ApiHandler, Request, Responsefrom helpers import filesfrom helpers.security import safe_filename-from plugins.memory.helpers.memory import Memory, get_custom_knowledge_subdir_abs+from plugins._memory.helpers.memory import Memory, get_custom_knowledge_subdir_absimport osdiff --git a/plugins/memory/api/knowledge_path_get.py b/plugins/_memory/api/knowledge_path_get.pysimilarity index 91%rename from plugins/memory/api/knowledge_path_get.pyrename to plugins/_memory/api/knowledge_path_get.pyindex 02a0978b9..c7df5e2f2 100644--- a/plugins/memory/api/knowledge_path_get.py+++ b/plugins/_memory/api/knowledge_path_get.py@@ -1,6 +1,6 @@from helpers.api import ApiHandler, Request, Responsefrom helpers import files, projects-from plugins.memory.helpers.memory import get_custom_knowledge_subdir_abs+from plugins._memory.helpers.memory import get_custom_knowledge_subdir_absclass GetKnowledgePath(ApiHandler):diff --git a/plugins/memory/api/knowledge_reindex.py b/plugins/_memory/api/knowledge_reindex.pysimilarity index 91%rename from plugins/memory/api/knowledge_reindex.pyrename to plugins/_memory/api/knowledge_reindex.pyindex d4f6918b8..37d4a85f1 100644--- a/plugins/memory/api/knowledge_reindex.py+++ b/plugins/_memory/api/knowledge_reindex.py@@ -1,5 +1,5 @@from helpers.api import ApiHandler, Request, Response-from plugins.memory.helpers.memory import Memory+from plugins._memory.helpers.memory import Memoryclass ReindexKnowledge(ApiHandler):diff --git a/plugins/memory/api/memory_dashboard.py b/plugins/_memory/api/memory_dashboard.pysimilarity index 98%rename from plugins/memory/api/memory_dashboard.pyrename to plugins/_memory/api/memory_dashboard.pyindex 35a591517..8db2f70bf 100644--- a/plugins/memory/api/memory_dashboard.py+++ b/plugins/_memory/api/memory_dashboard.py@@ -4,7 +4,7 @@ from models import ModelConfig, ModelTypefrom langchain_core.documents import Documentfrom agent import AgentContext-from plugins.memory.helpers.memory import Memory, get_existing_memory_subdirs, get_context_memory_subdir+from plugins._memory.helpers.memory import Memory, get_existing_memory_subdirs, get_context_memory_subdirclass MemoryDashboard(ApiHandler):diff --git a/plugins/memory/default_config.yaml b/plugins/_memory/default_config.yamlsimilarity index 100%rename from plugins/memory/default_config.yamlrename to plugins/_memory/default_config.yamldiff --git a/plugins/memory/extensions/python/embedding_model_changed/_10_memory_reload.py b/plugins/_memory/extensions/python/embedding_model_changed/_10_memory_reload.pysimilarity index 75%rename from plugins/memory/extensions/python/embedding_model_changed/_10_memory_reload.pyrename to plugins/_memory/extensions/python/embedding_model_changed/_10_memory_reload.pyindex be9d87d77..50e8badd2 100644--- a/plugins/memory/extensions/python/embedding_model_changed/_10_memory_reload.py+++ b/plugins/_memory/extensions/python/embedding_model_changed/_10_memory_reload.py@@ -1,7 +1,7 @@from helpers.extension import Extension# Direct import - this extension lives inside the memory plugin-from plugins.memory.helpers.memory import reload as memory_reload+from plugins._memory.helpers.memory import reload as memory_reloadclass MemoryReload(Extension):diff --git a/plugins/memory/extensions/python/message_loop_prompts_after/_50_recall_memories.py b/plugins/_memory/extensions/python/message_loop_prompts_after/_50_recall_memories.pysimilarity index 96%rename from plugins/memory/extensions/python/message_loop_prompts_after/_50_recall_memories.pyrename to plugins/_memory/extensions/python/message_loop_prompts_after/_50_recall_memories.pyindex 7e090c5a5..42fb393b0 100644--- a/plugins/memory/extensions/python/message_loop_prompts_after/_50_recall_memories.py+++ b/plugins/_memory/extensions/python/message_loop_prompts_after/_50_recall_memories.py@@ -4,8 +4,8 @@ from agent import LoopDatafrom helpers import dirty_json, errors, log, plugins# Direct import - this extension lives inside the memory plugin-from plugins.memory.helpers.memory import Memory-from plugins.memory.tools.memory_load import DEFAULT_THRESHOLD as DEFAULT_MEMORY_THRESHOLD+from plugins._memory.helpers.memory import Memory+from plugins._memory.tools.memory_load import DEFAULT_THRESHOLD as DEFAULT_MEMORY_THRESHOLDDATA_NAME_TASK = "_recall_memories_task"@@ -27,7 +27,7 @@ class RecallMemories(Extension):if not self.agent:return- set = plugins.get_plugin_config("memory", self.agent)+ set = plugins.get_plugin_config("_memory", self.agent)if not set:return None@@ -69,7 +69,7 @@ class RecallMemories(Extension):del extras["solutions"]- set = plugins.get_plugin_config("memory", self.agent)+ set = plugins.get_plugin_config("_memory", self.agent)if not set:return None# try:diff --git a/plugins/memory/extensions/python/message_loop_prompts_after/_91_recall_wait.py b/plugins/_memory/extensions/python/message_loop_prompts_after/_91_recall_wait.pysimilarity index 80%rename from plugins/memory/extensions/python/message_loop_prompts_after/_91_recall_wait.pyrename to plugins/_memory/extensions/python/message_loop_prompts_after/_91_recall_wait.pyindex 9542f3e29..6076847ca 100644--- a/plugins/memory/extensions/python/message_loop_prompts_after/_91_recall_wait.py+++ b/plugins/_memory/extensions/python/message_loop_prompts_after/_91_recall_wait.py@@ -1,6 +1,6 @@from helpers.extension import Extensionfrom agent import LoopData-from plugins.memory.extensions.python.message_loop_prompts_after._50_recall_memories import DATA_NAME_TASK as DATA_NAME_TASK_MEMORIES, DATA_NAME_ITER as DATA_NAME_ITER_MEMORIES+from plugins._memory.extensions.python.message_loop_prompts_after._50_recall_memories import DATA_NAME_TASK as DATA_NAME_TASK_MEMORIES, DATA_NAME_ITER as DATA_NAME_ITER_MEMORIESfrom helpers import pluginsclass RecallWait(Extension):@@ -9,7 +9,7 @@ class RecallWait(Extension):if not self.agent:return- set = plugins.get_plugin_config("memory", self.agent)+ set = plugins.get_plugin_config("_memory", self.agent)if not set:return Nonediff --git a/plugins/memory/extensions/python/monologue_end/_50_memorize_fragments.py b/plugins/_memory/extensions/python/monologue_end/_50_memorize_fragments.pysimilarity index 94%rename from plugins/memory/extensions/python/monologue_end/_50_memorize_fragments.pyrename to plugins/_memory/extensions/python/monologue_end/_50_memorize_fragments.pyindex 4ac84f26c..c29899094 100644--- a/plugins/memory/extensions/python/monologue_end/_50_memorize_fragments.py+++ b/plugins/_memory/extensions/python/monologue_end/_50_memorize_fragments.py@@ -7,18 +7,18 @@ from helpers.log import LogItemfrom helpers.defer import DeferredTask, THREAD_BACKGROUND# Direct import - this extension lives inside the memory plugin-from plugins.memory.helpers.memory import Memory-from plugins.memory.tools.memory_load import DEFAULT_THRESHOLD as DEFAULT_MEMORY_THRESHOLD+from plugins._memory.helpers.memory import Memory+from plugins._memory.tools.memory_load import DEFAULT_THRESHOLD as DEFAULT_MEMORY_THRESHOLDclass MemorizeMemories(Extension):- async def execute(self, loop_data: LoopData = LoopData(), **kwargs):+ def execute(self, loop_data: LoopData = LoopData(), **kwargs):# try:if not self.agent:return- set = plugins.get_plugin_config("memory", self.agent)+ set = plugins.get_plugin_config("_memory", self.agent)if not set:return None@@ -35,14 +35,13 @@ class MemorizeMemories(Extension):task = DeferredTask(thread_name=THREAD_BACKGROUND)task.start_task(self.memorize, loop_data, log_item)# task = asyncio.create_task(self.memorize(loop_data, log_item))- return taskasync def memorize(self, loop_data: LoopData, log_item: LogItem, **kwargs):if not self.agent:returntry:- set = plugins.get_plugin_config("memory", self.agent)+ set = plugins.get_plugin_config("_memory", self.agent)if not set:return None@@ -118,7 +117,7 @@ class MemorizeMemories(Extension):try:# Use intelligent consolidation system- from plugins.memory.helpers.memory_consolidation import create_memory_consolidator+ from plugins._memory.helpers.memory_consolidation import create_memory_consolidatorconsolidator = create_memory_consolidator(self.agent,similarity_threshold=DEFAULT_MEMORY_THRESHOLD, # More permissive for discoverydiff --git a/plugins/memory/extensions/python/monologue_end/_51_memorize_solutions.py b/plugins/_memory/extensions/python/monologue_end/_51_memorize_solutions.pysimilarity index 95%rename from plugins/memory/extensions/python/monologue_end/_51_memorize_solutions.pyrename to plugins/_memory/extensions/python/monologue_end/_51_memorize_solutions.pyindex 35175cf17..7e9bb8cd5 100644--- a/plugins/memory/extensions/python/monologue_end/_51_memorize_solutions.py+++ b/plugins/_memory/extensions/python/monologue_end/_51_memorize_solutions.py@@ -7,17 +7,17 @@ from helpers.log import LogItemfrom helpers.defer import DeferredTask, THREAD_BACKGROUND# Direct import - this extension lives inside the memory plugin-from plugins.memory.helpers.memory import Memory-from plugins.memory.tools.memory_load import DEFAULT_THRESHOLD as DEFAULT_MEMORY_THRESHOLD+from plugins._memory.helpers.memory import Memory+from plugins._memory.tools.memory_load import DEFAULT_THRESHOLD as DEFAULT_MEMORY_THRESHOLDclass MemorizeSolutions(Extension):- async def execute(self, loop_data: LoopData = LoopData(), **kwargs):+ def execute(self, loop_data: LoopData = LoopData(), **kwargs):# try:if not self.agent:return- set = plugins.get_plugin_config("memory", self.agent)+ set = plugins.get_plugin_config("_memory", self.agent)if not set:return None@@ -34,7 +34,6 @@ class MemorizeSolutions(Extension):task = DeferredTask(thread_name=THREAD_BACKGROUND)task.start_task(self.memorize, loop_data, log_item)# task = asyncio.create_task(self.memorize(loop_data, log_item))- return taskasync def memorize(self, loop_data: LoopData, log_item: LogItem, **kwargs):if not self.agent:@@ -42,7 +41,7 @@ class MemorizeSolutions(Extension):try:- set = plugins.get_plugin_config("memory", self.agent)+ set = plugins.get_plugin_config("_memory", self.agent)if not set:return None@@ -128,7 +127,7 @@ class MemorizeSolutions(Extension):if set["memory_memorize_consolidation"]:try:# Use intelligent consolidation system- from plugins.memory.helpers.memory_consolidation import create_memory_consolidator+ from plugins._memory.helpers.memory_consolidation import create_memory_consolidatorconsolidator = create_memory_consolidator(self.agent,similarity_threshold=DEFAULT_MEMORY_THRESHOLD, # More permissive for discoverydiff --git a/plugins/memory/extensions/python/monologue_start/_10_memory_init.py b/plugins/_memory/extensions/python/monologue_start/_10_memory_init.pysimilarity index 88%rename from plugins/memory/extensions/python/monologue_start/_10_memory_init.pyrename to plugins/_memory/extensions/python/monologue_start/_10_memory_init.pyindex 80bcac793..521f5f7f4 100644--- a/plugins/memory/extensions/python/monologue_start/_10_memory_init.py+++ b/plugins/_memory/extensions/python/monologue_start/_10_memory_init.py@@ -2,7 +2,7 @@ from helpers.extension import Extensionfrom agent import LoopData# Direct import - this extension lives inside the memory plugin-from plugins.memory.helpers import memory+from plugins._memory.helpers import memoryclass MemoryInit(Extension):diff --git a/plugins/memory/extensions/python/system_prompt/_20_behaviour_prompt.py b/plugins/_memory/extensions/python/system_prompt/_20_behaviour_prompt.pysimilarity index 95%rename from plugins/memory/extensions/python/system_prompt/_20_behaviour_prompt.pyrename to plugins/_memory/extensions/python/system_prompt/_20_behaviour_prompt.pyindex 52e733417..4b0d40f20 100644--- a/plugins/memory/extensions/python/system_prompt/_20_behaviour_prompt.py+++ b/plugins/_memory/extensions/python/system_prompt/_20_behaviour_prompt.py@@ -3,7 +3,7 @@ from agent import Agent, LoopDatafrom helpers import files# Direct import - this extension lives inside the memory plugin-from plugins.memory.helpers import memory+from plugins._memory.helpers import memoryclass BehaviourPrompt(Extension):diff --git a/plugins/memory/extensions/webui/sidebar-quick-actions-dropdown-start/memory-entry.html b/plugins/_memory/extensions/webui/sidebar-quick-actions-dropdown-start/memory-entry.htmlsimilarity index 75%rename from plugins/memory/extensions/webui/sidebar-quick-actions-dropdown-start/memory-entry.htmlrename to plugins/_memory/extensions/webui/sidebar-quick-actions-dropdown-start/memory-entry.htmlindex 4b854b6cc..4bc935b30 100644--- a/plugins/memory/extensions/webui/sidebar-quick-actions-dropdown-start/memory-entry.html+++ b/plugins/_memory/extensions/webui/sidebar-quick-actions-dropdown-start/memory-entry.html@@ -5,7 +5,7 @@class="dropdown-item"id="memory-dash-dropdown"title="Memory"- @click="openModal('../plugins/memory/webui/memory-dashboard.html'); dropdownOpen = false">+ @click="openModal('../plugins/_memory/webui/memory-dashboard.html'); dropdownOpen = false"><span class="material-symbols-outlined">psychology</span><span>Memory</span></button>diff --git a/plugins/memory/extensions/webui/sidebar-quick-actions-main-start/memory-entry.html b/plugins/_memory/extensions/webui/sidebar-quick-actions-main-start/memory-entry.htmlsimilarity index 65%rename from plugins/memory/extensions/webui/sidebar-quick-actions-main-start/memory-entry.htmlrename to plugins/_memory/extensions/webui/sidebar-quick-actions-main-start/memory-entry.htmlindex a964d471a..6456471c7 100644--- a/plugins/memory/extensions/webui/sidebar-quick-actions-main-start/memory-entry.html+++ b/plugins/_memory/extensions/webui/sidebar-quick-actions-main-start/memory-entry.html@@ -1,6 +1,6 @@<!-- Memory --><div x-data>- <button x-move-after=".config-button#dashboard" class="config-button" id="memory-dash" @click="openModal('../plugins/memory/webui/memory-dashboard.html')"+ <button x-move-after=".config-button#dashboard" class="config-button" id="memory-dash" @click="openModal('../plugins/_memory/webui/memory-dashboard.html')"title="Memory"><span class="material-symbols-outlined">psychology</span></button>diff --git a/plugins/memory/helpers/knowledge_import.py b/plugins/_memory/helpers/knowledge_import.pysimilarity index 100%rename from plugins/memory/helpers/knowledge_import.pyrename to plugins/_memory/helpers/knowledge_import.pydiff --git a/plugins/memory/helpers/memory.py b/plugins/_memory/helpers/memory.pysimilarity index 99%rename from plugins/memory/helpers/memory.pyrename to plugins/_memory/helpers/memory.pyindex 1a3ac4d27..b0e2a4e70 100644--- a/plugins/memory/helpers/memory.py+++ b/plugins/_memory/helpers/memory.py@@ -515,7 +515,7 @@ def get_memory_subdir_abs(agent: Agent) -> str:def get_agent_memory_subdir(agent: Agent) -> str:- config = plugins.get_plugin_config("memory", agent)+ config = plugins.get_plugin_config("_memory", agent)if not config:return "default"diff --git a/plugins/memory/helpers/memory_consolidation.py b/plugins/_memory/helpers/memory_consolidation.pysimilarity index 99%rename from plugins/memory/helpers/memory_consolidation.pyrename to plugins/_memory/helpers/memory_consolidation.pyindex a9d003d09..ef5d503af 100644--- a/plugins/memory/helpers/memory_consolidation.py+++ b/plugins/_memory/helpers/memory_consolidation.py@@ -7,12 +7,12 @@ from enum import Enumfrom langchain_core.documents import Document-from plugins.memory.helpers.memory import Memory+from plugins._memory.helpers.memory import Memoryfrom helpers.dirty_json import DirtyJsonfrom helpers.log import LogItemfrom helpers.print_style import PrintStylefrom agent import Agent-from plugins.memory.tools.memory_load import DEFAULT_THRESHOLD as DEFAULT_MEMORY_THRESHOLD+from plugins._memory.tools.memory_load import DEFAULT_THRESHOLD as DEFAULT_MEMORY_THRESHOLDclass ConsolidationAction(Enum):diff --git a/plugins/memory/plugin.yaml b/plugins/_memory/plugin.yamlsimilarity index 92%rename from plugins/memory/plugin.yamlrename to plugins/_memory/plugin.yamlindex fce9f5c50..3a7f6d012 100644--- a/plugins/memory/plugin.yaml+++ b/plugins/_memory/plugin.yaml@@ -1,3 +1,4 @@+name: _memorytitle: Memorydescription: Provides persistent memory capabilities to Agent Zero agents.version: 1.0.0diff --git a/plugins/memory/prompts/agent.system.memories.md b/plugins/_memory/prompts/agent.system.memories.mdsimilarity index 100%rename from plugins/memory/prompts/agent.system.memories.mdrename to plugins/_memory/prompts/agent.system.memories.mddiff --git a/plugins/memory/prompts/agent.system.solutions.md b/plugins/_memory/prompts/agent.system.solutions.mdsimilarity index 100%rename from plugins/memory/prompts/agent.system.solutions.mdrename to plugins/_memory/prompts/agent.system.solutions.mddiff --git a/plugins/memory/prompts/agent.system.tool.memory.md b/plugins/_memory/prompts/agent.system.tool.memory.mdsimilarity index 100%rename from plugins/memory/prompts/agent.system.tool.memory.mdrename to plugins/_memory/prompts/agent.system.tool.memory.mddiff --git a/plugins/memory/prompts/fw.memory.hist_suc.sys.md b/plugins/_memory/prompts/fw.memory.hist_suc.sys.mdsimilarity index 100%rename from plugins/memory/prompts/fw.memory.hist_suc.sys.mdrename to plugins/_memory/prompts/fw.memory.hist_suc.sys.mddiff --git a/plugins/memory/prompts/fw.memory.hist_sum.sys.md b/plugins/_memory/prompts/fw.memory.hist_sum.sys.mdsimilarity index 100%rename from plugins/memory/prompts/fw.memory.hist_sum.sys.mdrename to plugins/_memory/prompts/fw.memory.hist_sum.sys.mddiff --git a/plugins/memory/prompts/fw.memory_saved.md b/plugins/_memory/prompts/fw.memory_saved.mdsimilarity index 100%rename from plugins/memory/prompts/fw.memory_saved.mdrename to plugins/_memory/prompts/fw.memory_saved.mddiff --git a/plugins/memory/prompts/memory.consolidation.msg.md b/plugins/_memory/prompts/memory.consolidation.msg.mdsimilarity index 100%rename from plugins/memory/prompts/memory.consolidation.msg.mdrename to plugins/_memory/prompts/memory.consolidation.msg.mddiff --git a/plugins/memory/prompts/memory.consolidation.sys.md b/plugins/_memory/prompts/memory.consolidation.sys.mdsimilarity index 100%rename from plugins/memory/prompts/memory.consolidation.sys.mdrename to plugins/_memory/prompts/memory.consolidation.sys.mddiff --git a/plugins/memory/prompts/memory.keyword_extraction.msg.md b/plugins/_memory/prompts/memory.keyword_extraction.msg.mdsimilarity index 100%rename from plugins/memory/prompts/memory.keyword_extraction.msg.mdrename to plugins/_memory/prompts/memory.keyword_extraction.msg.mddiff --git a/plugins/memory/prompts/memory.keyword_extraction.sys.md b/plugins/_memory/prompts/memory.keyword_extraction.sys.mdsimilarity index 100%rename from plugins/memory/prompts/memory.keyword_extraction.sys.mdrename to plugins/_memory/prompts/memory.keyword_extraction.sys.mddiff --git a/plugins/memory/prompts/memory.memories_filter.msg.md b/plugins/_memory/prompts/memory.memories_filter.msg.mdsimilarity index 100%rename from plugins/memory/prompts/memory.memories_filter.msg.mdrename to plugins/_memory/prompts/memory.memories_filter.msg.mddiff --git a/plugins/memory/prompts/memory.memories_filter.sys.md b/plugins/_memory/prompts/memory.memories_filter.sys.mdsimilarity index 100%rename from plugins/memory/prompts/memory.memories_filter.sys.mdrename to plugins/_memory/prompts/memory.memories_filter.sys.mddiff --git a/plugins/memory/prompts/memory.memories_query.msg.md b/plugins/_memory/prompts/memory.memories_query.msg.mdsimilarity index 100%rename from plugins/memory/prompts/memory.memories_query.msg.mdrename to plugins/_memory/prompts/memory.memories_query.msg.mddiff --git a/plugins/memory/prompts/memory.memories_query.sys.md b/plugins/_memory/prompts/memory.memories_query.sys.mdsimilarity index 100%rename from plugins/memory/prompts/memory.memories_query.sys.mdrename to plugins/_memory/prompts/memory.memories_query.sys.mddiff --git a/plugins/memory/prompts/memory.memories_sum.sys.md b/plugins/_memory/prompts/memory.memories_sum.sys.mdsimilarity index 100%rename from plugins/memory/prompts/memory.memories_sum.sys.mdrename to plugins/_memory/prompts/memory.memories_sum.sys.mddiff --git a/plugins/memory/prompts/memory.recall_delay_msg.md b/plugins/_memory/prompts/memory.recall_delay_msg.mdsimilarity index 100%rename from plugins/memory/prompts/memory.recall_delay_msg.mdrename to plugins/_memory/prompts/memory.recall_delay_msg.mddiff --git a/plugins/memory/prompts/memory.solutions_query.sys.md b/plugins/_memory/prompts/memory.solutions_query.sys.mdsimilarity index 100%rename from plugins/memory/prompts/memory.solutions_query.sys.mdrename to plugins/_memory/prompts/memory.solutions_query.sys.mddiff --git a/plugins/memory/prompts/memory.solutions_sum.sys.md b/plugins/_memory/prompts/memory.solutions_sum.sys.mdsimilarity index 100%rename from plugins/memory/prompts/memory.solutions_sum.sys.mdrename to plugins/_memory/prompts/memory.solutions_sum.sys.mddiff --git a/plugins/memory/tools/behaviour_adjustment.py b/plugins/_memory/tools/behaviour_adjustment.pysimilarity index 97%rename from plugins/memory/tools/behaviour_adjustment.pyrename to plugins/_memory/tools/behaviour_adjustment.pyindex e3fb20971..ef43d9c80 100644--- a/plugins/memory/tools/behaviour_adjustment.py+++ b/plugins/_memory/tools/behaviour_adjustment.py@@ -2,7 +2,7 @@ from helpers import filesfrom helpers.tool import Tool, Responsefrom agent import Agentfrom helpers.log import LogItem-from plugins.memory.helpers import memory+from plugins._memory.helpers import memoryclass UpdateBehaviour(Tool):diff --git a/plugins/memory/tools/memory_delete.py b/plugins/_memory/tools/memory_delete.pysimilarity index 89%rename from plugins/memory/tools/memory_delete.pyrename to plugins/_memory/tools/memory_delete.pyindex 503bf3fac..8b8932f93 100644--- a/plugins/memory/tools/memory_delete.py+++ b/plugins/_memory/tools/memory_delete.py@@ -1,5 +1,5 @@from helpers.tool import Tool, Response-from plugins.memory.helpers.memory import Memory+from plugins._memory.helpers.memory import Memorydiff --git a/plugins/memory/tools/memory_forget.py b/plugins/_memory/tools/memory_forget.pysimilarity index 90%rename from plugins/memory/tools/memory_forget.pyrename to plugins/_memory/tools/memory_forget.pyindex 145308711..3449815f9 100644--- a/plugins/memory/tools/memory_forget.py+++ b/plugins/_memory/tools/memory_forget.py@@ -1,5 +1,5 @@from helpers.tool import Tool, Response-from plugins.memory.helpers.memory import Memory+from plugins._memory.helpers.memory import Memoryfrom tools.memory_load import DEFAULT_THRESHOLDdiff --git a/plugins/memory/tools/memory_load.py b/plugins/_memory/tools/memory_load.pysimilarity index 92%rename from plugins/memory/tools/memory_load.pyrename to plugins/_memory/tools/memory_load.pyindex 952b78654..9305186f6 100644--- a/plugins/memory/tools/memory_load.py+++ b/plugins/_memory/tools/memory_load.py@@ -1,5 +1,5 @@from helpers.tool import Tool, Response-from plugins.memory.helpers.memory import Memory+from plugins._memory.helpers.memory import MemoryDEFAULT_THRESHOLD = 0.7DEFAULT_LIMIT = 10diff --git a/plugins/memory/tools/memory_save.py b/plugins/_memory/tools/memory_save.pysimilarity index 90%rename from plugins/memory/tools/memory_save.pyrename to plugins/_memory/tools/memory_save.pyindex 0a9304c06..28bb68d63 100644--- a/plugins/memory/tools/memory_save.py+++ b/plugins/_memory/tools/memory_save.py@@ -1,5 +1,5 @@from helpers.tool import Tool, Response-from plugins.memory.helpers.memory import Memory+from plugins._memory.helpers.memory import Memorydiff --git a/plugins/memory/webui/config.html b/plugins/_memory/webui/config.htmlsimilarity index 99%rename from plugins/memory/webui/config.htmlrename to plugins/_memory/webui/config.htmlindex b1e9214aa..54dcaec02 100644--- a/plugins/memory/webui/config.html+++ b/plugins/_memory/webui/config.html@@ -50,7 +50,7 @@</div><div class="field-control"><button class="btn btn-field"- @click="openModal('/plugins/memory/webui/memory-dashboard.html');">+ @click="openModal('/plugins/_memory/webui/memory-dashboard.html');">Open Dashboard</button></div>diff --git a/plugins/memory/webui/main.html b/plugins/_memory/webui/main.htmlsimilarity index 71%rename from plugins/memory/webui/main.htmlrename to plugins/_memory/webui/main.htmlindex 58ec2cc1e..c81128703 100644--- a/plugins/memory/webui/main.html+++ b/plugins/_memory/webui/main.html@@ -6,6 +6,6 @@<title>Memory Dashboard</title></head><body>- <x-component path="/plugins/memory/webui/memory-dashboard.html"></x-component>+ <x-component path="/plugins/_memory/webui/memory-dashboard.html"></x-component></body></html>diff --git a/plugins/memory/webui/memory-dashboard-store.js b/plugins/_memory/webui/memory-dashboard-store.jssimilarity index 98%rename from plugins/memory/webui/memory-dashboard-store.jsrename to plugins/_memory/webui/memory-dashboard-store.jsindex d2b61cafa..bf5ec0bba 100644--- a/plugins/memory/webui/memory-dashboard-store.js+++ b/plugins/_memory/webui/memory-dashboard-store.js@@ -3,7 +3,7 @@ import { getContext } from "/index.js";import * as API from "/js/api.js";import { openModal, closeModal } from "/js/modals.js";import { store as notificationStore } from "/components/notifications/notification-store.js";-const MEMORY_DASHBOARD_API = "/plugins/memory/memory_dashboard";+const MEMORY_DASHBOARD_API = "/plugins/_memory/memory_dashboard";// Helper function for toastsfunction justToast(text, type = "info", timeout = 5000) {@@ -54,7 +54,7 @@ const memoryDashboardStore = {pollingEnabled: false,async openModal() {- await openModal("../plugins/memory/webui/memory-dashboard.html");+ await openModal("../plugins/_memory/webui/memory-dashboard.html");},init() {@@ -449,7 +449,7 @@ ${memory.content_full}this.editMode = false;this.editMemoryBackup = null;// Use global modal system- openModal("../plugins/memory/webui/memory-detail-modal.html");+ openModal("../plugins/_memory/webui/memory-detail-modal.html");},closeMemoryDetails() {diff --git a/plugins/memory/webui/memory-dashboard.html b/plugins/_memory/webui/memory-dashboard.htmlsimilarity index 99%rename from plugins/memory/webui/memory-dashboard.htmlrename to plugins/_memory/webui/memory-dashboard.htmlindex c5f46a6fd..f58154610 100644--- a/plugins/memory/webui/memory-dashboard.html+++ b/plugins/_memory/webui/memory-dashboard.html@@ -3,7 +3,7 @@<head><title>Memory Dashboard</title><script type="module">- import { store } from "/plugins/memory/webui/memory-dashboard-store.js";+ import { store } from "/plugins/_memory/webui/memory-dashboard-store.js";</script></head>diff --git a/plugins/memory/webui/memory-detail-modal.html b/plugins/_memory/webui/memory-detail-modal.htmlsimilarity index 100%rename from plugins/memory/webui/memory-detail-modal.htmlrename to plugins/_memory/webui/memory-detail-modal.htmldiff --git a/plugins/plugin_installer/api/plugin_install.py b/plugins/_plugin_installer/api/plugin_install.pysimilarity index 90%rename from plugins/plugin_installer/api/plugin_install.pyrename to plugins/_plugin_installer/api/plugin_install.pyindex 7de86446c..5e21a0802 100644--- a/plugins/plugin_installer/api/plugin_install.py+++ b/plugins/_plugin_installer/api/plugin_install.py@@ -3,7 +3,7 @@ from __future__ import annotationsfrom helpers.api import ApiHandler, Input, Output, Requestfrom werkzeug.datastructures import FileStorage-from plugins.plugin_installer.helpers.install import (+from plugins._plugin_installer.helpers.install import (get_marketplace_index,install_from_git,install_uploaded_zip,@@ -42,10 +42,11 @@ class PluginInstall(ApiHandler):def _install_git(self, input: dict) -> dict:git_url = (input.get("git_url", "") or "").strip()git_token = (input.get("git_token", "") or "").strip() or None+ plugin_name = input.get("plugin_name", "")if not git_url:return {"success": False, "error": "Git URL is required"}- return install_from_git(git_url, git_token)+ return install_from_git(url=git_url, token=git_token, plugin_name=plugin_name)def _fetch_index(self, input: dict) -> dict:return {"success": True, **get_marketplace_index()}diff --git a/plugins/plugin_installer/extensions/webui/plugins-list-header-buttons/install-buttons.html b/plugins/_plugin_installer/extensions/webui/plugins-list-header-buttons/install-buttons.htmlsimilarity index 55%rename from plugins/plugin_installer/extensions/webui/plugins-list-header-buttons/install-buttons.htmlrename to plugins/_plugin_installer/extensions/webui/plugins-list-header-buttons/install-buttons.htmlindex 58f6434cc..33f6657e3 100644--- a/plugins/plugin_installer/extensions/webui/plugins-list-header-buttons/install-buttons.html+++ b/plugins/_plugin_installer/extensions/webui/plugins-list-header-buttons/install-buttons.html@@ -1,11 +1,11 @@<span x-data><script type="module">- import { store } from "/plugins/plugin_installer/webui/pluginInstallStore.js";+ import { store } from "/plugins/_plugin_installer/webui/pluginInstallStore.js";</script><button type="button"class="button confirm"- @click="openModal('../plugins/plugin_installer/webui/main.html')">+ @click="openModal('../plugins/_plugin_installer/webui/main.html')"><span class="icon material-symbols-outlined">add</span> Install</button></span>diff --git a/plugins/plugin_installer/helpers/__init__.py b/plugins/_plugin_installer/helpers/__init__.pysimilarity index 100%rename from plugins/plugin_installer/helpers/__init__.pyrename to plugins/_plugin_installer/helpers/__init__.pydiff --git a/plugins/plugin_installer/helpers/install.py b/plugins/_plugin_installer/helpers/install.pysimilarity index 77%rename from plugins/plugin_installer/helpers/install.pyrename to plugins/_plugin_installer/helpers/install.pyindex f751b773e..1c0a406d8 100644--- a/plugins/plugin_installer/helpers/install.py+++ b/plugins/_plugin_installer/helpers/install.py@@ -2,17 +2,15 @@ from __future__ import annotationsimport jsonimport os-import reimport shutilimport timeimport urllib.requestimport uuidimport zipfilefrom pathlib import Path-from typing import Any, Optional+from typing import Anyfrom helpers import files-from helpers.git import extract_author_repofrom helpers import yaml as yaml_helperfrom helpers.plugins import (META_FILE_NAME,@@ -28,34 +26,14 @@ def _get_user_plugins_dir() -> str:return files.get_abs_path(files.USER_DIR, files.PLUGINS_DIR)-def _derive_git_plugin_name(url: str) -> str:- """Derive the canonical plugin ID from a Git repository URL."""- parts = extract_author_repo(url)- repo_name = "__".join(- cleaned- for part in parts- if (cleaned := re.sub(r"_+", "_", re.sub(r"[^0-9A-Za-z]+", "_", part)).strip("_"))- )- if not repo_name:- raise ValueError("Could not derive plugin name from URL")- return repo_name---def _derive_zip_plugin_name(- plugin_root: str, extract_dir: str, original_filename: str | None-) -> str:- """Resolve the plugin ID for an uploaded ZIP archive."""- if plugin_root != extract_dir:- return os.path.basename(plugin_root)-- upload_name = Path((original_filename or "").strip()).name- plugin_name = Path(upload_name).stem+def _get_plugin_name(meta: PluginMetadata) -> str:+ plugin_name = (meta.name or "").strip()if not plugin_name:- raise ValueError("Could not derive plugin name from uploaded filename")+ raise ValueError(f"{META_FILE_NAME} is missing required field 'name'")return plugin_name-def validate_plugin_dir(path: str) -> PluginMetadata:+def validate_plugin_dir(path: str, plugin_name:str="") -> PluginMetadata:"""Check directory contains plugin.yaml and return parsed metadata.Raises ValueError if plugin.yaml is missing or invalid."""meta_path = os.path.join(path, META_FILE_NAME)@@ -64,7 +42,10 @@ def validate_plugin_dir(path: str) -> PluginMetadata:with open(meta_path, "r", encoding="utf-8") as f:content = f.read()data = yaml_helper.loads(content)- return PluginMetadata.model_validate(data)+ model = PluginMetadata.model_validate(data)+ if plugin_name and plugin_name != model.name:+ raise ValueError(f"Plugin name is incorrect: expected '{plugin_name}', got '{model.name}'. The author needs to correct this in the plugin.yaml file.")+ return modeldef check_plugin_conflict(name: str) -> None:@@ -130,7 +111,7 @@ def install_from_zip(zip_path: str, original_filename: str | None = None) -> dic# Find plugin.yamlplugin_root = _find_plugin_root(extract_dir)meta = validate_plugin_dir(plugin_root)- plugin_name = _derive_zip_plugin_name(plugin_root, extract_dir, original_filename)+ plugin_name = _get_plugin_name(meta)check_plugin_conflict(plugin_name)@@ -155,17 +136,14 @@ def install_from_zip(zip_path: str, original_filename: str | None = None) -> dicpass-def install_from_git(url: str, token: Optional[str] = None) -> dict:+def install_from_git(url: str, token: str | None = None, plugin_name: str="") -> dict:"""Clone git repo into usr/plugins/, validate plugin.yaml.Returns dict with plugin name and metadata."""from helpers.git import clone_repo- repo_name = _derive_git_plugin_name(url)-- check_plugin_conflict(repo_name)-- dest = os.path.join(_get_user_plugins_dir(), repo_name)- os.makedirs(os.path.dirname(dest), exist_ok=True)+ temp_name = f"tmp_plugin_{time.strftime('%Y%m%d_%H%M%S')}_{uuid.uuid4().hex[:8]}"+ dest = files.get_abs_path(files.TEMP_DIR, "plugins_installer", temp_name)+ files.create_dir_safe(dest)try:clone_repo(url, dest, token=token or None)@@ -175,19 +153,23 @@ def install_from_git(url: str, token: Optional[str] = None) -> dict:raise ValueError(f"Git clone failed: {e}") from etry:- meta = validate_plugin_dir(dest)+ meta = validate_plugin_dir(dest, plugin_name=plugin_name)except ValueError:# No plugin.yaml — remove cloned reposhutil.rmtree(dest, ignore_errors=True)raise- after_plugin_change([repo_name])+ plugin_name = _get_plugin_name(meta)+ check_plugin_conflict(plugin_name)+ final_dest = os.path.join(_get_user_plugins_dir(), plugin_name)+ files.move_dir(dest, final_dest)+ after_plugin_change([plugin_name])return {"success": True,- "plugin_name": repo_name,- "title": meta.title or repo_name,- "path": files.deabsolute_path(dest),+ "plugin_name": plugin_name,+ "title": meta.title or plugin_name,+ "path": files.deabsolute_path(final_dest),}@@ -206,12 +188,7 @@ def get_marketplace_index() -> dict[str, Any]:for key, plugin_data in plugins.items():if not isinstance(plugin_data, dict):continue- github_url = plugin_data.get("github", "")- try:- plugin_name = _derive_git_plugin_name(github_url)- except ValueError:- continue- if plugin_name in installed_dirs:+ if key in installed_dirs:installed_keys.append(key)return {"index": index_data, "installed_plugins": installed_keys}diff --git a/plugins/plugin_installer/plugin.yaml b/plugins/_plugin_installer/plugin.yamlsimilarity index 87%rename from plugins/plugin_installer/plugin.yamlrename to plugins/_plugin_installer/plugin.yamlindex 845fefef4..7bef7ee77 100644--- a/plugins/plugin_installer/plugin.yaml+++ b/plugins/_plugin_installer/plugin.yaml@@ -1,3 +1,4 @@+name: _plugin_installertitle: Plugin Installerdescription: Install plugins from ZIP files, Git repositories, or the community index.version: 1.0.0diff --git a/plugins/plugin_installer/webui/install-detail.html b/plugins/_plugin_installer/webui/install-detail.htmlsimilarity index 99%rename from plugins/plugin_installer/webui/install-detail.htmlrename to plugins/_plugin_installer/webui/install-detail.htmlindex c5b2e4da3..f3ed44437 100644--- a/plugins/plugin_installer/webui/install-detail.html+++ b/plugins/_plugin_installer/webui/install-detail.html@@ -2,7 +2,7 @@<head><title>Plugin Details</title><script type="module">- import { store } from "/plugins/plugin_installer/webui/pluginInstallStore.js";+ import { store } from "/plugins/_plugin_installer/webui/pluginInstallStore.js";</script></head><body>diff --git a/plugins/plugin_installer/webui/install-git.html b/plugins/_plugin_installer/webui/install-git.htmlsimilarity index 98%rename from plugins/plugin_installer/webui/install-git.htmlrename to plugins/_plugin_installer/webui/install-git.htmlindex d4c66f951..0d3ce3fcb 100644--- a/plugins/plugin_installer/webui/install-git.html+++ b/plugins/_plugin_installer/webui/install-git.html@@ -2,7 +2,7 @@<head><title>Install Plugin from Git</title><script type="module">- import { store } from "/plugins/plugin_installer/webui/pluginInstallStore.js";+ import { store } from "/plugins/_plugin_installer/webui/pluginInstallStore.js";</script></head><body>diff --git a/plugins/plugin_installer/webui/install-index.html b/plugins/_plugin_installer/webui/install-index.htmlsimilarity index 99%rename from plugins/plugin_installer/webui/install-index.htmlrename to plugins/_plugin_installer/webui/install-index.htmlindex c1db98331..cfe0e4d22 100644--- a/plugins/plugin_installer/webui/install-index.html+++ b/plugins/_plugin_installer/webui/install-index.html@@ -2,7 +2,7 @@<head><title>Browse Plugins</title><script type="module">- import { store } from "/plugins/plugin_installer/webui/pluginInstallStore.js";+ import { store } from "/plugins/_plugin_installer/webui/pluginInstallStore.js";</script></head><body>diff --git a/plugins/plugin_installer/webui/install-zip.html b/plugins/_plugin_installer/webui/install-zip.htmlsimilarity index 98%rename from plugins/plugin_installer/webui/install-zip.htmlrename to plugins/_plugin_installer/webui/install-zip.htmlindex ea28816e6..75798cd3c 100644--- a/plugins/plugin_installer/webui/install-zip.html+++ b/plugins/_plugin_installer/webui/install-zip.html@@ -2,7 +2,7 @@<head><title>Install Plugin from ZIP</title><script type="module">- import { store } from "/plugins/plugin_installer/webui/pluginInstallStore.js";+ import { store } from "/plugins/_plugin_installer/webui/pluginInstallStore.js";</script></head><body>diff --git a/plugins/plugin_installer/webui/main.html b/plugins/_plugin_installer/webui/main.htmlsimilarity index 97%rename from plugins/plugin_installer/webui/main.htmlrename to plugins/_plugin_installer/webui/main.htmlindex bf7a98089..f667f539e 100644--- a/plugins/plugin_installer/webui/main.html+++ b/plugins/_plugin_installer/webui/main.html@@ -3,7 +3,7 @@<head><title>Install Plugin</title><script type="module">- import { store } from "/plugins/plugin_installer/webui/pluginInstallStore.js";+ import { store } from "/plugins/_plugin_installer/webui/pluginInstallStore.js";</script></head>@@ -35,15 +35,15 @@</ul><template x-if="$store.pluginInstallStore.activeTab === 'store'">- <x-component path="/plugins/plugin_installer/webui/install-index.html"></x-component>+ <x-component path="/plugins/_plugin_installer/webui/install-index.html"></x-component></template><template x-if="$store.pluginInstallStore.activeTab === 'git'">- <x-component path="/plugins/plugin_installer/webui/install-git.html"></x-component>+ <x-component path="/plugins/_plugin_installer/webui/install-git.html"></x-component></template><template x-if="$store.pluginInstallStore.activeTab === 'zip'">- <x-component path="/plugins/plugin_installer/webui/install-zip.html"></x-component>+ <x-component path="/plugins/_plugin_installer/webui/install-zip.html"></x-component></template></div>diff --git a/plugins/plugin_installer/webui/pluginInstallStore.js b/plugins/_plugin_installer/webui/pluginInstallStore.jssimilarity index 95%rename from plugins/plugin_installer/webui/pluginInstallStore.jsrename to plugins/_plugin_installer/webui/pluginInstallStore.jsindex 859287b57..b69df537c 100644--- a/plugins/plugin_installer/webui/pluginInstallStore.js+++ b/plugins/_plugin_installer/webui/pluginInstallStore.js@@ -8,7 +8,7 @@ import { store as imageViewerStore } from "/components/modals/image-viewer/imageimport { store as pluginListStore } from "/components/plugins/list/pluginListStore.js";import { store as pluginInitStore } from "/components/plugins/list/plugin-init-store.js";-const PLUGIN_API = "plugins/plugin_installer/plugin_install";+const PLUGIN_API = "plugins/_plugin_installer/plugin_install";const PER_PAGE = 20;const SECURITY_WARNING = {@@ -82,23 +82,6 @@ const model = {return url.replace("https://github.com/", "https://raw.githubusercontent.com/");},- _pluginName(plugin) {- const githubUrl = (plugin?.github || "").trim().replace(/\.git$/i, "");- const match = githubUrl.match(/github\.com\/([^/]+)\/([^/]+)/i);- if (!match) return plugin?.key || "";-- const parts = [match[1], match[2]]- .map((part) =>- String(part)- .replace(/[^0-9A-Za-z]+/g, "_")- .replace(/_+/g, "_")- .replace(/^_+|_+$/g, "")- )- .filter(Boolean);-- return parts.join("__") || plugin?.key || "";- },-_pluginPrimaryTag(plugin) {const tags = Array.isArray(plugin?.tags) ? plugin.tags.filter(Boolean) : [];return tags[0] || "";@@ -359,7 +342,7 @@ const model = {},openDetail(plugin) {- this.selectedPlugin = { ...plugin, name: this._pluginName(plugin) };+ this.selectedPlugin = { ...plugin, name: plugin?.key || "" };this.error = "";this.result = null;this.installedPluginInfo = null;@@ -369,7 +352,7 @@ const model = {this.fetchInstalledPluginInfo(this.selectedPlugin.name);}this.fetchReadme(this.selectedPlugin);- openModal("/plugins/plugin_installer/webui/install-detail.html");+ openModal("/plugins/_plugin_installer/webui/install-detail.html");},async fetchReadme(plugin) {@@ -428,6 +411,7 @@ const model = {const data = await api.callJsonApi(PLUGIN_API, {action: "install_git",git_url: plugin.github,+ plugin_name: plugin.key,});if (!data.success) {@@ -439,13 +423,14 @@ const model = {if (installedKey && !this.installedPlugins.includes(installedKey)) {this.installedPlugins = [...this.installedPlugins, installedKey];}+this.selectedPlugin = {...plugin,- ...(this.selectedPlugin || {}),+ name: plugin.key || "",installed: true,};this.detailThumbnailUrl = this.getThumbnailUrl(this.selectedPlugin);- this.fetchInstalledPluginInfo(data.plugin_name);+ this.fetchInstalledPluginInfo(plugin.key || data.plugin_name);toastFrontendSuccess(`Plugin "${data.title || data.plugin_name}" installed`,diff --git a/plugins/plugin_scan/api/plugin_scan_queue.py b/plugins/_plugin_scan/api/plugin_scan_queue.pysimilarity index 100%rename from plugins/plugin_scan/api/plugin_scan_queue.pyrename to plugins/_plugin_scan/api/plugin_scan_queue.pydiff --git a/plugins/plugin_scan/api/plugin_scan_start.py b/plugins/_plugin_scan/api/plugin_scan_start.pysimilarity index 100%rename from plugins/plugin_scan/api/plugin_scan_start.pyrename to plugins/_plugin_scan/api/plugin_scan_start.pydiff --git a/plugins/plugin_scan/extensions/webui/confirm_dialog_after_render/add-marketplace-scan-action.js b/plugins/_plugin_scan/extensions/webui/confirm_dialog_after_render/add-marketplace-scan-action.jssimilarity index 94%rename from plugins/plugin_scan/extensions/webui/confirm_dialog_after_render/add-marketplace-scan-action.jsrename to plugins/_plugin_scan/extensions/webui/confirm_dialog_after_render/add-marketplace-scan-action.jsindex a541c9f54..769e2c274 100644--- a/plugins/plugin_scan/extensions/webui/confirm_dialog_after_render/add-marketplace-scan-action.js+++ b/plugins/_plugin_scan/extensions/webui/confirm_dialog_after_render/add-marketplace-scan-action.js@@ -1,4 +1,4 @@-import { store as pluginScanStore } from "/plugins/plugin_scan/webui/plugin-scan-store.js";+import { store as pluginScanStore } from "../../../webui/plugin-scan-store.js";const NOTE_CLASS = "confirm-dialog-extension-note";const BUTTON_CLASS = "confirm-dialog-plugin-scan-button";diff --git a/plugins/plugin_scan/plugin.yaml b/plugins/_plugin_scan/plugin.yamlsimilarity index 89%rename from plugins/plugin_scan/plugin.yamlrename to plugins/_plugin_scan/plugin.yamlindex 069d9547e..2bc9e3d14 100644--- a/plugins/plugin_scan/plugin.yaml+++ b/plugins/_plugin_scan/plugin.yaml@@ -1,3 +1,4 @@+name: _plugin_scantitle: Plugin Scannerdescription: Security scanner for third-party A0 plugins.version: 1.0.0diff --git a/plugins/plugin_scan/webui/main.html b/plugins/_plugin_scan/webui/main.htmlsimilarity index 71%rename from plugins/plugin_scan/webui/main.htmlrename to plugins/_plugin_scan/webui/main.htmlindex c63702372..ab5de3c19 100644--- a/plugins/plugin_scan/webui/main.html+++ b/plugins/_plugin_scan/webui/main.html@@ -6,6 +6,6 @@<title>Plugin Scanner</title></head><body>- <x-component path="/plugins/plugin_scan/webui/plugin-scan.html"></x-component>+ <x-component path="/plugins/_plugin_scan/webui/plugin-scan.html"></x-component></body></html>diff --git a/plugins/plugin_scan/webui/plugin-scan-checks.json b/plugins/_plugin_scan/webui/plugin-scan-checks.jsonsimilarity index 100%rename from plugins/plugin_scan/webui/plugin-scan-checks.jsonrename to plugins/_plugin_scan/webui/plugin-scan-checks.jsondiff --git a/plugins/plugin_scan/webui/plugin-scan-prompt.md b/plugins/_plugin_scan/webui/plugin-scan-prompt.mdsimilarity index 100%rename from plugins/plugin_scan/webui/plugin-scan-prompt.mdrename to plugins/_plugin_scan/webui/plugin-scan-prompt.mddiff --git a/plugins/plugin_scan/webui/plugin-scan-store.js b/plugins/_plugin_scan/webui/plugin-scan-store.jssimilarity index 93%rename from plugins/plugin_scan/webui/plugin-scan-store.jsrename to plugins/_plugin_scan/webui/plugin-scan-store.jsindex 4feed93a7..9a0581fa2 100644--- a/plugins/plugin_scan/webui/plugin-scan-store.js+++ b/plugins/_plugin_scan/webui/plugin-scan-store.js@@ -3,7 +3,7 @@ import { createStore } from "/js/AlpineStore.js";import * as api from "/js/api.js";import { openModal } from "/js/modals.js";-const BASE = "/plugins/plugin_scan/webui";+const BASE = "/plugins/_plugin_scan/webui";/** @type {{ ratings: Record<string, {icon:string,label:string}>, checks: Record<string, {label:string,detail:string,criteria:Record<string,string>}> } | null} */let _config = null;@@ -94,7 +94,7 @@ export const store = createStore("pluginScan", {async openModal(url) {this.gitUrl = url || "";- await openModal("/plugins/plugin_scan/webui/plugin-scan.html");+ await openModal("/plugins/_plugin_scan/webui/plugin-scan.html");},async buildPrompt() {@@ -165,14 +165,14 @@ export const store = createStore("pluginScan", {if (_running) {try {- await api.callJsonApi("/plugins/plugin_scan/plugin_scan_queue", { context: ctxId, text: capturedPrompt, queued: true });+ await api.callJsonApi("/plugins/_plugin_scan/plugin_scan_queue", { context: ctxId, text: capturedPrompt, queued: true });} catch { /* best-effort */ }_queue.push({ gen, ctxId, prompt: capturedPrompt });this.queued = true;this.scanning = false;} else {try {- await api.callJsonApi("/plugins/plugin_scan/plugin_scan_queue", { context: ctxId, text: capturedPrompt });+ await api.callJsonApi("/plugins/_plugin_scan/plugin_scan_queue", { context: ctxId, text: capturedPrompt });} catch { /* best-effort */ }this.queued = false;this.scanning = true;@@ -184,7 +184,7 @@ export const store = createStore("pluginScan", {async _runNext(gen, ctxId, prompt) {_running = { gen, ctxId };try {- await api.callJsonApi("/plugins/plugin_scan/plugin_scan_start", { text: prompt, context: ctxId });+ await api.callJsonApi("/plugins/_plugin_scan/plugin_scan_start", { text: prompt, context: ctxId });await this._pollLoop(gen, ctxId);} catch (/** @type {any} */ e) {if (gen === _pollGen) {diff --git a/plugins/plugin_scan/webui/plugin-scan.html b/plugins/_plugin_scan/webui/plugin-scan.htmlsimilarity index 98%rename from plugins/plugin_scan/webui/plugin-scan.htmlrename to plugins/_plugin_scan/webui/plugin-scan.htmlindex 428f269fc..e723a4922 100644--- a/plugins/plugin_scan/webui/plugin-scan.html+++ b/plugins/_plugin_scan/webui/plugin-scan.html@@ -2,7 +2,7 @@<head><title>Plugin Scanner</title><script type="module">- import { store } from "/plugins/plugin_scan/webui/plugin-scan-store.js";+ import { store } from "/plugins/_plugin_scan/webui/plugin-scan-store.js";</script></head><body>diff --git a/plugins/text_editor/default_config.yaml b/plugins/_text_editor/default_config.yamlsimilarity index 100%rename from plugins/text_editor/default_config.yamlrename to plugins/_text_editor/default_config.yamldiff --git a/plugins/text_editor/extensions/.gitkeep b/plugins/_text_editor/extensions/.gitkeepsimilarity index 100%rename from plugins/text_editor/extensions/.gitkeeprename to plugins/_text_editor/extensions/.gitkeepdiff --git a/plugins/text_editor/extensions/python/system_prompt/_15_text_editor_prompt.py b/plugins/_text_editor/extensions/python/system_prompt/_15_text_editor_prompt.pysimilarity index 80%rename from plugins/text_editor/extensions/python/system_prompt/_15_text_editor_prompt.pyrename to plugins/_text_editor/extensions/python/system_prompt/_15_text_editor_prompt.pyindex 0779d9f87..cd418d549 100644--- a/plugins/text_editor/extensions/python/system_prompt/_15_text_editor_prompt.py+++ b/plugins/_text_editor/extensions/python/system_prompt/_15_text_editor_prompt.py@@ -11,7 +11,10 @@ class TextEditorPrompt(Extension):loop_data: LoopData = LoopData(),**kwargs,):- config = plugins.get_plugin_config("text_editor", agent=self.agent) or {}+ if not self.agent:+ return++ config = plugins.get_plugin_config("_text_editor", agent=self.agent) or {}default_line_count = config.get("default_line_count", 100)prompt = self.agent.read_prompt("agent.system.tool.text_editor.md",diff --git a/plugins/text_editor/helpers/__init__.py b/plugins/_text_editor/helpers/__init__.pysimilarity index 100%rename from plugins/text_editor/helpers/__init__.pyrename to plugins/_text_editor/helpers/__init__.pydiff --git a/plugins/text_editor/helpers/file_ops.py b/plugins/_text_editor/helpers/file_ops.pysimilarity index 100%rename from plugins/text_editor/helpers/file_ops.pyrename to plugins/_text_editor/helpers/file_ops.pydiff --git a/plugins/text_editor/plugin.yaml b/plugins/_text_editor/plugin.yamlsimilarity index 91%rename from plugins/text_editor/plugin.yamlrename to plugins/_text_editor/plugin.yamlindex 4f3e26af4..f463704dc 100644--- a/plugins/text_editor/plugin.yaml+++ b/plugins/_text_editor/plugin.yaml@@ -1,3 +1,4 @@+name: _text_editortitle: Text Editordescription: Native tool to read, write, and patch text files in an LLM-friendly way.version: 1.0.0diff --git a/plugins/text_editor/prompts/agent.system.tool.text_editor.md b/plugins/_text_editor/prompts/agent.system.tool.text_editor.mdsimilarity index 100%rename from plugins/text_editor/prompts/agent.system.tool.text_editor.mdrename to plugins/_text_editor/prompts/agent.system.tool.text_editor.mddiff --git a/plugins/text_editor/prompts/fw.text_editor.patch_error.md b/plugins/_text_editor/prompts/fw.text_editor.patch_error.mdsimilarity index 100%rename from plugins/text_editor/prompts/fw.text_editor.patch_error.mdrename to plugins/_text_editor/prompts/fw.text_editor.patch_error.mddiff --git a/plugins/text_editor/prompts/fw.text_editor.patch_need_read.md b/plugins/_text_editor/prompts/fw.text_editor.patch_need_read.mdsimilarity index 100%rename from plugins/text_editor/prompts/fw.text_editor.patch_need_read.mdrename to plugins/_text_editor/prompts/fw.text_editor.patch_need_read.mddiff --git a/plugins/text_editor/prompts/fw.text_editor.patch_ok.md b/plugins/_text_editor/prompts/fw.text_editor.patch_ok.mdsimilarity index 100%rename from plugins/text_editor/prompts/fw.text_editor.patch_ok.mdrename to plugins/_text_editor/prompts/fw.text_editor.patch_ok.mddiff --git a/plugins/text_editor/prompts/fw.text_editor.patch_stale_read.md b/plugins/_text_editor/prompts/fw.text_editor.patch_stale_read.mdsimilarity index 100%rename from plugins/text_editor/prompts/fw.text_editor.patch_stale_read.mdrename to plugins/_text_editor/prompts/fw.text_editor.patch_stale_read.mddiff --git a/plugins/text_editor/prompts/fw.text_editor.read_error.md b/plugins/_text_editor/prompts/fw.text_editor.read_error.mdsimilarity index 100%rename from plugins/text_editor/prompts/fw.text_editor.read_error.mdrename to plugins/_text_editor/prompts/fw.text_editor.read_error.mddiff --git a/plugins/text_editor/prompts/fw.text_editor.read_ok.md b/plugins/_text_editor/prompts/fw.text_editor.read_ok.mdsimilarity index 100%rename from plugins/text_editor/prompts/fw.text_editor.read_ok.mdrename to plugins/_text_editor/prompts/fw.text_editor.read_ok.mddiff --git a/plugins/text_editor/prompts/fw.text_editor.write_error.md b/plugins/_text_editor/prompts/fw.text_editor.write_error.mdsimilarity index 100%rename from plugins/text_editor/prompts/fw.text_editor.write_error.mdrename to plugins/_text_editor/prompts/fw.text_editor.write_error.mddiff --git a/plugins/text_editor/prompts/fw.text_editor.write_ok.md b/plugins/_text_editor/prompts/fw.text_editor.write_ok.mdsimilarity index 100%rename from plugins/text_editor/prompts/fw.text_editor.write_ok.mdrename to plugins/_text_editor/prompts/fw.text_editor.write_ok.mddiff --git a/plugins/text_editor/tools/text_editor.py b/plugins/_text_editor/tools/text_editor.pysimilarity index 98%rename from plugins/text_editor/tools/text_editor.pyrename to plugins/_text_editor/tools/text_editor.pyindex 529bd001e..78c667482 100644--- a/plugins/text_editor/tools/text_editor.py+++ b/plugins/_text_editor/tools/text_editor.py@@ -1,7 +1,7 @@from helpers.tool import Tool, Responsefrom helpers.extension import call_extensions_asyncfrom helpers import plugins, runtime-from plugins.text_editor.helpers.file_ops import (+from plugins._text_editor.helpers.file_ops import (FileInfo,read_file,write_file,@@ -312,7 +312,7 @@ def _check_mtime(agent, info: FileInfo) -> str:# ------------------------------------------------------------------def _get_config(agent) -> dict:- config = plugins.get_plugin_config("text_editor", agent=agent) or {}+ config = plugins.get_plugin_config("_text_editor", agent=agent) or {}return {"max_line_tokens": int(config.get("max_line_tokens", 500)),"default_line_count": int(config.get("default_line_count", 100)),diff --git a/plugins/text_editor/webui/config.html b/plugins/_text_editor/webui/config.htmlsimilarity index 100%rename from plugins/text_editor/webui/config.htmlrename to plugins/_text_editor/webui/config.htmldiff --git a/tmp/plugins_installer/tmp_plugin_20260310_203515_4e21b18c b/tmp/plugins_installer/tmp_plugin_20260310_203515_4e21b18cnew file mode 160000index 000000000..861209a0c--- /dev/null+++ b/tmp/plugins_installer/tmp_plugin_20260310_203515_4e21b18c@@ -0,0 +1 @@+Subproject commit 861209a0ca379a024e8a80964967fc5ea8f04d7cdiff --git a/tools/knowledge_tool._py b/tools/knowledge_tool._pyindex e54c07a92..8102eb848 100644--- a/tools/knowledge_tool._py+++ b/tools/knowledge_tool._py@@ -1,7 +1,7 @@import asynciofrom helpers import dotenv, perplexity_search, duckduckgo_search-from plugins.memory.helpers.memory import Memory-from plugins.memory.tools.memory_load import DEFAULT_THRESHOLD as DEFAULT_MEMORY_THRESHOLD+from plugins._memory.helpers.memory import Memory+from plugins._memory.tools.memory_load import DEFAULT_THRESHOLD as DEFAULT_MEMORY_THRESHOLDfrom helpers.tool import Tool, Responsefrom helpers.document_query import DocumentQueryHelperdiff --git a/usr/plugins/a0_community_plugins__linear b/usr/plugins/a0_community_plugins__lineardeleted file mode 160000index 337839c21..000000000--- a/usr/plugins/a0_community_plugins__linear+++ /dev/null@@ -1 +0,0 @@-Subproject commit 337839c21c250881bf7063dbc9421c7750989ed1diff --git a/usr/plugins/example_plugin b/usr/plugins/example_pluginnew file mode 160000index 000000000..8348aa7e7--- /dev/null+++ b/usr/plugins/example_plugin@@ -0,0 +1 @@+Subproject commit 8348aa7e7fdbea5ccedcc55316ee0473f5346bdadiff --git a/webui/components/plugins/list/plugin-list.html b/webui/components/plugins/list/plugin-list.htmlindex 78178cf05..3bba312c2 100644--- a/webui/components/plugins/list/plugin-list.html+++ b/webui/components/plugins/list/plugin-list.html@@ -178,7 +178,7 @@</template><template x-if="$store.pluginListStore.activeTab === 'marketplace'">- <x-component path="/plugins/plugin_installer/webui/install-index.html"></x-component>+ <x-component path="/plugins/_plugin_installer/webui/install-index.html"></x-component></template></div></template>diff --git a/webui/components/welcome/welcome-store.js b/webui/components/welcome/welcome-store.jsindex 791226d45..6afbdd04d 100644--- a/webui/components/welcome/welcome-store.js+++ b/webui/components/welcome/welcome-store.js@@ -1,7 +1,7 @@import { createStore } from "/js/AlpineStore.js";import { getContext } from "/index.js";import { store as chatsStore } from "/components/sidebar/chats/chats-store.js";-import { store as memoryStore } from "/plugins/memory/webui/memory-dashboard-store.js";+import { store as memoryStore } from "../../../plugins/_memory/webui/memory-dashboard-store.js";import { store as projectsStore } from "/components/projects/projects-store.js";import { store as chatInputStore } from "/components/chat/input/input-store.js";import * as API from "/js/api.js";