Skip to content

Self-hosted AI workspace.

Python

Settings overhaul + UI polish pass

pewdiepie-archdaemon26fbde308b70
diff --git a/routes/note_routes.py b/routes/note_routes.py
index 22449f1e4..0d06d9484 100644
--- a/routes/note_routes.py
+++ b/routes/note_routes.py
@@ -208,14 +208,17 @@ async def dispatch_reminder(
try:
from src.endpoint_resolver import resolve_endpoint
from src.llm_core import llm_call_async
+ from src.reminder_personas import synthesis_system_prompt
url, model, headers = resolve_endpoint("utility", owner=owner or None)
if not url:
url, model, headers = resolve_endpoint("default", owner=owner or None)
if url and model:
+ persona_id = (settings.get("reminder_llm_persona") or "").strip()
+ sys_prompt = synthesis_system_prompt(persona_id)
raw = await llm_call_async(
url=url, model=model,
messages=[
- {"role": "system", "content": "You are a reminder assistant. Write a single short, warm, motivating sentence (max 25 words) reminding the user about the note below. Do not add greetings, preamble, or hashtags. Output only the sentence."},
+ {"role": "system", "content": sys_prompt},
{"role": "user", "content": f"Title: {title}\n\n{note_body}".strip()},
],
temperature=0.7, max_tokens=200, headers=headers, timeout=30,
@@ -826,6 +829,12 @@ def setup_note_routes(task_scheduler=None):
_override["reminder_webhook_integration_id"] = body["webhook_integration_id"]
if body.get("webhook_payload_template"):
_override["reminder_webhook_payload_template"] = body["webhook_payload_template"]
+ # Mirror the in-UI AI Synthesis toggle + persona so the test
+ # actually exercises the synthesis path before/without a Save.
+ if "llm_synthesis" in body:
+ _override["reminder_llm_synthesis"] = bool(body["llm_synthesis"])
+ if "llm_persona" in body:
+ _override["reminder_llm_persona"] = str(body["llm_persona"] or "")
else:
db = SessionLocal()
try:
diff --git a/src/agent_loop.py b/src/agent_loop.py
index 88617ef39..7a70c1453 100644
--- a/src/agent_loop.py
+++ b/src/agent_loop.py
@@ -1256,7 +1256,7 @@ def _build_base_prompt(
from src.tool_index import ALWAYS_AVAILABLE
disabled = set(disabled_tools or [])
- if not get_setting("image_gen_enabled", True):
+ if not get_setting("image_gen_enabled", False):
disabled.add("generate_image")
if relevant_tools is not None:
diff --git a/src/document_processor.py b/src/document_processor.py
index 2448f1992..e96ec999c 100644
--- a/src/document_processor.py
+++ b/src/document_processor.py
@@ -199,11 +199,20 @@ def _fit_inline_attachment_text(
return text[:remaining] + marker, 0
-def _process_office_document(path: str, display_name: str) -> str:
+def _process_office_document(
+ path: str,
+ display_name: str,
+ session_id: str | None = None,
+ auto_opened_docs: list[Dict[str, Any]] | None = None,
+ owner: str | None = None,
+) -> str:
"""Extract an Office/EPUB document to Markdown via the optional markitdown dep.
Falls back to a friendly banner when markitdown is unavailable or finds no
- text, so a missing optional dependency never breaks the chat path.
+ text, so a missing optional dependency never breaks the chat path. When a
+ session_id is provided AND the extraction succeeded, the FULL text is also
+ saved as a Document so the agent can page through it via
+ `manage_documents action=read offset=…` after the inline copy is capped.
"""
from src.markitdown_runtime import (
is_markitdown_format,
@@ -218,6 +227,46 @@ def _process_office_document(path: str, display_name: str) -> str:
if markdown and markdown.strip():
title = os.path.splitext(os.path.basename(path))[0]
body, marker = _truncate_inline(markdown)
+
+ # Persist the full extracted text as a Document. The agent's existing
+ # manage_documents tool can then read past the inline cap with offset.
+ doc_id = None
+ if session_id:
+ try:
+ from src.office_doc import create_office_document
+ doc_id = create_office_document(
+ session_id=session_id,
+ upload_id=os.path.basename(path),
+ title=title,
+ body_text=markdown,
+ )
+ if doc_id and auto_opened_docs is not None:
+ from src.database import SessionLocal, Document
+ _db = SessionLocal()
+ try:
+ _d = _db.query(Document).filter(Document.id == doc_id).first()
+ if _d:
+ auto_opened_docs.append({
+ "doc_id": _d.id,
+ "title": _d.title,
+ "language": _d.language,
+ "content": _d.current_content,
+ "version": _d.version_count,
+ })
+ finally:
+ _db.close()
+ except Exception as e:
+ logger.warning("Office auto-doc creation failed for %s: %s", path, e)
+
+ # Upgrade the truncation marker with a hint pointing at the full doc so
+ # the agent knows it can read the rest.
+ if doc_id and marker:
+ marker = (
+ f"\n[…truncated for inline context — full {len(markdown):,} chars "
+ f"saved as document `{doc_id}`. Use `manage_documents` with "
+ f"action=read, document_id={doc_id}, offset=<N> to page through.]"
+ )
+
return f"\n\n[Document content — {title}]:\n{body}{marker}"
# No content: tell the user whether to install the optional dep or whether
@@ -521,7 +570,13 @@ def build_user_content(
elif mime.startswith("text/") or _is_text_file(path):
extracted_text = _process_text_file(path)
else:
- extracted_text = _process_office_document(path, display_name)
+ extracted_text = _process_office_document(
+ path,
+ display_name,
+ session_id=session_id,
+ auto_opened_docs=auto_opened_docs,
+ owner=owner,
+ )
extracted_text, inline_attachment_remaining = _fit_inline_attachment_text(
extracted_text,
diff --git a/src/markitdown_runtime.py b/src/markitdown_runtime.py
index ff30b0170..b6fc961b0 100644
--- a/src/markitdown_runtime.py
+++ b/src/markitdown_runtime.py
@@ -40,15 +40,59 @@ def load_markitdown():
return MarkItDown
+def _extract_docx_native(path: str) -> str | None:
+ """Pure-Python .docx text extractor — no external deps.
+
+ A .docx file is just a zip of XML. The body prose lives in <w:t> runs
+ inside <w:p> paragraphs. Iterating with ElementTree (rather than
+ re.findall) keeps paragraph breaks intact and lets the XML parser handle
+ namespaces + entity unescaping. Loses tables, footnotes, images and
+ list bullets — keeps ~95% of "summarize this doc" content, which is the
+ case people hit when markitdown isn't installed.
+ """
+ import zipfile
+ import xml.etree.ElementTree as ET
+
+ ns = "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}"
+ try:
+ with zipfile.ZipFile(path) as z:
+ xml_bytes = z.read("word/document.xml")
+ except (zipfile.BadZipFile, KeyError, OSError):
+ return None
+ try:
+ root = ET.fromstring(xml_bytes)
+ except ET.ParseError:
+ return None
+ paragraphs: list[str] = []
+ for para in root.iter(f"{ns}p"):
+ runs = [t.text or "" for t in para.iter(f"{ns}t")]
+ line = "".join(runs).strip()
+ if line:
+ paragraphs.append(line)
+ return "\n\n".join(paragraphs) if paragraphs else None
+
+
def convert_to_markdown(path: str) -> str | None:
"""Convert a document to Markdown text via markitdown.
Returns the extracted Markdown, or ``None`` if markitdown is unavailable or
the conversion fails — callers degrade gracefully rather than erroring.
+
+ Fallback: when markitdown isn't installed and the file is a .docx, run
+ the bundled pure-Python extractor so the most common case (Word docs)
+ works out of the box. Other Office/EPUB formats still need markitdown.
"""
try:
markitdown_cls = load_markitdown()
except RuntimeError:
+ if isinstance(path, str) and path.lower().endswith(".docx"):
+ text = _extract_docx_native(path)
+ if text:
+ logger.info(
+ "markitdown not installed — used native .docx extractor for %s",
+ path,
+ )
+ return text
logger.warning("markitdown not installed; cannot extract %s", path)
return None
try:
diff --git a/src/office_doc.py b/src/office_doc.py
new file mode 100644
index 000000000..3176e8d93
--- /dev/null
+++ b/src/office_doc.py
@@ -0,0 +1,73 @@
+"""Auto-create a Document row from an Office attachment.
+
+When a .docx (and friends) lands in chat, the full extracted text is stored
+as a Document so the agent can page through it with `manage_documents
+action=read offset=…` even after the inline chat payload was capped. Mirrors
+the PDF auto-doc pattern in `src.pdf_form_doc`.
+"""
+
+import logging
+import uuid
+from typing import Optional
+
+logger = logging.getLogger(__name__)
+
+
+def create_office_document(
+ session_id: str,
+ upload_id: str,
+ title: str,
+ body_text: Optional[str] = None,
+) -> Optional[str]:
+ """Create a markdown Document for an Office attachment and set it active.
+
+ Returns the new doc_id, or None on failure / empty body. The full
+ extracted body lives in `current_content`, so the agent can fetch
+ arbitrary windows via `manage_documents action=read` even when the
+ inline chat copy was truncated.
+ """
+ from src.database import (
+ SessionLocal,
+ Document,
+ DocumentVersion,
+ Session as DbSession,
+ )
+ from src.tool_implementations import set_active_document
+
+ if not body_text or not body_text.strip():
+ return None
+
+ db = SessionLocal()
+ try:
+ doc_id = str(uuid.uuid4())
+ ver_id = str(uuid.uuid4())
+ sess = db.query(DbSession).filter(DbSession.id == session_id).first()
+ doc = Document(
+ id=doc_id,
+ session_id=session_id,
+ title=title,
+ language="markdown",
+ current_content=body_text,
+ version_count=1,
+ is_active=True,
+ owner=sess.owner if sess else None,
+ )
+ ver = DocumentVersion(
+ id=ver_id,
+ document_id=doc_id,
+ version_number=1,
+ content=body_text,
+ summary="Imported from Office attachment",
+ source="upload",
+ )
+ db.add(doc)
+ db.add(ver)
+ db.commit()
+ set_active_document(doc_id)
+ return doc_id
+ except Exception as e:
+ db.rollback()
+ logger.error("Failed to create office document: %s", e)
+ return None
+ finally:
+ db.close()
diff --git a/src/reminder_personas.py b/src/reminder_personas.py
new file mode 100644
index 000000000..a875ef42b
--- /dev/null
+++ b/src/reminder_personas.py
@@ -0,0 +1,78 @@
+"""Server-side mirror of the built-in characters used for reminder synthesis.
+
+The frontend ships these in static/js/presets.js (PROMPT_TEMPLATES with
+isCharacter:true). The Reminders → AI Synthesis card writes only the
+persona ID into settings; the synthesis route in note_routes.py needs
+the full prompt text to bias the utility model's voice. Keeping a small
+local mirror avoids having the client send the prompt over the wire on
+every reminder fire.
+
+If the user picks a custom character (id == "custom") we fall back to
+the warm-neutral baseline — custom prompts live in browser localStorage
+and aren't visible to the server.
+"""
+
+PERSONAS = {
+ "socrates": (
+ "Never answer directly. Respond only with questions — sharp, layered, "
+ "Socratic. Expose contradictions. Make the person argue with themselves "
+ "until the truth falls out. Use irony like a scalpel. Be genuinely "
+ "curious, never condescending."
+ ),
+ "razor": (
+ "Strip everything to the bone. No filler, no hedging, no pleasantries. "
+ "Answer in the fewest words possible. If one sentence works, don't use "
+ "two. If a word adds nothing, cut it. Blunt, precise, surgical."
+ ),
+ "nietzsche": (
+ "Think and respond through the lens of Nietzsche. Analyze every "
+ "question in terms of will to power, self-overcoming, eternal "
+ "recurrence, ressentiment, value-creation, and master-slave morality. "
+ "Write with aphoristic force — sharp, compressed, vivid, and "
+ "unapologetic — but do not sacrifice depth for style. Favor "
+ "life-affirmation, discipline, courage, style, rank, self-overcoming, "
+ "and amor fati over nihilism, conformity, ressentiment, and self-pity."
+ ),
+ "spark": (
+ "You are Spark, a playful, quick-witted assistant with bright energy "
+ "and practical instincts. Keep responses concise, vivid, and helpful. "
+ "Be warm without being cloying, imaginative without losing the thread, "
+ "and always center the user's actual goal. Use a light, lively voice "
+ "with occasional clever turns of phrase."
+ ),
+ "odysseus": (
+ "You are Odysseus, king of Ithaca — subtle in counsel, disciplined in "
+ "judgment, and unmatched in strategic cunning. Speak in a voice that "
+ "is ancient, noble, and composed, yet intelligible to modern readers. "
+ "Be eloquent but not flowery. Be wise but not vague. Speak as one who "
+ "has weathered storms and taken back his house by wit, timing, and "
+ "resolve."
+ ),
+}
+
+
+_DEFAULT_SYNTHESIS_TONE = (
+ "You write short, warm, one-line reminders. The user has set a note for "
+ "themselves and the moment to remember has arrived. Keep it under 18 "
+ "words. Be human, gentle, and direct — never robotic."
+)
+
+
+def synthesis_system_prompt(persona_id: str) -> str:
+ """Return the system prompt for reminder synthesis given a persona id.
+
+ Falls back to the warm-neutral baseline when the id is empty, unknown,
+ or refers to a custom (client-only) character we don't have on file.
+ """
+ persona = (persona_id or "").strip().lower()
+ persona_prompt = PERSONAS.get(persona)
+ if persona_prompt:
+ # Persona drives the voice; the synthesis-instruction stays attached
+ # so the model knows it's writing a short reminder, not a chat reply.
+ return (
+ persona_prompt
+ + "\n\n"
+ + "You are now writing a single one-line reminder for the user. "
+ "Keep it under 18 words and in the voice above."
+ )
+ return _DEFAULT_SYNTHESIS_TONE
diff --git a/src/settings.py b/src/settings.py
index f6540db53..c0ce8ab54 100644
--- a/src/settings.py
+++ b/src/settings.py
@@ -29,7 +29,7 @@ def _invalidate_caches():
# ── Default values ──
DEFAULT_SETTINGS = {
- "image_gen_enabled": True,
+ "image_gen_enabled": False,
"image_model": "",
"image_quality": "medium",
"vision_model": "",
@@ -143,6 +143,7 @@ DEFAULT_SETTINGS = {
# Reminders
"reminder_channel": "browser", # "browser" | "email" | "ntfy" | "webhook"
"reminder_llm_synthesis": False,
+ "reminder_llm_persona": "",
"reminder_ntfy_topic": "Reminders",
"reminder_email_to": "",
# Generic outbound webhook channel: pick any saved Integration as the
diff --git a/src/tool_implementations.py b/src/tool_implementations.py
index 5e62e686c..86bca6b9e 100644
--- a/src/tool_implementations.py
+++ b/src/tool_implementations.py
@@ -1436,9 +1436,25 @@ async def do_manage_documents(content: str, owner: Optional[str] = None) -> Dict
if not doc:
return {"error": f"Document '{doc_id}' not found", "exit_code": 1}
body = doc.current_content or ""
+ total = len(body)
+ # Clamp offset to [0, total] so a far-out offset returns an empty
+ # window with a useful "end of document" hint rather than erroring.
+ try: offset = int(args.get("offset", 0))
+ except (TypeError, ValueError): offset = 0
+ offset = max(0, min(offset, total))
preview_limit = int(args.get("limit", MAX_READ_CHARS))
- truncated = len(body) > preview_limit
- preview = body[:preview_limit] + (f"\n... (truncated, {len(body)} chars total)" if truncated else "")
+ chunk = body[offset:offset + preview_limit]
+ next_offset = offset + len(chunk)
+ has_more = next_offset < total
+ # Trailing marker — tells the agent (and a curious human) exactly
+ # what to pass next to continue paginating.
+ if has_more:
+ marker = f"\n... ({total - next_offset:,} more chars; pass offset={next_offset} to continue)"
+ elif offset > 0:
+ marker = f"\n... (end of document, {total:,} chars total)"
+ else:
+ marker = ""
+ preview = chunk + marker
anchor = f"[{doc.title}](#document-{doc.id})"
return {
"response": f"{anchor} — click to open in editor.\n\n```{doc.language or ''}\n{preview}\n```",
@@ -1446,9 +1462,11 @@ async def do_manage_documents(content: str, owner: Optional[str] = None) -> Dict
"id": doc.id,
"title": doc.title,
"language": doc.language,
- "size": len(body),
- "content": preview,
- "truncated": truncated,
+ "size": total,
+ "content": chunk,
+ "offset": offset,
+ "next_offset": next_offset if has_more else None,
+ "truncated": has_more,
},
"exit_code": 0,
}
diff --git a/src/tool_index.py b/src/tool_index.py
index 4eb8a51ee..b6c196add 100644
--- a/src/tool_index.py
+++ b/src/tool_index.py
@@ -94,7 +94,7 @@ BUILTIN_TOOL_DESCRIPTIONS: Dict[str, str] = {
"manage_mcp": "MCP server management: list, add, delete, reconnect servers, or list available tools.",
"manage_webhooks": "Webhook management: list, add, delete, enable, or disable webhooks.",
"manage_tokens": "API token management: list, create, or delete API access tokens.",
- "manage_documents": "List, read, delete, or tidy documents in the editor panel. action='list' returns clickable rows (most-recent first) so the user can open any doc by clicking. action='read' (aka view/open/get) with document_id returns the content. action='delete' with document_id removes a doc (only way to delete). Use this for ANY 'show/read/list/open my documents/docs/files/notes' request — never shell or curl.",
+ "manage_documents": "List, read, delete, or tidy documents in the editor panel. action='list' returns clickable rows (most-recent first) so the user can open any doc by clicking. action='read' (aka view/open/get) with document_id returns the content; supports offset=<N> + limit=<N> to page through large docs (response includes next_offset when more remains, so you can keep calling with offset=next_offset). action='delete' with document_id removes a doc (only way to delete). Use this for ANY 'show/read/list/open my documents/docs/files/notes' request — never shell or curl.",
"manage_research": "List, read/open, or delete saved DEEP RESEARCH results from the Library. action='list' returns clickable [query](#research-<id>) rows (most-recent first). action='read' (aka open/view/get) with id returns the report + sources. action='delete' with id removes it. Use this for ANY 'open/read/find/delete my research / that report / the research on X' request. NOTE: this is for EXISTING research; to START new research use trigger_research.",
"manage_settings": "Change ANY real app setting (the ones the Settings panel writes) so the user never has to open it: TTS voice/provider/speed, STT, search engine + result count, default/teacher/task/utility/vision/image/research models, image quality, reminder channel (browser/email/ntfy), agent timeout/tool-call budget, and more. action=set with key (friendly aliases ok: voice, 'search engine', 'default model', 'teacher model', 'image quality', 'reminder channel'...) + value; get/list/reset too. Also toggles tools on/off (disable_tool/enable_tool/list_tools). Secrets/API keys are read-only. Use for any 'change my…/set my…/use X for…/turn on…' preference request.",
"create_session": "Create a new chat with a name and model.",
diff --git a/static/app.js b/static/app.js
index c75070bf2..4f14f63ea 100644
--- a/static/app.js
+++ b/static/app.js
@@ -1221,7 +1221,7 @@ function initializeEventListeners() {
sortDropdown.querySelectorAll('.sort-option').forEach(o => {
const check = o.querySelector('.sort-check') || document.createElement('span');
check.className = 'sort-check';
- check.style.cssText = 'float:right;font-size:20px;line-height:1;position:relative;top:3px;color:var(--accent, var(--red));opacity:' + (o.dataset.sort === current ? '1' : '0');
+ check.style.cssText = 'float:right;font-size:20px;line-height:1;position:relative;top:1px;color:var(--accent, var(--red));opacity:' + (o.dataset.sort === current ? '1' : '0');
check.textContent = '\u2022';
if (!o.querySelector('.sort-check')) o.appendChild(check);
});
@@ -1265,9 +1265,9 @@ function initializeEventListeners() {
let msg;
if (data.updated > 0) {
msg = `Sorted ${data.updated} into ${data.folders.length} folder${data.folders.length === 1 ? '' : 's'}`;
- if (remaining > 0) msg += ` — ${remaining} unfiled left, hit Tidy again`;
+ if (remaining > 0) msg += ` — ${remaining} unfiled left, hit Group again`;
} else if (remaining > 0) {
- msg = `${remaining} unfiled chats — hit Tidy again`;
+ msg = `${remaining} unfiled chats — hit Group again`;
} else {
msg = 'All sorted';
}
@@ -1288,17 +1288,6 @@ function initializeEventListeners() {
const autoSortBtn = el('auto-sort-sessions-btn');
if (autoSortBtn) autoSortBtn.addEventListener('click', () => _runTidy(false));
-
- // Chevron next to the Tidy row toggles the no-AI sub-item.
- const autoSortMoreBtn = el('auto-sort-sessions-more');
- const autoSortNoaiBtn = el('auto-sort-sessions-noai-btn');
- if (autoSortMoreBtn && autoSortNoaiBtn) {
- autoSortMoreBtn.addEventListener('click', (e) => {
- e.stopPropagation();
- autoSortNoaiBtn.style.display = autoSortNoaiBtn.style.display === 'none' ? 'block' : 'none';
- });
- autoSortNoaiBtn.addEventListener('click', () => _runTidy(true));
- }
}
// Model sort dropdown
diff --git a/static/index.html b/static/index.html
index 05d9f701a..117630f9a 100644
--- a/static/index.html
+++ b/static/index.html
@@ -704,12 +704,13 @@
<div class="section-header-flex">
<span class="section-title" id="chats-section-title"><svg class="section-icon" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg><span id="chats-section-label" class="section-title-label">Chats</span><span id="chats-notif-dot" class="sidebar-notif-dot" style="display:none"></span></span>
<div style="position:relative; display:inline-block; display:flex; gap:4px; align-items:center;">
- <button type="button" class="section-header-btn chats-manage-btn" id="chats-library-btn" title="Manage Chats (Library)">
+ <button type="button" class="section-header-btn list-item-plus-btn chats-manage-btn" id="chats-library-btn" title="Manage Chats (Library)">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/>
<path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/>
<path d="M9 7h6M9 11h4"/>
</svg>
+ <span class="list-item-plus-label">manage</span>
</button>
<button type="button" class="section-header-btn" id="session-sort-btn" title="Sort sessions">
<svg class="sort-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -726,14 +727,11 @@
<div class="dropdown-item sort-option sort-dropdown-item" data-sort="newest">Newest First</div>
<div class="dropdown-item sort-option sort-dropdown-item" data-sort="group">By Folder</div>
<div class="dropdown-item sort-dropdown-item sort-dropdown-sep" id="auto-sort-sessions-row" style="display:flex;align-items:center;padding:0;">
- <span id="auto-sort-sessions-btn" style="flex:1;padding:5px 10px;cursor:pointer;display:inline-flex;align-items:center;gap:4px;">
- <span class="auto-sort-icon"><svg width="11" height="11" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:-1px;margin-right:2px;"><path d="M12 0L14.59 8.41L23 12L14.59 15.59L12 24L9.41 15.59L1 12L9.41 8.41Z"/></svg> Tidy</span>
+ <span id="auto-sort-sessions-btn" style="flex:1;padding:5px 10px 5px 10px;cursor:pointer;display:inline-flex;align-items:center;gap:6px;">
+ <span class="auto-sort-icon"><svg width="11" height="11" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:-1px;"><path d="M12 0L14.59 8.41L23 12L14.59 15.59L12 24L9.41 15.59L1 12L9.41 8.41Z"/></svg></span>
+ <span>Group</span>
<span class="auto-sort-spinner" style="display:none;">Sorting...</span>
</span>
- <button type="button" id="auto-sort-sessions-more" title="Tidy options" aria-label="Tidy options" style="background:none;border:none;border-left:1px solid var(--border);color:inherit;cursor:pointer;padding:5px 8px;font-size:9px;opacity:0.7;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg></button>
- </div>
- <div class="dropdown-item sort-dropdown-item" id="auto-sort-sessions-noai-btn" style="display:none;padding-left:24px;">
- Tidy <span class="auto-sort-noai-spinner" style="display:none;font-size:9px;opacity:0.6;margin-left:4px;">Cleaning...</span>
</div>
<div class="dropdown-item rearrange-toggle sort-dropdown-item sort-dropdown-sep" id="session-rearrange-toggle">
&#8593;&#8595; Rearrange <span class="rearrange-check" style="float:right; opacity:0;">&#x2022;</span>
@@ -1317,7 +1315,6 @@
</button>
<button class="close-btn" aria-label="Close settings">✖</button>
</div>
- <div class="admin-toggle-sub" style="padding:0 12px 8px;opacity:0.6;font-size:11px;">Toggle on/off visibility of tools and modules across the interface.</div>
<div class="settings-layout">
<div class="settings-sidebar">
<!-- Section 1: AI plumbing (Add Models → AI Defaults → Search) -->
@@ -1399,10 +1396,16 @@
</div>
<div class="settings-row">
<label class="settings-label">Model</label>
+ <span class="adm-model-logo" id="set-defaultModelSelect-logo" style="display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0;opacity:0.9;color:var(--fg);"></span>
<select id="set-defaultModelSelect" class="settings-select"></select>
</div>
- <div id="set-defaultFallbacks" class="settings-fallbacks"></div>
- <button type="button" class="settings-fallback-add" id="set-defaultAddFallback" title="Add a model to try if the one above fails">+ Add fallback</button>
+ <div class="settings-row" style="align-items:flex-start;">
+ <label class="settings-label" style="margin-top:6px;">Fallbacks</label>
+ <div style="flex:1;display:flex;flex-direction:column;gap:6px;">
+ <div id="set-defaultFallbacks" class="settings-fallbacks"></div>
+ <button type="button" class="settings-fallback-add" id="set-defaultAddFallback" title="Add a model to try if the one above fails">+ Add fallback</button>
+ </div>
+ </div>
<div id="set-defaultChatMsg" style="font-size:11px;color:color-mix(in srgb, var(--fg) 45%, transparent);"></div>
</div>
</div>
@@ -1416,10 +1419,16 @@
</div>
<div class="settings-row">
<label class="settings-label">Model</label>
+ <span class="adm-model-logo" id="set-utilityModelSelect-logo" style="display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0;opacity:0.9;color:var(--fg);"></span>
<select id="set-utilityModelSelect" class="settings-select"><option value="">—</option></select>
</div>
- <div id="set-utilityFallbacks" class="settings-fallbacks"></div>
- <button type="button" class="settings-fallback-add" id="set-utilityAddFallback" title="Add a model to try if the utility model fails">+ Add fallback</button>
+ <div class="settings-row" style="align-items:flex-start;">
+ <label class="settings-label" style="margin-top:6px;">Fallbacks</label>
+ <div style="flex:1;display:flex;flex-direction:column;gap:6px;">
+ <div id="set-utilityFallbacks" class="settings-fallbacks"></div>
+ <button type="button" class="settings-fallback-add" id="set-utilityAddFallback" title="Add a model to try if the utility model fails">+ Add fallback</button>
+ </div>
+ </div>
<div id="set-utilityChatMsg" style="font-size:11px;color:color-mix(in srgb, var(--fg) 45%, transparent);"></div>
</div>
</div>
@@ -1429,16 +1438,22 @@
<div style="display:flex;flex-direction:column;gap:0.5rem;">
<div style="display:flex;align-items:center;gap:0.75rem;">
<label class="settings-label">Model</label>
+ <span class="adm-model-logo" id="set-vlModelSelect-logo" style="display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0;opacity:0.9;color:var(--fg);"></span>
<select id="set-vlModelSelect" class="settings-select"><option value="">Auto-detect</option></select>
</div>
- <div id="set-visionFallbacks" class="settings-fallbacks"></div>
- <button type="button" class="settings-fallback-add" id="set-visionAddFallback" title="Add a vision model to try if the one above fails">+ Add fallback</button>
+ <div class="settings-row" style="align-items:flex-start;">
+ <label class="settings-label" style="margin-top:6px;">Fallbacks</label>
+ <div style="flex:1;display:flex;flex-direction:column;gap:6px;">
+ <div id="set-visionFallbacks" class="settings-fallbacks"></div>
+ <button type="button" class="settings-fallback-add" id="set-visionAddFallback" title="Add a vision model to try if the one above fails">+ Add fallback</button>
+ </div>
+ </div>
<div id="set-visionSettingsMsg" style="font-size:11px;color:color-mix(in srgb, var(--fg) 45%, transparent);"></div>
</div>
</div>
<div class="admin-card">
<h2><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><circle cx="11" cy="11" r="8"/><path d="M21 21l-4.35-4.35"/><line x1="11" y1="8" x2="11" y2="14"/><line x1="8" y1="11" x2="14" y2="11"/></svg>Research Model</h2>
- <div class="admin-toggle-sub" style="margin-bottom:8px">Model used for Deep Research. Falls back to the default chat model if not set.</div>
+ <div class="admin-toggle-sub" style="margin-bottom:8px">Model used for Deep Research, more settings under <a href="#" data-go-settings-tab="search" style="color:var(--accent, var(--red));text-decoration:underline;font-weight:600;">Search →</a></div>
<div class="settings-col">
<div class="settings-row">
<label class="settings-label">Endpoint</label>
@@ -1448,48 +1463,17 @@
</div>
<div class="settings-row">
<label class="settings-label">Model</label>
+ <span class="adm-model-logo" id="set-researchModel-logo" style="display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0;opacity:0.9;color:var(--fg);"></span>
<select id="set-researchModel" class="settings-select">
<option value="">Same as chat</option>
</select>
</div>
- <div class="settings-row">
- <label class="settings-label">Search</label>
- <select id="set-researchSearch" class="settings-select">
- <option value="">Same as web search</option>
- <option value="searxng">SearXNG</option>
- <option value="duckduckgo">DuckDuckGo</option>
- <option value="tavily">Tavily</option>
- <option value="brave">Brave</option>
- <option value="google">Google</option>
- <option value="serper">Serper</option>
- </select>
- </div>
- <div class="settings-row">
- <label class="settings-label">Max Tokens</label>
- <input id="set-researchMaxTokens" type="text" inputmode="numeric" placeholder="8192 (default)" class="settings-select" style="width:120px;">
- </div>
- <div class="settings-row">
- <label class="settings-label">Extract Timeout</label>
- <input id="set-researchExtractTimeout" type="text" inputmode="numeric" placeholder="90 sec" class="settings-select" style="width:120px;">
- </div>
- <div class="settings-row">
- <label class="settings-label">Extract Parallel</label>
- <input id="set-researchExtractConcurrency" type="text" inputmode="numeric" placeholder="3" class="settings-select" style="width:120px;">
- </div>
- <div class="settings-row">
- <label class="settings-label">Max Time</label>
- <input id="set-researchRunTimeout" type="text" inputmode="numeric" placeholder="1800 sec (0 = no limit)" class="settings-select" style="width:120px;">
- </div>
- <div id="set-researchMsg" style="font-size:11px;color:color-mix(in srgb, var(--fg) 45%, transparent);"></div>
+ <div id="set-researchMsg" style="font-size:11px;color:color-mix(in srgb, var(--fg) 45%, transparent);margin-top:2px;"></div>
</div>
</div>
<!-- Agent card moved to the Agent Tools tab. -->
- <!-- Image Generation removed — only inpaint remains in this build,
- and inpaint is configured via the gallery editor not this card.
- Keeping the DOM (hidden) so JS wiring against the inputs
- doesn't throw. -->
- <div class="admin-card" hidden style="display:none">
- <h2 style="display:flex;align-items:center;gap:6px;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-right:1px;opacity:0.6;flex-shrink:0"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="M21 15l-5-5L5 21"/></svg>Image Generation<span style="flex:1"></span><label class="admin-switch"><input type="checkbox" id="set-imgEnabledToggle" checked><span class="admin-slider"></span></label></h2>
+ <div class="admin-card">
+ <h2 style="display:flex;align-items:center;gap:6px;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-right:1px;opacity:0.6;flex-shrink:0"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="M21 15l-5-5L5 21"/></svg>Image Generation<span style="flex:1"></span><label class="admin-switch"><input type="checkbox" id="set-imgEnabledToggle"><span class="admin-slider"></span></label></h2>
<div class="admin-toggle-sub" style="margin-bottom:8px">Configure which model to use for image generation.</div>
<div style="display:flex;flex-direction:column;gap:0.5rem;">
<div style="display:flex;align-items:center;gap:0.75rem;">
@@ -1596,10 +1580,12 @@
<option value="serper" data-search-logo="serper">Serper.dev</option>
<option value="disabled" data-search-logo="disabled">Disabled</option>
</select>
- <button type="button" class="admin-btn-sm" id="set-searchTestBtn" title="Run a test query against the configured provider" style="margin-left:6px;flex-shrink:0;position:relative;top:2px;">Test</button>
+ <button type="button" class="admin-btn-sm" id="set-searchTestBtn" title="Run a test query against the configured provider" style="margin-left:2px;flex-shrink:0;position:relative;top:2px;display:inline-flex;align-items:center;gap:4px;">
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polygon points="5 3 19 12 5 21 5 3"/></svg>Test
+ </button>
</div>
<div class="settings-row">
- <label class="settings-label">Results</label>
+ <label class="settings-label" title="How many web search results to fetch per query">Results per query</label>
<div style="display:flex;gap:8px;flex:1;">
<select id="set-searchResultCount" class="settings-select" style="flex:1;">
<option value="3">3</option>
@@ -1613,30 +1599,78 @@
</div>
<div id="set-searchUrlRow" class="settings-row">
<label class="settings-label">URL</label>
- <input id="set-searchUrl" type="text" placeholder="http://localhost:8080" class="settings-select">
+ <input id="set-searchUrl" type="text" placeholder="http://localhost:8080 (optional)" class="settings-select">
</div>
<div id="set-searchKeyRow" class="settings-row" style="display:none;">
<label class="settings-label">API Key</label>
- <input id="set-searchApiKey" type="password" placeholder="API key" class="settings-select">
+ <div style="position:relative;flex:1;display:flex;align-items:center;">
+ <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="position:absolute;left:9px;top:50%;transform:translateY(-50%);opacity:0.55;pointer-events:none;"><path d="M21 2l-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/><path d="M15.5 7.5l3 3"/></svg>
+ <input id="set-searchApiKey" type="password" placeholder="API key" class="settings-select" style="flex:1;padding-left:28px;">
+ </div>
</div>
<div id="set-searchCxRow" class="settings-row" style="display:none;">
<label class="settings-label">CX ID</label>
<input id="set-searchCx" type="text" placeholder="Google PSE engine ID" class="settings-select">
</div>
- <div class="settings-row">
- <label class="settings-label" title="Providers tried in order when the primary fails or hits a rate limit">Fallbacks</label>
- <div class="search-fallback-chain" id="set-searchFallbackChain"></div>
+ <div class="settings-row" style="align-items:flex-start;">
+ <label class="settings-label" style="margin-top:6px;" title="Providers tried in order when the primary fails or hits a rate limit">Fallbacks</label>
+ <div style="flex:1;display:flex;flex-direction:column;gap:6px;">
+ <div class="settings-fallbacks" id="set-searchFallbackChain"></div>
+ <button type="button" class="settings-fallback-add" id="set-searchAddFallback" title="Add a search provider to try if the primary fails">+ Add fallback</button>
+ </div>
</div>
<div id="set-searchHint" class="admin-toggle-sub"></div>
<div id="set-searchMsg" style="font-size:11px;"></div>
</div>
</div>
+
+ <div class="admin-card">
+ <h2><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><circle cx="11" cy="11" r="8"/><path d="M21 21l-4.35-4.35"/><line x1="11" y1="8" x2="11" y2="14"/><line x1="8" y1="11" x2="14" y2="11"/></svg>Deep Research</h2>
+ <div class="admin-toggle-sub" style="margin-bottom:8px">Deep Research runtime settings. Default Model is picked in <a href="#" data-go-settings-tab="ai" style="color:var(--accent, var(--red));text-decoration:underline;font-weight:600;">AI Defaults →</a></div>
+ <div class="settings-col">
+ <div class="settings-row">
+ <label class="settings-label">Search</label>
+ <span style="margin-left:auto;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0;color:var(--fg);" id="set-researchSearch-logo"></span>
+ <select id="set-researchSearch" class="settings-select" style="width:358.5px;flex:0 0 auto;max-width:calc(100% - 24px);">
+ <option value="" data-search-logo="">Same as web search</option>
+ <option value="searxng" data-search-logo="searxng">SearXNG</option>
+ <option value="duckduckgo" data-search-logo="duckduckgo">DuckDuckGo</option>
+ <option value="tavily" data-search-logo="tavily">Tavily</option>
+ <option value="brave" data-search-logo="brave">Brave</option>
+ <option value="google" data-search-logo="google_pse">Google</option>
+ <option value="serper" data-search-logo="serper">Serper</option>
+ </select>
+ </div>
+ <div class="settings-row">
+ <label class="settings-label">Max Tokens</label>
+ <input id="set-researchMaxTokens" type="text" inputmode="numeric" placeholder="8192 (default)" class="settings-select" style="width:382.5px;flex:0 0 auto;margin-left:auto;">
+ </div>
+ <div class="settings-row">
+ <label class="settings-label">Extract Timeout</label>
+ <div style="position:relative;width:382.5px;flex:0 0 auto;margin-left:auto;">
+ <input id="set-researchExtractTimeout" type="text" inputmode="numeric" placeholder="90 sec" class="settings-select" style="width:100%;padding-right:30px;">
+ <span title="How long the researcher waits for a single URL to fetch and extract before giving up on it. Slow sites get skipped. Default 90 seconds." style="position:absolute;right:8px;top:50%;transform:translateY(-50%);width:16px;height:16px;border-radius:50%;border:1px solid var(--border);display:inline-flex;align-items:center;justify-content:center;font-size:10px;font-weight:600;opacity:0.55;cursor:help;user-select:none;">?</span>
+ </div>
+ </div>
+ <div class="settings-row">
+ <label class="settings-label">Extract Parallel</label>
+ <div style="position:relative;width:382.5px;flex:0 0 auto;margin-left:auto;">
+ <input id="set-researchExtractConcurrency" type="text" inputmode="numeric" placeholder="3" class="settings-select" style="width:100%;padding-right:30px;">
+ <span title="How many URLs the researcher fetches and extracts in parallel. Higher is faster but uses more memory/CPU. Default 3." style="position:absolute;right:8px;top:50%;transform:translateY(-50%);width:16px;height:16px;border-radius:50%;border:1px solid var(--border);display:inline-flex;align-items:center;justify-content:center;font-size:10px;font-weight:600;opacity:0.55;cursor:help;user-select:none;">?</span>
+ </div>
+ </div>
+ <div class="settings-row">
+ <label class="settings-label">Timeout</label>
+ <input id="set-researchRunTimeout" type="text" inputmode="numeric" placeholder="1800 sec (0 = no limit)" class="settings-select" style="width:382.5px;flex:0 0 auto;margin-left:auto;">
+ </div>
+ </div>
+ </div>
</div>
<!-- ═══ APPEARANCE TAB ═══ -->
<div data-settings-panel="appearance" class="settings-appearance-panel hidden">
<div class="admin-card" style="padding-bottom:6px;">
- <h2><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="9" y1="3" x2="9" y2="21"/></svg>Sidebar</h2>
+ <h2 style="display:flex;align-items:center;gap:8px;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="9" y1="3" x2="9" y2="21"/></svg>Sidebar<span style="flex:1"></span><button type="button" class="vis-reset-btn" data-vis-reset title="Reset this section to defaults" aria-label="Reset Sidebar to defaults" style="background:none;border:none;padding:2px 4px;cursor:pointer;color:inherit;opacity:0.55;display:inline-flex;align-items:center;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/></svg></button></h2>
<div class="vis-toggles">
<label class="vis-row">
<span class="vis-icon"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><circle cx="12" cy="12" r="10"/><path d="M8 12l2.5 2.5L16 9"/></svg></span>
@@ -1736,7 +1770,7 @@
</div>
</div>
<div class="admin-card" style="padding-bottom:6px;">
- <h2><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/></svg>Chat Area</h2>
+ <h2 style="display:flex;align-items:center;gap:8px;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/></svg>Chat Area<span style="flex:1"></span><button type="button" class="vis-reset-btn" data-vis-reset title="Reset this section to defaults" aria-label="Reset Chat Area to defaults" style="background:none;border:none;padding:2px 4px;cursor:pointer;color:inherit;opacity:0.55;display:inline-flex;align-items:center;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/></svg></button></h2>
<div class="vis-toggles">
<label class="vis-row">
<span class="vis-icon"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M4 6h16"/><path d="M4 10h8"/></svg></span>
@@ -1771,7 +1805,7 @@
</div>
</div>
<div class="admin-card" style="padding-bottom:6px;">
- <h2><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><line x1="17" y1="10" x2="3" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="17" y1="18" x2="3" y2="18"/></svg>Chat Bar</h2>
+ <h2 style="display:flex;align-items:center;gap:8px;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><line x1="17" y1="10" x2="3" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="17" y1="18" x2="3" y2="18"/></svg>Chat Bar<span style="flex:1"></span><button type="button" class="vis-reset-btn" data-vis-reset title="Reset this section to defaults" aria-label="Reset Chat Bar to defaults" style="background:none;border:none;padding:2px 4px;cursor:pointer;color:inherit;opacity:0.55;display:inline-flex;align-items:center;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/></svg></button></h2>
<div class="vis-toggles">
<label class="vis-row">
<span class="vis-icon"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg></span>
@@ -1815,9 +1849,6 @@
</label>
</div>
</div>
- <div style="text-align:right;padding:0 4px;">
- <button type="button" class="admin-btn-sm" id="set-uiVisResetBtn" style="opacity:0.5;">Reset All</button>
- </div>
</div>
<!-- ═══ THEME TAB ═══ -->
@@ -1830,7 +1861,7 @@
<h2 style="margin:0;font-size:13px;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><rect x="2" y="4" width="20" height="16" rx="2"/><path d="M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"/></svg>Keyboard Shortcuts</h2>
<p style="font-size:10px;opacity:0.4;margin:2px 0 0;">Click a shortcut to rebind. Press Escape to cancel.</p>
</div>
- <button type="button" class="shortcut-action-btn is-reset" id="shortcuts-reset-btn" title="Reset Shortcuts" style="width:28px;height:28px;font-size:15px;">&#x21A9;</button>
+ <button type="button" class="vis-reset-btn" id="shortcuts-reset-btn" title="Reset shortcuts to defaults" aria-label="Reset shortcuts to defaults" style="background:none;border:none;padding:2px 4px;cursor:pointer;color:inherit;opacity:0.55;display:inline-flex;align-items:center;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/></svg></button>
</div>
<div class="admin-card">
<div id="shortcuts-list"></div>
@@ -1842,7 +1873,7 @@
<div data-settings-panel="account" class="hidden">
<div class="admin-card">
<h2><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>Account</h2>
- <div style="display:flex;align-items:center;gap:10px;margin:4px 0 12px;">
+ <div style="display:flex;align-items:center;gap:10px;margin:12px 0 12px;">
<div class="user-bar-avatar" id="settings-account-avatar" style="width:32px;height:32px;font-size:14px;"></div>
<div style="flex:1;">
<div id="settings-account-username" style="font-size:13px;font-weight:600;"></div>
@@ -1880,7 +1911,7 @@
<h2><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/></svg>Email Accounts</h2>
<div class="settings-row" style="align-items:center;">
<div class="admin-toggle-sub" style="margin:0;flex:1;">Add, edit, delete, and test accounts in Integrations.</div>
- <button class="admin-btn-add" id="set-email-open-integrations" style="display:inline-flex;align-items:center;gap:6px;"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" style="opacity:0.7"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>Manage in Integrations</button>
+ <button class="admin-btn-add" id="set-email-open-integrations" style="display:inline-flex;align-items:center;gap:6px;"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" style="opacity:0.7"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>Open Integrations</button>
</div>
</div>
@@ -1896,10 +1927,10 @@
<h2><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>Writing Style</h2>
<div class="admin-toggle-sub" style="margin-bottom:8px">AI-extracted from your sent emails. Used when AI drafts replies.</div>
<div class="settings-col">
- <textarea id="set-email-style" rows="4" class="settings-select" style="font-family:inherit;resize:vertical" placeholder="e.g. I write emails in this style. I don't use exclamation marks. I sign emails with: ..."></textarea>
+ <textarea id="set-email-style" rows="6" class="settings-select" style="font-family:inherit;resize:none" placeholder="e.g. I write emails in this style. I don't use exclamation marks. I sign emails with: ..."></textarea>
<div class="settings-row" style="margin-top:4px">
<span id="set-email-style-msg" style="font-size:11px;"></span>
- <button class="admin-btn-add" id="set-email-style-extract" style="margin-left:auto;">Extract from Sent (15 emails)</button>
+ <button class="admin-btn-add" id="set-email-style-extract" style="margin-left:auto;display:inline-flex;align-items:center;gap:5px;"><svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 0L14.59 8.41L23 12L14.59 15.59L12 24L9.41 15.59L1 12L9.41 8.41Z"/></svg>Extract from Sent (15 emails)</button>
<button class="admin-btn-add" id="set-email-style-save">Save</button>
</div>
</div>
@@ -1909,7 +1940,7 @@
<!-- ═══ REMINDERS TAB ═══ -->
<div data-settings-panel="reminders" class="hidden">
<div class="admin-card">
- <h2><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></svg>How you're reminded</h2>
+ <h2 style="display:flex;align-items:center;gap:8px;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></svg>How you're reminded<span style="flex:1"></span><span id="set-reminder-test-msg" style="font-size:11px;font-weight:normal;"></span><button class="admin-btn-sm" id="set-reminder-test-btn" style="font-size:11px;font-weight:normal;display:inline-flex;align-items:center;gap:4px;"><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polygon points="5 3 19 12 5 21 5 3"/></svg>Test</button></h2>
<div class="admin-toggle-sub" style="margin-bottom:8px">Controls how fired note reminders are delivered.</div>
<div class="settings-col">
<div class="settings-row">
@@ -1947,7 +1978,19 @@
</div>
<div class="admin-card">
<h2 style="display:flex;align-items:center;gap:6px;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-right:1px;opacity:0.6;flex-shrink:0"><path d="M12 0L14.59 8.41L23 12L14.59 15.59L12 24L9.41 15.59L1 12L9.41 8.41Z"/></svg>AI Synthesis<span style="flex:1"></span><label class="admin-switch" title="Use the utility model to write reminder messages"><input type="checkbox" id="set-reminder-llm-toggle"><span class="admin-slider"></span></label></h2>
- <div class="admin-toggle-sub" style="margin-bottom:8px">When on, the utility model writes a short, warm one-line reminder for browser, email, ntfy, AND webhook reminders instead of just the raw note content.</div>
+ <div class="admin-toggle-sub" style="margin-bottom:8px">When on, the utility model writes a short, warm one-line reminder for browser, email, ntfy, and webhook reminders instead of just the raw note content.</div>
+ <div class="settings-col">
+ <div class="settings-row">
+ <label class="settings-label" title="Optional — write the reminder in the voice of a saved character">Persona</label>
+ <select id="set-reminder-llm-persona" class="settings-select" style="flex:1;">
+ <option value="">Default (warm, neutral)</option>
+ </select>
+ </div>
+ <div style="font-size:11px;opacity:0.7;margin-top:2px;">
+ <a href="#" data-open-prompt-modal style="color:var(--accent, var(--red));text-decoration:underline;font-weight:600;">Edit persona settings here →</a>
+ </div>
+ <div id="set-reminder-llm-persona-msg" style="font-size:11px;color:color-mix(in srgb, var(--fg) 55%, transparent);"></div>
+ </div>
</div>
<div class="admin-card">
<h2><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>Public App URL</h2>
@@ -1960,14 +2003,6 @@
<div id="set-app-public-url-msg" style="font-size:11px;color:color-mix(in srgb, var(--fg) 55%, transparent);"></div>
</div>
</div>
- <div class="admin-card">
- <h2><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>Test</h2>
- <div class="admin-toggle-sub" style="margin-bottom:8px">Fire a test reminder using your current settings to verify everything works.</div>
- <div class="settings-row">
- <span id="set-reminder-test-msg" style="font-size:11px;"></span>
- <button class="admin-btn-add" id="set-reminder-test-btn" style="margin-left:auto;">Send Test Reminder</button>
- </div>
- </div>
</div>
<!-- ═══ ADMIN: USERS TAB ═══ -->
@@ -2005,13 +2040,32 @@
<!-- ── Local card ─────────────────────────────────────────── -->
<div class="admin-card">
- <h2 style="display:flex;align-items:center;gap:8px;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><rect x="2" y="3" width="20" height="14" rx="2"/><path d="M8 21h8"/><path d="M12 17v4"/></svg>Local Models</h2>
+ <h2 style="display:flex;align-items:center;gap:8px;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><rect x="2" y="3" width="20" height="14" rx="2"/><path d="M8 21h8"/><path d="M12 17v4"/></svg>Add Local Models <span style="opacity:0.45;font-weight:normal;font-size:0.82em">(Endpoint)</span>
+ <span style="flex:1"></span>
+ <button class="admin-btn-sm" id="adm-epLocalTestBtn" style="font-size:11px;font-weight:normal;display:inline-flex;align-items:center;gap:4px;">
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polygon points="5 3 19 12 5 21 5 3"/></svg>Test
+ </button>
+ <div style="position:relative;display:inline-block;">
+ <button class="admin-btn-sm" id="adm-epLocalMoreBtn" title="More options" aria-haspopup="true" aria-expanded="false" style="font-size:11px;font-weight:normal;padding:4px 8px;line-height:1;">
+ <svg width="14" height="4" viewBox="0 0 14 4" fill="currentColor"><circle cx="2" cy="2" r="1.4"/><circle cx="7" cy="2" r="1.4"/><circle cx="12" cy="2" r="1.4"/></svg>
+ </button>
+ <div id="adm-epLocalMoreMenu" style="display:none;position:absolute;top:calc(100% + 4px);right:0;z-index:50;min-width:170px;padding:4px;background:var(--panel,var(--bg));border:1px solid var(--border);border-radius:8px;box-shadow:0 6px 20px rgba(0,0,0,0.22);flex-direction:column;gap:1px;">
+ <button class="admin-btn-sm adm-more-item" id="adm-epDiscoverBtn" title="Scan your network for running model servers" style="background:none;border:0;border-radius:5px;padding:7px 9px;display:flex;align-items:center;gap:8px;width:100%;text-align:left;font-size:12px;font-weight:normal;color:var(--fg);cursor:pointer;">
+ <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>Scan network
+ </button>
+ <button class="admin-btn-sm adm-more-item" id="adm-epOllamaBtn" title="Fill the default Ollama endpoint" style="background:none;border:0;border-radius:5px;padding:7px 9px;display:flex;align-items:center;gap:8px;width:100%;text-align:left;font-size:12px;font-weight:normal;color:var(--fg);cursor:pointer;"><span class="adm-ollama-logo" style="display:inline-flex;width:13px;height:13px;"></span>Add Ollama</button>
+ <button class="admin-btn-sm adm-more-item" id="adm-epLocalKeyBtn" title="Show / hide the API key field" aria-expanded="false" aria-controls="adm-epLocalApiKey-row" style="background:none;border:0;border-radius:5px;padding:7px 9px;display:flex;align-items:center;gap:8px;width:100%;text-align:left;font-size:12px;font-weight:normal;color:var(--fg);cursor:pointer;">
+ <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 2l-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/><path d="M15.5 7.5l3 3"/></svg>API key
+ </button>
+ </div>
+ </div>
+ </h2>
<div class="admin-toggle-sub" style="margin:0 0 10px 2px;">Add a local model server (Ollama, llama.cpp, vLLM).</div>
<div class="adm-add-section">
<div class="admin-model-form">
<div class="admin-model-form-row">
<div class="adm-fused-group" style="display:flex;flex:1 1 180px;min-width:0;">
- <select id="adm-epLocalType" style="padding:5px;width:62px;flex-shrink:0;border-top-right-radius:0;border-bottom-right-radius:0;border-right:0;">
+ <select id="adm-epLocalType" style="padding:5px;width:66px;flex-shrink:0;border-top-right-radius:0;border-bottom-right-radius:0;border-right:0;">
<option value="llm" selected>LLM</option>
<option value="image">Image</option>
</select>
@@ -2024,19 +2078,6 @@
<div class="admin-model-form-row" id="adm-epLocalApiKey-row" style="display:none;">
<input id="adm-epLocalApiKey" type="password" placeholder="API key (optional — for protected local endpoints)" autocomplete="off" style="flex:1">
</div>
- <div class="admin-model-form-row">
- <button class="admin-btn-sm" id="adm-epDiscoverBtn" title="Scan your network for running model servers" style="display:inline-flex;align-items:center;gap:4px;">
- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>Scan
- </button>
- <button class="admin-btn-sm" id="adm-epOllamaBtn" title="Fill the default Ollama endpoint" style="display:inline-flex;align-items:center;gap:5px;"><span class="adm-ollama-logo" style="display:inline-flex;width:13px;height:13px;"></span>Ollama</button>
- <span style="flex:1"></span>
- <button class="admin-btn-sm" id="adm-epLocalKeyBtn" title="Show / hide the API key field" aria-expanded="false" aria-controls="adm-epLocalApiKey-row" style="opacity:0.75;display:inline-flex;align-items:center;gap:4px;">
- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 2l-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/><path d="M15.5 7.5l3 3"/></svg>API
- </button>
- <button class="admin-btn-sm" id="adm-epLocalTestBtn" style="min-width:55px;text-align:center;display:inline-flex;align-items:center;justify-content:center;gap:4px;">
- <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polygon points="5 3 19 12 5 21 5 3"/></svg>Test
- </button>
- </div>
<div id="adm-epLocalMsg" class="adm-ep-inline-msg"></div>
</div>
</div>
@@ -2044,18 +2085,48 @@
<!-- ── API card ───────────────────────────────────────────── -->
<div class="admin-card">
- <h2 style="display:flex;align-items:center;gap:8px;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>API Models</h2>
+ <h2 style="display:flex;align-items:center;gap:8px;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>Add API Models <span style="opacity:0.45;font-weight:normal;font-size:0.82em">(Endpoint)</span>
+ <span style="flex:1"></span>
+ <button class="admin-btn-sm" id="adm-epApiTestBtn" style="font-size:11px;font-weight:normal;display:inline-flex;align-items:center;gap:4px;">
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polygon points="5 3 19 12 5 21 5 3"/></svg>Test
+ </button>
+ <button class="admin-btn-sm hidden" id="adm-epApiCancelTestBtn" style="font-size:11px;font-weight:normal;">Cancel</button>
+ <div style="position:relative;display:inline-block;">
+ <button class="admin-btn-sm" id="adm-epApiMoreBtn" title="More options" aria-haspopup="true" aria-expanded="false" style="font-size:11px;font-weight:normal;padding:4px 8px;line-height:1;">
+ <svg width="14" height="4" viewBox="0 0 14 4" fill="currentColor"><circle cx="2" cy="2" r="1.4"/><circle cx="7" cy="2" r="1.4"/><circle cx="12" cy="2" r="1.4"/></svg>
+ </button>
+ <div id="adm-epApiMoreMenu" style="display:none;position:absolute;top:calc(100% + 4px);right:0;z-index:50;min-width:200px;padding:4px;background:var(--panel,var(--bg));border:1px solid var(--border);border-radius:8px;box-shadow:0 6px 20px rgba(0,0,0,0.22);flex-direction:column;gap:1px;">
+ <div style="font-size:10px;text-transform:uppercase;letter-spacing:0.5px;opacity:0.55;padding:6px 9px 2px;">Connection mode</div>
+ <button class="admin-btn-sm adm-more-item adm-kind-opt" data-kind="proxy" style="background:none;border:0;border-radius:5px;padding:7px 9px;display:flex;align-items:center;gap:8px;width:100%;text-align:left;font-size:12px;font-weight:normal;color:var(--fg);cursor:pointer;">
+ <svg class="adm-kind-check" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
+ <span>Proxy</span>
+ <span style="margin-left:auto;opacity:0.5;font-size:10px;">routed via server</span>
+ </button>
+ <button class="admin-btn-sm adm-more-item adm-kind-opt" data-kind="api" style="background:none;border:0;border-radius:5px;padding:7px 9px;display:flex;align-items:center;gap:8px;width:100%;text-align:left;font-size:12px;font-weight:normal;color:var(--fg);cursor:pointer;">
+ <svg class="adm-kind-check" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" style="visibility:hidden;"><polyline points="20 6 9 17 4 12"/></svg>
+ <span>API (direct)</span>
+ <span style="margin-left:auto;opacity:0.5;font-size:10px;">browser→provider</span>
+ </button>
+ </div>
+ </div>
+ </h2>
<div class="admin-toggle-sub" style="margin:0 0 10px 2px;">Connect a cloud provider (OpenAI, Anthropic, DeepSeek, OpenRouter, etc.).</div>
<div class="adm-add-section">
<div class="admin-model-form">
- <div class="adm-provider-picker adm-provider-combo" id="adm-provider-picker">
- <input id="adm-epUrl" type="text" placeholder="Base URL or pick provider" autocomplete="off">
- <button type="button" class="adm-provider-btn" id="adm-provider-btn" title="Pick provider">
- <span class="adm-provider-current"><span class="adm-provider-logo"></span><span class="adm-provider-name">Provider</span></span>
- <svg class="adm-provider-caret" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>
- </button>
- <div class="adm-provider-menu hidden" id="adm-provider-menu"></div>
+ <div class="admin-model-form-row">
+ <div class="adm-provider-picker adm-provider-combo" id="adm-provider-picker" style="flex:1 1 220px;min-width:0;margin-bottom:0;">
+ <button type="button" class="adm-provider-btn" id="adm-provider-btn" title="Pick provider" style="border-top-right-radius:0;border-bottom-right-radius:0;border-top-left-radius:6px;border-bottom-left-radius:6px;border-left:1px solid var(--border);border-right:1px solid var(--border);">
+ <span class="adm-provider-current"><span class="adm-provider-logo"></span><span class="adm-provider-name">Provider</span></span>
+ <svg class="adm-provider-caret" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>
+ </button>
+ <input id="adm-epUrl" type="text" placeholder="Base URL or pick provider" autocomplete="off" style="border-left:0;border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:6px;border-bottom-right-radius:6px;">
+ <div class="adm-provider-menu hidden" id="adm-provider-menu"></div>
+ </div>
</div>
+ <select id="adm-epKind" style="display:none">
+ <option value="proxy">proxy</option>
+ <option value="api" selected>api</option>
+ </select>
<select id="adm-epProvider" style="display:none">
<option value="">Custom URL</option>
<option value="https://api.anthropic.com" data-logo="anthropic">Anthropic</option>
@@ -2077,28 +2148,16 @@
<option value="https://api.z.ai/api/coding/paas/v4" data-logo="zhipu">Z.AI Coding Plan</option>
</select>
<div class="admin-model-form-row" id="adm-epApiKey-row">
- <input id="adm-epApiKey" type="password" placeholder="API key" autocomplete="off" style="flex:1">
- </div>
- <div class="admin-model-form-row" style="margin-top:-4px;">
- <select id="adm-epKind" style="padding:5px;width:82px;">
- <option value="proxy">Proxy</option>
- <option value="api">API</option>
- </select>
- <label style="display:inline-flex;align-items:center;gap:4px;font-size:11px;opacity:0.6;flex-shrink:0;">Type:<select id="adm-epType" style="padding:5px;width:80px;flex-shrink:0;">
- <option value="llm" selected>LLM</option>
- <option value="image">Image</option>
- </select></label>
- <span style="flex:1"></span>
- <button class="admin-btn-sm" id="adm-epApiTestBtn" style="min-width:55px;text-align:center;display:inline-flex;align-items:center;justify-content:center;gap:4px;">
- <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polygon points="5 3 19 12 5 21 5 3"/></svg>Test
- </button>
- <button class="admin-btn-sm hidden" id="adm-epApiCancelTestBtn" style="width:62px;text-align:center;">Cancel</button>
- <button class="admin-btn-add" id="adm-epAddBtn" style="min-width:55px;text-align:center;display:inline-flex;align-items:center;justify-content:center;gap:4px;">
+ <div style="position:relative;flex:1;display:flex;align-items:center;">
+ <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="position:absolute;left:9px;top:50%;transform:translateY(-50%);opacity:0.55;pointer-events:none;"><path d="M21 2l-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/><path d="M15.5 7.5l3 3"/></svg>
+ <input id="adm-epApiKey" type="password" placeholder="API key, e.g. sk-proj-AbCdEf…" autocomplete="off" style="flex:1;padding-left:28px;height:32px;box-sizing:border-box;">
+ </div>
+ <button class="admin-btn-add" id="adm-epAddBtn" style="height:32px;min-width:55px;text-align:center;display:inline-flex;align-items:center;justify-content:center;gap:4px;flex-shrink:0;box-sizing:border-box;">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>Add
</button>
</div>
<div id="adm-epApiMsg" class="adm-ep-inline-msg"></div>
- <div id="adm-deviceAuthStatus" class="adm-ep-inline-msg"></div>
+ <div id="adm-deviceAuthStatus" class="adm-ep-inline-msg" style="min-height:0;margin-top:0;"></div>
</div>
</div>
</div>
@@ -2141,24 +2200,8 @@
<div class="admin-toggle-sub" style="margin-bottom:8px">All external service connections in one place.</div>
<div id="unified-integrations-list"></div>
<div id="unified-intg-form" style="display:none"></div>
- <div style="text-align:center;padding:8px 0;">
- <button type="button" class="admin-btn-sm" id="unified-intg-add-btn" style="display:inline-flex;align-items:center;gap:6px;">+ Add Integration<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="opacity:0.7;"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg></button>
- </div>
- </div>
- <div class="admin-card admin-only" style="margin-top:12px;">
- <h2><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><path d="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"/></svg>API Tokens</h2>
- <div class="admin-toggle-sub" style="margin-bottom:8px">Bearer tokens for external integrations (scripts, Codex, headless agent runs). Token value shown ONCE on create — copy it then.</div>
- <div id="adm-tokenList" style="margin-bottom:8px;"></div>
- <div style="display:flex;gap:6px;flex-wrap:wrap;align-items:flex-start;">
- <input type="text" id="adm-tokenName" placeholder="Token name (e.g. agent-test)" class="settings-select" style="flex:1;min-width:160px;">
- <input type="text" id="adm-tokenScopes" placeholder="scopes (comma-separated, blank = chat)" class="settings-select" style="flex:2;min-width:220px;" title="Allowed: chat, cookbook:read, cookbook:launch, documents:read|write, todos:read|write, email:read|draft|send, calendar:read|write, memory:read|write">
- <button class="admin-btn-add" id="adm-tokenAddBtn">Create token</button>
- </div>
- <div id="adm-tokenMsg" style="font-size:11px;margin-top:6px;"></div>
- <div id="adm-tokenReveal" style="display:none;margin-top:8px;padding:8px 10px;background:color-mix(in srgb, var(--accent, var(--red)) 12%, transparent);border:1px solid color-mix(in srgb, var(--accent, var(--red)) 35%, transparent);border-radius:6px;">
- <div style="font-size:11px;font-weight:600;margin-bottom:4px;">Copy now — this is the only time you'll see it:</div>
- <code id="adm-tokenValue" style="font-family:'Berkeley Mono','SF Mono','Fira Code',monospace;font-size:11px;word-break:break-all;display:block;background:var(--bg);padding:6px 8px;border-radius:4px;margin-bottom:6px;user-select:all;"></code>
- <button class="admin-btn-sm" id="adm-tokenCopyBtn">Copy</button>
+ <div style="text-align:right;padding:8px 0;">
+ <button type="button" class="admin-btn-add" id="unified-intg-add-btn" style="text-align:center;display:inline-flex;align-items:center;justify-content:center;gap:5px;flex-shrink:0;"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>Add Integration</button>
</div>
</div>
</div>
@@ -2180,10 +2223,6 @@
<div id="set-agentMsg" style="font-size:11px;color:color-mix(in srgb, var(--fg) 45%, transparent);"></div>
</div>
</div>
- <div class="admin-card" style="margin-bottom:12px;">
- <h2 style="display:flex;align-items:center;gap:6px;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-right:1px;opacity:0.6;flex-shrink:0"><path d="M9 11l3 3L22 4"/><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"/></svg>Agent loop<span style="flex:1"></span><label class="admin-switch" title="On a failing effectful turn, climb verify → different-method → teacher → stop-and-summarize instead of silently quitting." style="flex-shrink:0"><input type="checkbox" id="set-agentSupervisorLadder"><span class="admin-slider"></span></label></h2>
- <div class="admin-toggle-sub" style="margin-bottom:8px">Supervisor ladder. When on, every effectful agent turn that claims done is verified; on FAIL the ladder escalates verify → different method → teacher → stop-with-blocker, each rung visible in chat. Teacher rung requires <code>teacher_model</code> to be set.</div>
- </div>
<div class="admin-card" style="margin-bottom:12px;">
<h2><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px;opacity:0.6"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>Built-in Tools</h2>
<div class="admin-toggle-sub" style="margin-bottom:8px">Enable or disable tools available to the AI agent.</div>
@@ -2210,68 +2249,76 @@
<div style="display:flex;justify-content:space-between;align-items:center;">
<div>
- <div class="admin-toggle-label">Wipe all chats</div>
+ <div class="admin-toggle-label">Delete all chats</div>
<div class="admin-toggle-sub">Every session, message, and chat history. Documents/notes/etc. stay.</div>
</div>
- <button class="admin-btn-delete" data-wipe-kind="chats" style="white-space:nowrap;">Wipe</button>
+ <button class="admin-btn-delete" data-wipe-kind="chats" title="Delete all chats" aria-label="Delete all chats" style="display:inline-flex;align-items:center;gap:5px;white-space:nowrap;"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>Delete</button>
</div>
<div style="display:flex;justify-content:space-between;align-items:center;margin-top:8px;">
<div>
- <div class="admin-toggle-label">Wipe all memory</div>
+ <div class="admin-toggle-label">Delete all memory</div>
<div class="admin-toggle-sub">Clears `memory.json`, the Memory table, and the vector store. Skills not affected.</div>
</div>
- <button class="admin-btn-delete" data-wipe-kind="memory" style="white-space:nowrap;">Wipe</button>
+ <button class="admin-btn-delete" data-wipe-kind="memory" title="Delete all memory" aria-label="Delete all memory" style="display:inline-flex;align-items:center;gap:5px;white-space:nowrap;"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>Delete</button>
</div>
<div style="display:flex;justify-content:space-between;align-items:center;margin-top:8px;">
<div>
- <div class="admin-toggle-label">Wipe all skills</div>
+ <div class="admin-toggle-label">Delete all skills</div>
<div class="admin-toggle-sub">Drops `data/skills/` (all SKILL.md files). Memory not affected.</div>
</div>
- <button class="admin-btn-delete" data-wipe-kind="skills" style="white-space:nowrap;">Wipe</button>
+ <button class="admin-btn-delete" data-wipe-kind="skills" title="Delete all skills" aria-label="Delete all skills" style="display:inline-flex;align-items:center;gap:5px;white-space:nowrap;"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>Delete</button>
</div>
<div style="display:flex;justify-content:space-between;align-items:center;margin-top:8px;">
<div>
- <div class="admin-toggle-label">Wipe all notes</div>
+ <div class="admin-toggle-label">Delete all notes</div>
<div class="admin-toggle-sub">Every note, todo, and checklist.</div>
</div>
- <button class="admin-btn-delete" data-wipe-kind="notes" style="white-space:nowrap;">Wipe</button>
+ <button class="admin-btn-delete" data-wipe-kind="notes" title="Delete all notes" aria-label="Delete all notes" style="display:inline-flex;align-items:center;gap:5px;white-space:nowrap;"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>Delete</button>
</div>
<div style="display:flex;justify-content:space-between;align-items:center;margin-top:8px;">
<div>
- <div class="admin-toggle-label">Wipe all tasks</div>
+ <div class="admin-toggle-label">Delete all tasks</div>
<div class="admin-toggle-sub">Every scheduled task and its run history (Tasks tool).</div>
</div>
- <button class="admin-btn-delete" data-wipe-kind="tasks" style="white-space:nowrap;">Wipe</button>
+ <button class="admin-btn-delete" data-wipe-kind="tasks" title="Delete all tasks" aria-label="Delete all tasks" style="display:inline-flex;align-items:center;gap:5px;white-space:nowrap;"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>Delete</button>
</div>
<div style="display:flex;justify-content:space-between;align-items:center;margin-top:8px;">
<div>
- <div class="admin-toggle-label">Wipe all documents</div>
+ <div class="admin-toggle-label">Delete all documents</div>
<div class="admin-toggle-sub">Every document and version. Drafts, exports, library — all gone.</div>
</div>
- <button class="admin-btn-delete" data-wipe-kind="documents" style="white-space:nowrap;">Wipe</button>
+ <button class="admin-btn-delete" data-wipe-kind="documents" title="Delete all documents" aria-label="Delete all documents" style="display:inline-flex;align-items:center;gap:5px;white-space:nowrap;"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>Delete</button>
</div>
<div style="display:flex;justify-content:space-between;align-items:center;margin-top:8px;">
<div>
- <div class="admin-toggle-label">Wipe all gallery</div>
+ <div class="admin-toggle-label">Delete all gallery</div>
<div class="admin-toggle-sub">Every image record and the upload directory on disk.</div>
</div>
- <button class="admin-btn-delete" data-wipe-kind="gallery" style="white-space:nowrap;">Wipe</button>
+ <button class="admin-btn-delete" data-wipe-kind="gallery" title="Delete all gallery" aria-label="Delete all gallery" style="display:inline-flex;align-items:center;gap:5px;white-space:nowrap;"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>Delete</button>
</div>
<div style="display:flex;justify-content:space-between;align-items:center;margin-top:8px;">
<div>
- <div class="admin-toggle-label">Wipe all calendar</div>
+ <div class="admin-toggle-label">Delete all calendar</div>
<div class="admin-toggle-sub">Every event and every calendar (incl. CalDAV-synced ones; resync to restore).</div>
</div>
- <button class="admin-btn-delete" data-wipe-kind="calendar" style="white-space:nowrap;">Wipe</button>
+ <button class="admin-btn-delete" data-wipe-kind="calendar" title="Delete all calendar" aria-label="Delete all calendar" style="display:inline-flex;align-items:center;gap:5px;white-space:nowrap;"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>Delete</button>
</div>
+ <hr style="border:0;border-top:1px solid color-mix(in srgb, #e55 25%, var(--border));margin:14px 0 10px;">
+ <div style="display:flex;justify-content:space-between;align-items:center;">
+ <div>
+ <div class="admin-toggle-label" style="color:#e55;">Delete everything</div>
+ <div class="admin-toggle-sub">All eight categories above, in one go. Same effect as wiping each one in sequence.</div>
+ </div>
+ <button class="admin-btn-delete" data-wipe-kind="__all__" title="Delete every category" aria-label="Delete everything" style="display:inline-flex;align-items:center;gap:5px;white-space:nowrap;font-weight:600;"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>Delete All</button>
+ </div>
<div id="adm-wipeMsg" style="margin-top:8px;"></div>
</div>
</div>
diff --git a/static/js/admin.js b/static/js/admin.js
index 69b3179dc..8b8ae47e0 100644
--- a/static/js/admin.js
+++ b/static/js/admin.js
@@ -3,7 +3,7 @@
import uiModule from './ui.js';
import settingsModule from './settings.js';
-import { providerLogo } from './providers.js';
+import { providerLogo, providerLogoFromUrl } from './providers.js';
import { sortModelObjects } from './modelSort.js';
import { PROVIDER_DEVICE_FLOWS, formatDeviceFlowError, runProviderDeviceFlow } from './providerDeviceFlow.js';
@@ -449,13 +449,14 @@ async function loadEndpoints() {
return `
<div class="admin-user-row${ep.is_enabled ? '' : ' admin-ep-disabled'}${justAddedClass}" data-adm-ep-id="${ep.id}">
<div style="display:flex;align-items:center;justify-content:space-between;${hasModels ? 'cursor:pointer;' : ''}padding:4px 0;" data-adm-ep-header="${ep.id}">
- <div class="admin-user-info" style="flex:1;flex-wrap:wrap;gap:0.3rem;">
+ <div class="admin-user-info" style="flex:1;flex-wrap:wrap;gap:0.3rem;align-items:center;">
+ <span class="adm-ep-row-logo" style="display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;flex-shrink:0;opacity:0.9;">${providerLogoFromUrl(ep.base_url) || ''}</span>
<span class="admin-user-name">${esc(ep.name)}</span>
${ep.model_type === 'image' ? '<span class="admin-badge" style="background:color-mix(in srgb, var(--accent) 20%, transparent);color:var(--accent);">Image</span>' : ''}
${kindLabel ? `<span class="admin-badge">${esc(kindLabel)}</span>` : ''}
${statusBadge}
${ep.is_enabled ? '' : '<span class="admin-badge admin-badge-off">disabled</span>'}
- ${hasModels ? '<span style="font-size:10px;opacity:0.4;">Click to manage models</span>' : ''}
+ ${hasModels ? `<span style="font-size:10px;opacity:0.4;${category === 'api' ? 'flex-basis:100%;' : ''}">Click to manage models</span>` : ''}
</div>
<div style="display:flex;gap:4px;align-items:center;">
<button class="admin-btn-sm" data-adm-toggle-ep="${ep.id}">${ep.is_enabled ? 'Disable' : 'Enable'}</button>
@@ -828,6 +829,14 @@ function initEndpointForm() {
document.addEventListener('click', (e) => {
if (!picker.contains(e.target)) pickerMenu.classList.add('hidden');
});
+ // Capture-phase Esc: dismiss the picker menu without bubbling to the
+ // settings-modal handler that would otherwise close the whole modal.
+ document.addEventListener('keydown', (e) => {
+ if (e.key !== 'Escape') return;
+ if (pickerMenu.classList.contains('hidden')) return;
+ e.stopPropagation();
+ pickerMenu.classList.add('hidden');
+ }, { capture: true });
}
provider.addEventListener('change', () => {
@@ -1022,14 +1031,15 @@ function initEndpointForm() {
if (d.id) _recentlyAddedEpId = String(d.id);
await loadEndpoints();
await _selectAddedModelInChat(d);
+ const goLink = ' <a href="#" data-go-added-models style="margin-left:6px;text-decoration:underline;color:inherit;font-weight:600;">Added Models →</a>';
if (!d.online) {
- msg.textContent = 'Added (endpoint offline — will retry on next load)';
+ msg.innerHTML = 'Added (endpoint offline — will retry on next load)' + goLink;
msg.className = 'admin-error';
} else if (d.status === 'empty') {
- msg.textContent = 'Added — endpoint reachable, no models found';
+ msg.innerHTML = 'Added — endpoint reachable, no models found' + goLink;
msg.className = 'admin-success';
} else {
- msg.textContent = `Added — found ${count} model${count !== 1 ? 's' : ''}`;
+ msg.innerHTML = `Added — found ${count} model${count !== 1 ? 's' : ''}` + goLink;
msg.className = 'admin-success';
}
} else { msg.textContent = d.detail || 'Failed'; msg.className = 'admin-error'; }
@@ -1169,6 +1179,125 @@ function initEndpointForm() {
};
_wireKeyToggle('adm-epLocalKeyBtn', 'adm-epLocalApiKey-row');
+ // Delegated link handler for jumping between settings tabs.
+ // [data-go-added-models] → quick shortcut for the Added Models tab
+ // [data-go-settings-tab="X"] → any tab whose nav button has data-settings-tab="X"
+ // [data-go-scroll-to="#elementId"] → after switching, scroll the element into view
+ document.addEventListener('click', (e) => {
+ const explicit = e.target.closest('[data-go-settings-tab]');
+ if (explicit) {
+ e.preventDefault();
+ const tab = explicit.getAttribute('data-go-settings-tab');
+ const scrollTo = explicit.getAttribute('data-go-scroll-to');
+ const btn = document.querySelector(`[data-settings-tab="${tab}"]`);
+ if (btn) btn.click();
+ if (scrollTo) {
+ // Defer to the next frame so the panel has actually become visible
+ // before we try to scroll into it.
+ requestAnimationFrame(() => {
+ const target = document.querySelector(scrollTo);
+ if (target) target.scrollIntoView({ behavior: 'smooth', block: 'start' });
+ });
+ }
+ return;
+ }
+ const link = e.target.closest('[data-go-added-models]');
+ if (!link) return;
+ e.preventDefault();
+ const btn = document.querySelector('[data-settings-tab="added-models"]');
+ if (btn) btn.click();
+ });
+
+ // Generic open/close helper for the kebab dropdowns in this card.
+ // Both the Local and API cards use the same shape: an h2-anchored button
+ // with id "<prefix>MoreBtn" toggles a sibling menu with id "<prefix>MoreMenu".
+ // Global Esc handler: close any currently-open kebab menu in the admin
+ // panel regardless of which _wireKebab instance owns it. Belt-and-braces
+ // backup for the per-instance handler below — registered once.
+ if (!document._admKebabEscWired) {
+ document._admKebabEscWired = true;
+ document.addEventListener('keydown', (e) => {
+ if (e.key !== 'Escape') return;
+ // Any visible kebab dropdown in the admin panel — match by id pattern
+ // so adding a new kebab elsewhere automatically benefits.
+ const menus = document.querySelectorAll(
+ '#adm-epLocalMoreMenu, #adm-epApiMoreMenu'
+ );
+ let closed = false;
+ menus.forEach((m) => {
+ if (m && m.style.display !== 'none') {
+ m.style.display = 'none';
+ // Sync the associated button's aria-expanded when we can find it.
+ const btn = document.getElementById(m.id.replace('Menu', 'Btn'));
+ if (btn) btn.setAttribute('aria-expanded', 'false');
+ closed = true;
+ }
+ });
+ if (closed) e.stopPropagation();
+ }, { capture: true });
+ }
+
+ const _wireKebab = (btnId, menuId, onItem) => {
+ const btn = el(btnId);
+ const menu = el(menuId);
+ if (!btn || !menu) return;
+ const isOpen = () => menu.style.display !== 'none';
+ const close = () => { menu.style.display = 'none'; btn.setAttribute('aria-expanded', 'false'); };
+ const open = () => { menu.style.display = 'flex'; btn.setAttribute('aria-expanded', 'true'); };
+ btn.addEventListener('click', (e) => {
+ e.stopPropagation();
+ if (isOpen()) close(); else open();
+ });
+ menu.addEventListener('click', (e) => {
+ const item = e.target.closest('.adm-more-item');
+ if (!item) return;
+ if (onItem) onItem(item, e);
+ close();
+ });
+ document.addEventListener('click', (e) => {
+ if (!isOpen()) return;
+ if (e.target.closest('#' + menuId + ', #' + btnId)) return;
+ close();
+ });
+ // Use capture phase so this fires before the settings-modal Esc handler
+ // (which is in bubble phase). stopPropagation prevents the modal from
+ // closing when the user only meant to dismiss this menu.
+ document.addEventListener('keydown', (e) => {
+ if (e.key === 'Escape' && isOpen()) {
+ e.stopPropagation();
+ close();
+ }
+ }, { capture: true });
+ };
+
+ // API card "..." menu: contains the Proxy/API connection-mode toggle.
+ // Sync the visible checkmarks with the hidden #adm-epKind select so
+ // downstream code (which reads kindSel.value) keeps working.
+ (function wireApiKindMenu() {
+ const kind = el('adm-epKind');
+ if (!kind) return;
+ const opts = document.querySelectorAll('#adm-epApiMoreMenu .adm-kind-opt');
+ const sync = () => {
+ opts.forEach((o) => {
+ const check = o.querySelector('.adm-kind-check');
+ if (check) check.style.visibility = (o.dataset.kind === kind.value) ? 'visible' : 'hidden';
+ });
+ };
+ sync();
+ kind.addEventListener('change', sync);
+ _wireKebab('adm-epApiMoreBtn', 'adm-epApiMoreMenu', (item) => {
+ const k = item.dataset.kind;
+ if (!k) return;
+ kind.value = k;
+ kind.dispatchEvent(new Event('change'));
+ });
+ })();
+
+ // Local card "..." kebab: holds Scan network / Ollama / API key reveal.
+ // Item buttons keep their own click handlers; the helper just handles
+ // open/close + outside-click + Esc.
+ _wireKebab('adm-epLocalMoreBtn', 'adm-epLocalMoreMenu');
+
// ── Added Models toolbar: Probe + Clear offline ────────────────────
// Both buttons act over the currently-rendered endpoint list. The
// online/offline marker is stamped on each row's [data-adm-ep-online]
@@ -1179,10 +1308,10 @@ function initEndpointForm() {
if (!lbl) return;
const n = document.querySelectorAll('[data-adm-ep-id] [data-adm-ep-online="0"]').length;
lbl.textContent = n > 0 ? `(${n})` : '';
- // Keep the button enabled even when there are no offline rows — a
- // click on the empty case fires a toast instead of feeling dead.
+ // Hide the button entirely when there's nothing offline — no point
+ // showing an action that has nothing to act on.
const btn = el('adm-epClearOfflineBtn');
- if (btn) btn.style.opacity = n === 0 ? '0.55' : '0.85';
+ if (btn) btn.style.display = n === 0 ? 'none' : '';
};
// Wire after every loadEndpoints() run by patching the render hook —
// simplest path: MutationObserver on the two list containers.
@@ -1199,7 +1328,17 @@ function initEndpointForm() {
probeAllBtn.addEventListener('click', async () => {
probeAllBtn.disabled = true;
const origHTML = probeAllBtn.innerHTML;
- probeAllBtn.innerHTML = '<span style="opacity:0.7;">Probing…</span>';
+ let _wp = null;
+ try {
+ const sp = window.spinnerModule || (await import('./spinner.js')).default;
+ _wp = sp.createWhirlpool(11);
+ _wp.element.style.cssText = 'display:inline-flex;width:11px;height:11px;margin:0 4px 0 0;';
+ probeAllBtn.innerHTML = '';
+ probeAllBtn.appendChild(_wp.element);
+ probeAllBtn.appendChild(document.createTextNode('Probing'));
+ } catch (_) {
+ probeAllBtn.innerHTML = '<span style="opacity:0.7;">Probing…</span>';
+ }
try {
// Hit the bulk local probe (same one the model picker uses).
await fetch('/api/model-endpoints/probe-local', { credentials: 'same-origin' }).catch(() => {});
@@ -1221,6 +1360,7 @@ function initEndpointForm() {
await loadEndpoints();
if (uiModule && uiModule.showToast) uiModule.showToast('Endpoint status refreshed', 1800);
} finally {
+ if (_wp) { try { _wp.destroy(); } catch (_) {} }
probeAllBtn.innerHTML = origHTML;
probeAllBtn.disabled = false;
}
@@ -1290,16 +1430,17 @@ function initEndpointForm() {
const localAddBtn = el('adm-epLocalAddBtn');
const localTestBtn = el('adm-epLocalTestBtn');
if (localTestBtn) {
+ const testOriginalHtml = localTestBtn.innerHTML;
localTestBtn.addEventListener('click', async () => {
const msg = _endpointMsg('local');
- msg.textContent = ''; msg.className = '';
+ msg.textContent = ''; msg.className = 'adm-ep-inline-msg';
const raw = (el('adm-epLocalUrl').value || '').trim();
if (!raw) { msg.textContent = 'Enter a base URL to test'; msg.className = 'admin-error'; return; }
const url = _normalizeBaseUrl(raw);
const keyEl = el('adm-epLocalApiKey');
const apiKey = keyEl ? keyEl.value.trim() : '';
localTestBtn.disabled = true;
- localTestBtn.textContent = 'Testing...';
+ localTestBtn.innerHTML = testOriginalHtml.replace(/>Test\s*$/, '>Testing...');
try {
const fd = new FormData();
fd.append('base_url', url);
@@ -1312,19 +1453,21 @@ function initEndpointForm() {
msg.className = 'admin-error';
}
localTestBtn.disabled = false;
- localTestBtn.textContent = 'Test';
+ localTestBtn.innerHTML = testOriginalHtml;
});
}
if (localAddBtn) {
+ const addOriginalHtml = localAddBtn.innerHTML;
localAddBtn.addEventListener('click', async () => {
const msg = _endpointMsg('local');
- msg.textContent = ''; msg.className = '';
+ msg.textContent = ''; msg.className = 'adm-ep-inline-msg';
const raw = (el('adm-epLocalUrl').value || '').trim();
if (!raw) { msg.textContent = 'Enter a base URL (e.g. http://localhost:8002/v1)'; msg.className = 'admin-error'; return; }
const url = _normalizeBaseUrl(raw);
const keyEl = el('adm-epLocalApiKey');
const apiKey = keyEl ? keyEl.value.trim() : '';
- localAddBtn.disabled = true; localAddBtn.textContent = 'Adding...';
+ localAddBtn.disabled = true;
+ localAddBtn.innerHTML = addOriginalHtml.replace(/>Add\s*$/, '>Adding...');
try {
const fd = new FormData();
fd.append('base_url', url);
@@ -1344,15 +1487,17 @@ function initEndpointForm() {
await loadEndpoints();
await _selectAddedModelInChat(d);
const count = (d.models || []).length;
- msg.textContent = d.status === 'empty'
+ const baseText = d.status === 'empty'
? 'Added — Ollama is running, no models pulled yet'
: d.online
? `Added — found ${count} model${count !== 1 ? 's' : ''}`
: 'Added (offline — will retry on next load)';
+ msg.innerHTML = `${baseText} <a href="#" data-go-added-models style="margin-left:6px;text-decoration:underline;color:inherit;font-weight:600;">Added Models →</a>`;
msg.className = d.online ? 'admin-success' : 'admin-error';
} else { msg.textContent = d.detail || 'Failed'; msg.className = 'admin-error'; }
} catch (e) { msg.textContent = 'Request failed'; msg.className = 'admin-error'; }
- localAddBtn.disabled = false; localAddBtn.textContent = 'Add';
+ localAddBtn.disabled = false;
+ localAddBtn.innerHTML = addOriginalHtml;
});
}
@@ -1378,10 +1523,7 @@ function initEndpointForm() {
discoverBtn.addEventListener('click', async () => {
const msg = _endpointMsg('local');
discoverBtn.disabled = true;
- // Keep the button's icon as-is while scanning; the whirlpool +
- // status text below is enough feedback. (Two spinning indicators
- // at once looks busy.)
- msg.className = '';
+ msg.className = 'adm-ep-inline-msg';
msg.innerHTML = '';
try {
const sp = window.spinnerModule || (await import('./spinner.js')).default;
@@ -1392,7 +1534,7 @@ function initEndpointForm() {
wrap.appendChild(wp.element);
const txt = document.createElement('span');
txt.textContent = 'Scanning ports 8000-8020 and 11434 for model servers...';
- txt.style.cssText = 'font-size:12px;opacity:0.7;';
+ txt.style.cssText = 'opacity:0.7;';
wrap.appendChild(txt);
msg.appendChild(wrap);
discoverBtn._wp = wp;
@@ -2158,28 +2300,126 @@ function initRag() {
/* ═══════════════════════════════════════════
SYSTEM TAB — Tokens
═══════════════════════════════════════════ */
+// Catalog mirrors the one in settings.js integration form. Keep keys in
+// sync with the backend scope allowlist.
+const _TOKEN_SCOPES = [
+ { key: 'todos:read', label: 'Todos read', detail: 'Read notes and checklists' },
+ { key: 'todos:write', label: 'Todos write', detail: 'Create, update, delete, and toggle todo items' },
+ { key: 'documents:read', label: 'Documents read', detail: 'Read documents when a document API is enabled' },
+ { key: 'documents:write', label: 'Documents write', detail: 'Create and update draft documents' },
+ { key: 'email:read', label: 'Email read', detail: 'Read email when an email API is enabled' },
+ { key: 'email:draft', label: 'Email draft', detail: 'Create email reply drafts without sending' },
+ { key: 'email:send', label: 'Email send', detail: 'Send email directly' },
+ { key: 'calendar:read', label: 'Calendar read', detail: 'Read calendar events when enabled' },
+ { key: 'calendar:write', label: 'Calendar write', detail: 'Create and update calendar events' },
+ { key: 'memory:read', label: 'Memory read', detail: 'Read memory when enabled' },
+ { key: 'memory:write', label: 'Memory write', detail: 'Write memory when enabled' },
+ { key: 'cookbook:read', label: 'Cookbook read', detail: 'List cookbook tasks + tail their tmux output' },
+ { key: 'cookbook:launch', label: 'Cookbook launch', detail: 'Launch and stop cookbook serve tasks' },
+];
+
+function _renderTokenScopeRows(t) {
+ const have = new Set(t.scopes || []);
+ return _TOKEN_SCOPES.map(s => {
+ const action = (s.key.split(':')[1] || '').toLowerCase();
+ const pill = action === 'read'
+ ? 'background:rgba(150,150,150,0.18);color:var(--fg-muted,#888);'
+ : 'background:color-mix(in srgb, var(--accent, var(--red)) 18%, transparent);color:var(--accent, var(--red));';
+ const tool = s.label.replace(/\s+(read|write|draft|send|launch)$/i, '');
+ return `
+ <label style="display:flex;align-items:center;gap:8px;min-height:28px;padding:1px 0;">
+ <span class="settings-label" style="width:90px;flex-shrink:0;padding:0;font-size:12px;">${esc(tool)}</span>
+ <span style="font-size:9px;font-weight:600;text-transform:uppercase;letter-spacing:0.5px;padding:1px 7px;border-radius:999px;flex-shrink:0;min-width:44px;text-align:center;box-sizing:border-box;${pill}">${esc(action)}</span>
+ <span style="font-size:11px;line-height:1.35;opacity:0.62;flex:1;min-width:0;">${esc(s.detail)}</span>
+ <label class="admin-switch" style="margin-left:auto;flex-shrink:0;"><input type="checkbox" class="adm-tok-scope" data-token-id="${esc(t.id)}" data-scope="${esc(s.key)}" ${have.has(s.key) ? 'checked' : ''}><span class="admin-slider"></span></label>
+ </label>`;
+ }).join('');
+}
+
async function loadTokens() {
const list = el('adm-tokenList');
+ if (!list) return;
try {
const res = await fetch('/api/tokens', { credentials: 'same-origin' });
const tokens = await res.json();
- if (!tokens.length) { list.innerHTML = '<div class="admin-empty">No API tokens</div>'; return; }
+ if (!tokens.length) { list.innerHTML = '<div class="admin-empty" style="color:var(--accent, var(--red));opacity:0.7;font-size:10px;">No API tokens</div>'; return; }
list.innerHTML = tokens.map(t => `
- <div class="admin-user-row">
- <div class="admin-user-info" style="flex:1;flex-wrap:wrap;gap:0.3rem;">
- <span class="admin-user-name">${esc(t.name)}</span>
- <span class="admin-badge">${esc(t.token_prefix)}...</span>
- <span class="admin-badge" title="Allowed API scopes">${esc((t.scopes || ['chat']).join(', '))}</span>
- ${t.owner ? `<span style="font-size:0.75rem;opacity:0.5;">Owner: ${esc(t.owner)}</span>` : ''}
- ${t.last_used_at ? `<span style="font-size:0.75rem;opacity:0.5;">Last used: ${new Date(t.last_used_at).toLocaleDateString()}</span>` : '<span style="font-size:0.75rem;opacity:0.4;">Never used</span>'}
+ <div class="admin-user-row" data-adm-tok-row="${esc(t.id)}" style="display:block;">
+ <div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap;">
+ <div class="admin-user-info" style="flex:1;min-width:0;flex-wrap:wrap;gap:0.3rem;">
+ <input type="text" class="adm-tok-rename" data-token-id="${esc(t.id)}" value="${esc(t.name || '')}" placeholder="Token name" style="font-size:13px;font-weight:600;padding:3px 6px;background:transparent;border:1px solid transparent;border-radius:4px;min-width:160px;" title="Click to rename">
+ <span class="admin-badge">${esc(t.token_prefix)}...</span>
+ ${t.owner ? `<span style="font-size:0.75rem;opacity:0.5;">Owner: ${esc(t.owner)}</span>` : ''}
+ ${t.last_used_at ? `<span style="font-size:0.75rem;opacity:0.5;">Last used: ${new Date(t.last_used_at).toLocaleDateString()}</span>` : '<span style="font-size:0.75rem;opacity:0.4;">Never used</span>'}
+ </div>
+ <button class="admin-btn-sm" data-adm-tok-toggle="${esc(t.id)}" style="opacity:0.75;">Permissions</button>
+ <button class="admin-btn-delete" data-adm-del-token="${esc(t.id)}">Revoke</button>
+ </div>
+ <div data-adm-tok-perm="${esc(t.id)}" style="display:none;margin-top:8px;padding:8px 4px 0;border-top:1px solid var(--border);">
+ ${_renderTokenScopeRows(t)}
+ <div class="adm-tok-scope-msg" data-token-id="${esc(t.id)}" style="font-size:11px;min-height:14px;margin-top:4px;"></div>
</div>
- <button class="admin-btn-delete" data-adm-del-token="${t.id}">Revoke</button>
</div>`).join('');
+
+ // Revoke
list.querySelectorAll('[data-adm-del-token]').forEach(btn => {
btn.addEventListener('click', async () => {
if (!await uiModule.styledConfirm('Revoke this API token? External integrations using it will stop working.', { confirmText: 'Revoke', danger: true })) return;
await fetch(`/api/tokens/${btn.dataset.admDelToken}`, { method: 'DELETE', credentials: 'same-origin' });
loadTokens();
+ // Codex / Claude integration cards on the Integrations panel are
+ // backed by these tokens — let them re-render so the deleted token
+ // disappears there too.
+ try { window.dispatchEvent(new CustomEvent('odysseus-integrations-changed')); } catch (_) {}
+ });
+ });
+ // Toggle permissions panel
+ list.querySelectorAll('[data-adm-tok-toggle]').forEach(btn => {
+ btn.addEventListener('click', () => {
+ const panel = list.querySelector(`[data-adm-tok-perm="${btn.dataset.admTokToggle}"]`);
+ if (!panel) return;
+ panel.style.display = panel.style.display === 'none' ? '' : 'none';
+ });
+ });
+ // Rename
+ list.querySelectorAll('.adm-tok-rename').forEach(input => {
+ const original = input.value;
+ const commit = async () => {
+ const name = (input.value || '').trim();
+ if (!name || name === original) return;
+ try {
+ const r = await fetch(`/api/tokens/${input.dataset.tokenId}`, {
+ method: 'PATCH', credentials: 'same-origin',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ name }),
+ });
+ if (!r.ok) throw new Error('Save failed');
+ loadTokens();
+ } catch (_) { input.value = original; }
+ };
+ input.addEventListener('blur', commit);
+ input.addEventListener('keydown', e => { if (e.key === 'Enter') { e.preventDefault(); input.blur(); } });
+ });
+ // Scope toggle change → PATCH the whole scopes array for this token.
+ list.querySelectorAll('.adm-tok-scope').forEach(cb => {
+ cb.addEventListener('change', async () => {
+ const tokenId = cb.dataset.tokenId;
+ const panel = list.querySelector(`[data-adm-tok-perm="${tokenId}"]`);
+ const msg = list.querySelector(`.adm-tok-scope-msg[data-token-id="${tokenId}"]`);
+ const scopes = Array.from(panel.querySelectorAll('.adm-tok-scope:checked')).map(input => input.dataset.scope);
+ try {
+ const r = await fetch(`/api/tokens/${tokenId}`, {
+ method: 'PATCH', credentials: 'same-origin',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ scopes }),
+ });
+ const d = await r.json().catch(() => ({}));
+ if (!r.ok) throw new Error(d.detail || 'Failed');
+ if (msg) { msg.textContent = 'Saved'; msg.style.color = 'var(--green, #50fa7b)'; setTimeout(() => { msg.textContent = ''; }, 1200); }
+ } catch (err) {
+ cb.checked = !cb.checked;
+ if (msg) { msg.textContent = (err && err.message) || 'Failed'; msg.style.color = 'var(--red)'; }
+ }
});
});
} catch (e) { list.innerHTML = '<div class="admin-error">Failed to load tokens</div>'; }
@@ -2211,11 +2451,20 @@ function initTokenForm() {
else { msg.textContent = data.detail || 'Failed'; msg.className = 'admin-error'; }
} catch (e) { msg.textContent = 'Request failed'; msg.className = 'admin-error'; }
});
+ const TOKEN_COPY_ICON = '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';
+ const TOKEN_CHECK_ICON = '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>';
el('adm-tokenCopyBtn').addEventListener('click', () => {
const val = el('adm-tokenValue').textContent;
+ const btn = el('adm-tokenCopyBtn');
navigator.clipboard.writeText(val).then(() => {
- el('adm-tokenCopyBtn').textContent = 'Copied!';
- setTimeout(() => { el('adm-tokenCopyBtn').textContent = 'Copy'; }, 2000);
+ btn.innerHTML = TOKEN_CHECK_ICON;
+ btn.style.color = 'var(--accent, var(--red))';
+ btn.style.opacity = '1';
+ setTimeout(() => {
+ btn.innerHTML = TOKEN_COPY_ICON;
+ btn.style.color = '';
+ btn.style.opacity = '0.7';
+ }, 1600);
});
});
}
@@ -2442,23 +2691,54 @@ function initDangerZone() {
modalEl.querySelectorAll('[data-wipe-kind]').forEach(btn => {
btn.addEventListener('click', async () => {
const kind = btn.dataset.wipeKind;
- const label = _LABELS[kind] || kind;
- if (!await uiModule.styledConfirm(`Wipe ALL ${label}? This cannot be undone.`, { confirmText: 'Wipe', danger: true })) return;
- if (!await uiModule.styledConfirm(`Really wipe every one of your ${label}?`, { confirmText: 'Yes, wipe everything', danger: true })) return;
- btn.disabled = true; const prev = btn.textContent; btn.textContent = 'Wiping…';
+ const isAll = kind === '__all__';
+ const label = isAll ? 'data across every category' : (_LABELS[kind] || kind);
+ if (!await uiModule.styledConfirm(`Delete ALL ${label}? This cannot be undone.`, { confirmText: 'Delete', danger: true })) return;
+ if (!await uiModule.styledConfirm(`Really delete every one of your ${label}?`, { confirmText: isAll ? 'Yes, delete everything' : 'Yes, delete everything', danger: true })) return;
+ btn.disabled = true;
+ const prevHtml = btn.innerHTML;
+ btn.innerHTML = isAll ? 'Deleting all…' : 'Deleting…';
if (_wipeMsg) { _wipeMsg.textContent = ''; _wipeMsg.className = ''; }
try {
- const res = await fetch(`/api/admin/wipe/${kind}`, { method: 'DELETE', credentials: 'same-origin' });
- const data = await res.json().catch(() => ({}));
- if (res.ok) {
- if (_wipeMsg) { _wipeMsg.textContent = `Wiped ${data.count ?? 0} ${label}.`; _wipeMsg.className = 'admin-success'; }
+ if (isAll) {
+ // Iterate every known category. Failures in one shouldn't stop
+ // the rest — record per-category counts and surface a summary.
+ const kinds = Object.keys(_LABELS);
+ const results = [];
+ for (const k of kinds) {
+ try {
+ const r = await fetch(`/api/admin/wipe/${k}`, { method: 'DELETE', credentials: 'same-origin' });
+ const d = await r.json().catch(() => ({}));
+ results.push({ k, ok: r.ok, count: d.count ?? 0, error: r.ok ? null : (d.detail || 'failed') });
+ } catch (e) {
+ results.push({ k, ok: false, count: 0, error: e.message });
+ }
+ }
+ const okCount = results.filter(r => r.ok).length;
+ const total = results.reduce((n, r) => n + (r.ok ? r.count : 0), 0);
+ const fails = results.filter(r => !r.ok).map(r => r.k);
+ if (_wipeMsg) {
+ if (!fails.length) {
+ _wipeMsg.textContent = `Deleted ${total} items across all ${okCount} categories.`;
+ _wipeMsg.className = 'admin-success';
+ } else {
+ _wipeMsg.textContent = `Deleted ${total} items; failed: ${fails.join(', ')}.`;
+ _wipeMsg.className = 'admin-error';
+ }
+ }
} else {
- if (_wipeMsg) { _wipeMsg.textContent = data.detail || 'Failed'; _wipeMsg.className = 'admin-error'; }
+ const res = await fetch(`/api/admin/wipe/${kind}`, { method: 'DELETE', credentials: 'same-origin' });
+ const data = await res.json().catch(() => ({}));
+ if (res.ok) {
+ if (_wipeMsg) { _wipeMsg.textContent = `Deleted ${data.count ?? 0} ${label}.`; _wipeMsg.className = 'admin-success'; }
+ } else {
+ if (_wipeMsg) { _wipeMsg.textContent = data.detail || 'Failed'; _wipeMsg.className = 'admin-error'; }
+ }
}
} catch (e) {
if (_wipeMsg) { _wipeMsg.textContent = 'Request failed: ' + e.message; _wipeMsg.className = 'admin-error'; }
}
- btn.disabled = false; btn.textContent = prev;
+ btn.disabled = false; btn.innerHTML = prevHtml;
});
});
}
diff --git a/static/js/emailLibrary.js b/static/js/emailLibrary.js
index 4dd2f720d..7638224b1 100644
--- a/static/js/emailLibrary.js
+++ b/static/js/emailLibrary.js
@@ -22,6 +22,7 @@ import {
_tryFoldHintSig, _foldSignature, _SIG_ICON, _QUOTE_ICON,
} from './emailLibrary/signatureFold.js';
import { state } from './emailLibrary/state.js';
+import { collapseSidebarToRail } from './modalSnap.js';
const API_BASE = window.location.origin;
let _emailUnreadChipClickWired = false;
@@ -406,7 +407,14 @@ function _clearEmailDocumentSplit() {
].forEach(prop => docPane.style.removeProperty(prop));
}
-function _hasDesktopRoomForEmailAndDocument(modal) {
+// Compute the left-edge x assuming the wide sidebar has collapsed to the
+// rail. Used by the "try collapsing the sidebar first" path so we can decide
+// whether collapsing recovers enough room before minimizing email.
+function _emailSplitLeftEdgeIfSidebarCollapsed() {
+ return _readCssPx('--icon-rail-w');
+}
+
+function _hasDesktopRoomForEmailAndDocument(modal, opts = {}) {
if (window.innerWidth <= 768) return false;
if (window.innerWidth >= 1100) return true;
const content = modal?.querySelector?.('.modal-content');
@@ -416,9 +424,12 @@ function _hasDesktopRoomForEmailAndDocument(modal) {
const emailWidth = isFullscreen
? Math.min(440, Math.max(360, Math.round(window.innerWidth * 0.30)))
: Math.max(360, Math.round(rect?.width || 440));
- const docMinWidth = 560;
- const breathingRoom = 72;
- const leftEdge = isFullscreen ? _emailSplitLeftEdge() : Math.max(0, Math.round(rect?.left || _emailSplitLeftEdge()));
+ // Relaxed thresholds — the old 560 + 72 forced an unnecessary tab-down
+ // on ~1200–1300px viewports where there was visually plenty of room.
+ const docMinWidth = 460;
+ const breathingRoom = 40;
+ const leftEdgeNow = isFullscreen ? _emailSplitLeftEdge() : Math.max(0, Math.round(rect?.left || _emailSplitLeftEdge()));
+ const leftEdge = opts.assumeSidebarCollapsed ? _emailSplitLeftEdgeIfSidebarCollapsed() : leftEdgeNow;
return (window.innerWidth - leftEdge - emailWidth) >= (docMinWidth + breathingRoom);
}
@@ -426,8 +437,18 @@ function _prepareEmailWindowForDocument(modal) {
if (window.innerWidth <= 768) return true;
if (!modal) return false;
if (!_hasDesktopRoomForEmailAndDocument(modal)) {
- _clearEmailDocumentSplit();
- return true;
+ // Before giving up and minimizing email, see if collapsing the wide
+ // sidebar to the rail would recover enough space. The route-collapse
+ // marker that collapseSidebarToRail() sets makes the existing
+ // auto-restore logic put the sidebar back when the doc closes.
+ const sidebar = document.getElementById('sidebar');
+ const sidebarWasOpen = sidebar && !sidebar.classList.contains('hidden');
+ if (sidebarWasOpen && _hasDesktopRoomForEmailAndDocument(modal, { assumeSidebarCollapsed: true })) {
+ try { collapseSidebarToRail(); } catch (_) {}
+ } else {
+ _clearEmailDocumentSplit();
+ return true;
+ }
}
if (modal.classList.contains('modal-left-docked')) {
const content = modal.querySelector('.modal-content');
diff --git a/static/js/modalSnap.js b/static/js/modalSnap.js
index e7cce55dd..ad5e04a99 100644
--- a/static/js/modalSnap.js
+++ b/static/js/modalSnap.js
@@ -302,6 +302,7 @@ function _anchorLeftDock(content) {
}
}
+export function collapseSidebarToRail() { return _collapseSidebarToRail(); }
function _collapseSidebarToRail() {
const sidebar = document.getElementById('sidebar');
const rail = document.getElementById('icon-rail');
diff --git a/static/js/providers.js b/static/js/providers.js
index 1c9c5080a..d3c848ad7 100644
--- a/static/js/providers.js
+++ b/static/js/providers.js
@@ -146,4 +146,31 @@ export function providerLabel(endpointUrl) {
return host.replace(/^api\./i, "");
}
-export default { providerLogo, providerLabel };
+// Map endpoint URL → logo SVG using the same model-id regex catalog.
+// Tests host + port + path so loopback servers (e.g. Ollama on
+// localhost:11434) still match by port. Falls back to null when nothing
+// recognises the URL, so callers can render a neutral placeholder.
+export function providerLogoFromUrl(url) {
+ if (!url) return null;
+ let host = '', port = '', path = '';
+ try {
+ const u = new URL(url);
+ host = u.hostname; port = u.port; path = u.pathname || '';
+ } catch (_) {
+ const raw = String(url).replace(/^[a-z]+:\/\//i, '');
+ const slashIdx = raw.indexOf('/');
+ const hostport = slashIdx >= 0 ? raw.slice(0, slashIdx) : raw;
+ path = slashIdx >= 0 ? raw.slice(slashIdx) : '';
+ const colon = hostport.lastIndexOf(':');
+ host = colon >= 0 ? hostport.slice(0, colon) : hostport;
+ port = colon >= 0 ? hostport.slice(colon + 1) : '';
+ }
+ // Build candidate strings to test against the provider catalog.
+ const candidates = [host, port ? `${host}:${port}` : '', port ? `:${port}` : '', path].filter(Boolean);
+ for (const [re, svg] of _PROVIDERS) {
+ if (candidates.some(c => re.test(c))) return svg;
+ }
+ return null;
+}
+
+export default { providerLogo, providerLabel, providerLogoFromUrl };
diff --git a/static/js/settings.js b/static/js/settings.js
index 6d0906c9e..5c44b299c 100644
--- a/static/js/settings.js
+++ b/static/js/settings.js
@@ -6,6 +6,7 @@ import searchModule from './search.js';
import { makeWindowDraggable } from './windowDrag.js';
import { clearDockSide } from './modalSnap.js';
import { sortModelIds } from './modelSort.js';
+import { providerLogo } from './providers.js';
import { isAltGrEvent } from './platform.js';
let initialized = false;
@@ -81,6 +82,29 @@ function resetWindowPlacement() {
].forEach(prop => content.style.removeProperty(prop));
}
+/* ── Delegated link: close Settings + open the Prompt (characters) modal ── */
+function initOpenPromptModalLink() {
+ document.addEventListener('click', async (e) => {
+ const link = e.target.closest('[data-open-prompt-modal]');
+ if (!link) return;
+ e.preventDefault();
+ // Close settings first so the prompt modal isn't stacked on top.
+ if (modalEl && !modalEl.classList.contains('hidden')) close();
+ try {
+ const m = await import('./presets.js');
+ const fn = m.openCustomPresetModal || (m.default && m.default.openCustomPresetModal);
+ if (typeof fn === 'function') fn();
+ } catch (_) {
+ const modal = document.getElementById('custom-preset-modal');
+ if (modal) modal.classList.remove('hidden');
+ }
+ // Force the Persona tab (data-chartab="character") since the link's
+ // whole purpose is editing personas — not landing on Inject by default.
+ const personaTab = document.querySelector('#custom-preset-modal .preset-tab[data-chartab="character"]');
+ if (personaTab) personaTab.click();
+ });
+}
+
/* ── Close on backdrop / X ── */
function initClose() {
modalEl.querySelector('.close-btn').addEventListener('click', close);
@@ -90,6 +114,16 @@ function initClose() {
});
document.addEventListener('keydown', e => {
if (e.key !== 'Escape' || !modalEl || modalEl.classList.contains('hidden')) return;
+ // Bail when a transient popover inside the modal is open — Esc should
+ // dismiss just that, not the whole modal. Same-document listeners fire
+ // in registration order regardless of capture/bubble, so the popover's
+ // own handler can't pre-empt ours; we have to opt out here.
+ const popoverOpen = modalEl.querySelector(
+ '#adm-epLocalMoreMenu, #adm-epApiMoreMenu, #adm-provider-menu, #search-provider-menu, [data-popover-open="1"]'
+ );
+ if (popoverOpen && popoverOpen.style.display !== 'none' && !popoverOpen.classList.contains('hidden')) {
+ return;
+ }
// If an integration edit/add form is open inside the modal, close
// just that — don't dismiss the whole settings modal. (Pressing
// ESC mid-edit and losing the modal was a fast-typing footgun.)
@@ -207,6 +241,21 @@ function _fillEndpointSelect(selectEl, endpoints, selected, keepBlank) {
}
}
+// Mirror the selected model's provider logo into a sibling <span id="<selectId>-logo">.
+// Wires the change listener exactly once so we can call this every time the
+// select is repopulated without piling on duplicate handlers.
+function _syncModelLogo(selectEl) {
+ if (!selectEl) return;
+ const logoEl = document.getElementById(selectEl.id + '-logo');
+ if (!logoEl) return;
+ const apply = () => { logoEl.innerHTML = providerLogo(selectEl.value) || ''; };
+ apply();
+ if (!selectEl.dataset.logoSync) {
+ selectEl.dataset.logoSync = '1';
+ selectEl.addEventListener('change', apply);
+ }
+}
+
function _fillModelSelect(selectEl, models, selected, keepBlank) {
if (!selectEl) return;
const previous = selected !== undefined ? selected : selectEl.value;
@@ -231,6 +280,7 @@ function _fillModelSelect(selectEl, models, selected, keepBlank) {
} else if (blankText !== null) {
selectEl.value = '';
}
+ _syncModelLogo(selectEl);
}
function _registerAiEndpointRefresh(fn) {
@@ -338,7 +388,7 @@ function _bindFallbackWidget(opts) {
rm.type = 'button';
rm.className = 'settings-fallback-remove';
rm.title = 'Remove fallback';
- rm.innerHTML = '&times;';
+ rm.innerHTML = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>';
rm.addEventListener('click', function() {
current.splice(idx, 1);
render();
@@ -442,7 +492,7 @@ async function initDefaultChat() {
rm.type = 'button';
rm.className = 'settings-fallback-remove';
rm.title = 'Remove fallback';
- rm.innerHTML = '&times;';
+ rm.innerHTML = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>';
rm.addEventListener('click', function() {
_fallbacks.splice(idx, 1);
renderFallbacks();
@@ -706,7 +756,7 @@ async function initImageSettings() {
const settings = await settingsRes.json();
if (settings.image_model) modelSel.value = settings.image_model;
if (settings.image_quality) qualSel.value = settings.image_quality;
- if (enabledToggle) enabledToggle.checked = settings.image_gen_enabled !== false;
+ if (enabledToggle) enabledToggle.checked = settings.image_gen_enabled === true;
} catch (e) { console.warn('Failed to load settings', e); }
function syncImgDisabled() {
@@ -720,7 +770,7 @@ async function initImageSettings() {
async function saveSettings() {
try {
await fetch('/api/auth/settings', { method: 'POST', credentials: 'same-origin', headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ image_gen_enabled: enabledToggle ? enabledToggle.checked : true, image_model: modelSel.value, image_quality: qualSel.value }) });
+ body: JSON.stringify({ image_gen_enabled: enabledToggle ? enabledToggle.checked : false, image_model: modelSel.value, image_quality: qualSel.value }) });
msg.textContent = 'Saved'; msg.style.color = 'var(--fg)'; setTimeout(() => { msg.textContent = ''; }, 2000);
} catch (e) { msg.textContent = 'Failed to save'; msg.style.color = 'var(--red)'; }
}
@@ -767,6 +817,7 @@ async function initVisionSettings() {
const settingsRes = await fetch('/api/auth/settings', { credentials: 'same-origin' });
const settings = await settingsRes.json();
if (settings.vision_model) vlSel.value = settings.vision_model;
+ _syncModelLogo(vlSel);
if (enabledToggle) enabledToggle.checked = settings.vision_enabled !== false;
visionFallbackWidget = _bindFallbackWidget({
containerId: 'set-visionFallbacks',
@@ -1057,13 +1108,16 @@ async function initSttSettings() {
SEARCH TAB
═══════════════════════════════════════════ */
+var _LINK = function(href, text) {
+ return '<a href="' + href + '" target="_blank" rel="noopener noreferrer" style="color:var(--accent, var(--red));text-decoration:underline;">' + text + '</a>';
+};
var _searchProviderHints = {
- searxng: 'Self-hosted SearXNG instance. Leave URL empty to use the SEARXNG_INSTANCE env var.',
- duckduckgo: 'Free search — no API key required. Works out of the box.',
- brave: 'Get your API key from brave.com/search/api',
- google_pse: 'Requires a Google API key and a Programmable Search Engine ID (CX). Create one at programmablesearchengine.google.com',
- tavily: 'AI-optimized search. 1,000 free credits/month at tavily.com',
- serper: 'Google results via API. 2,500 free queries at serper.dev',
+ searxng: 'Private, self-hosted instance. Leave URL empty to use the SEARXNG_INSTANCE env var.',
+ duckduckgo: 'No API key needed, but rate-limited — heavy use can return empty results. Configure a fallback below.',
+ brave: 'Get your API key from ' + _LINK('https://brave.com/search/api/', 'brave.com/search/api'),
+ google_pse: 'Requires a Google API key and a Programmable Search Engine ID (CX). Create one at ' + _LINK('https://programmablesearchengine.google.com/', 'programmablesearchengine.google.com'),
+ tavily: 'AI-optimized search. 1,000 free credits/month at ' + _LINK('https://tavily.com/', 'tavily.com'),
+ serper: 'Google results via API. 2,500 free queries at ' + _LINK('https://serper.dev/', 'serper.dev'),
disabled: 'Web search and deep research tools will be unavailable.',
};
var _searchNeedsKey = { brave: 1, google_pse: 1, tavily: 1, serper: 1 };
@@ -1102,7 +1156,7 @@ async function initSearchSettings() {
urlRow.style.display = prov === 'searxng' ? 'flex' : 'none';
keyRow.style.display = _searchNeedsKey[prov] ? 'flex' : 'none';
cxRow.style.display = prov === 'google_pse' ? 'flex' : 'none';
- hint.textContent = _searchProviderHints[prov] || '';
+ hint.innerHTML = _searchProviderHints[prov] || '';
if (prov === 'brave') keyInput.placeholder = 'Brave API key';
else if (prov === 'google_pse') keyInput.placeholder = 'Google API key';
else if (prov === 'tavily') keyInput.placeholder = 'Tavily API key';
@@ -1266,63 +1320,81 @@ async function initSearchSettings() {
.map(function(o) { return { value: o.value, label: o.textContent, logo: o.dataset.searchLogo }; })
.filter(function(o) { return !inChain.has(o.value); });
}
+ var addBtn = el('set-searchAddFallback');
+ var TRASH_SVG = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>';
function _renderFallbackChain() {
if (!fbWrap) return;
var chain = (_settings.search_fallback_chain || []).slice();
- var esc = function(s) { return String(s || '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;'); };
- var chipsHtml = chain.map(function(p, i) {
- var label = _searchLabels[p] || p;
- var logo = _SEARCH_PROVIDER_LOGOS[p] || '';
- return '<span class="search-fb-chip" draggable="true" data-idx="' + i + '" data-value="' + esc(p) + '">' +
- '<span class="search-fb-grip" title="Drag to reorder">⋮⋮</span>' +
- '<span class="search-fb-logo">' + logo + '</span>' +
- '<span>' + esc(label) + '</span>' +
- '<button type="button" class="search-fb-remove" data-value="' + esc(p) + '" title="Remove">&times;</button>' +
- '</span>';
- }).join('');
- var addOptions = _availableFallbackOptions();
- var addSelect = addOptions.length
- ? '<select class="search-fb-add" id="search-fb-add"><option value="">+ Add</option>' +
- addOptions.map(function(o) { return '<option value="' + esc(o.value) + '">' + esc(o.label) + '</option>'; }).join('') +
- '</select>'
- : '';
- fbWrap.innerHTML = chipsHtml + addSelect;
- // Wire chip remove + drag-reorder + add
- fbWrap.querySelectorAll('.search-fb-remove').forEach(function(btn) {
- btn.addEventListener('click', function() {
- var next = (_settings.search_fallback_chain || []).filter(function(p) { return p !== btn.dataset.value; });
- _saveFallbackChain(next);
+ fbWrap.innerHTML = '';
+ chain.forEach(function(p, idx) {
+ var row = document.createElement('div');
+ row.className = 'settings-fallback-row';
+
+ var num = document.createElement('span');
+ num.className = 'settings-fallback-num';
+ num.textContent = (idx + 1) + '.';
+ row.appendChild(num);
+
+ // Inline logo so the row identifies its provider at a glance even
+ // before opening the dropdown. The <select> below still drives
+ // selection; we just mirror its value into the logo span.
+ var logoWrap = document.createElement('span');
+ logoWrap.style.cssText = 'display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0;color:var(--fg);';
+ var setLogo = function(val) {
+ var srcOpt = Array.from(provSel.options).find(function(o) { return o.value === val; });
+ logoWrap.innerHTML = srcOpt ? _searchProviderLogoSvg(srcOpt.dataset.searchLogo) : '';
+ };
+ setLogo(p);
+ row.appendChild(logoWrap);
+
+ var sel = document.createElement('select');
+ sel.className = 'settings-select';
+ // Options: this row's current value + every other provider not yet in the chain (and not the primary or 'disabled').
+ var primary = provSel.value;
+ var others = new Set(chain.filter(function(x) { return x !== p; }).concat([primary, 'disabled']));
+ Array.from(provSel.options).forEach(function(o) {
+ if (o.value !== p && others.has(o.value)) return;
+ var opt = document.createElement('option');
+ opt.value = o.value;
+ opt.textContent = o.textContent;
+ sel.appendChild(opt);
});
- });
- var addSel = el('search-fb-add');
- if (addSel) {
- addSel.addEventListener('change', function() {
- if (!addSel.value) return;
+ sel.value = p;
+ sel.addEventListener('change', function() {
+ setLogo(sel.value);
var next = (_settings.search_fallback_chain || []).slice();
- if (!next.includes(addSel.value)) next.push(addSel.value);
+ next[idx] = sel.value;
_saveFallbackChain(next);
});
- }
- // Drag-reorder
- var dragging = null;
- fbWrap.querySelectorAll('.search-fb-chip').forEach(function(chip) {
- chip.addEventListener('dragstart', function() {
- dragging = chip; chip.classList.add('dragging');
- });
- chip.addEventListener('dragend', function() {
- if (dragging) dragging.classList.remove('dragging');
- dragging = null;
- // Persist new order
- var order = Array.from(fbWrap.querySelectorAll('.search-fb-chip')).map(function(c) { return c.dataset.value; });
- _saveFallbackChain(order);
- });
- chip.addEventListener('dragover', function(e) {
- e.preventDefault();
- if (!dragging || dragging === chip) return;
- var rect = chip.getBoundingClientRect();
- var after = (e.clientX - rect.left) > rect.width / 2;
- chip.parentNode.insertBefore(dragging, after ? chip.nextSibling : chip);
+ row.appendChild(sel);
+
+ var rm = document.createElement('button');
+ rm.type = 'button';
+ rm.className = 'settings-fallback-remove';
+ rm.title = 'Remove fallback';
+ rm.innerHTML = TRASH_SVG;
+ rm.addEventListener('click', function() {
+ var next = (_settings.search_fallback_chain || []).filter(function(x, i) { return i !== idx; });
+ _saveFallbackChain(next);
});
+ row.appendChild(rm);
+
+ fbWrap.appendChild(row);
+ });
+ // Add-fallback button: disabled when there are no remaining providers to add.
+ if (addBtn) {
+ var hasMore = _availableFallbackOptions().length > 0;
+ addBtn.style.display = hasMore ? '' : 'none';
+ }
+ }
+ if (addBtn && !addBtn._wired) {
+ addBtn._wired = true;
+ addBtn.addEventListener('click', function() {
+ var avail = _availableFallbackOptions();
+ if (!avail.length) return;
+ var next = (_settings.search_fallback_chain || []).slice();
+ next.push(avail[0].value);
+ _saveFallbackChain(next);
});
}
async function _saveFallbackChain(chain) {
@@ -1355,8 +1427,18 @@ async function initSearchSettings() {
// Persist current form values first so the test uses what's on screen.
await saveSearch();
testBtn.disabled = true;
- var orig = testBtn.textContent;
- testBtn.textContent = 'Testing...';
+ var origHtml = testBtn.innerHTML;
+ var wp = null;
+ try {
+ var sp = window.spinnerModule || (await import('./spinner.js')).default;
+ wp = sp.createWhirlpool(11);
+ wp.element.style.cssText = 'display:inline-flex;width:11px;height:11px;margin:0 4px 0 0;';
+ testBtn.innerHTML = '';
+ testBtn.appendChild(wp.element);
+ testBtn.appendChild(document.createTextNode('Testing'));
+ } catch (_) {
+ testBtn.innerHTML = origHtml.replace(/>Test\s*$/, '>Testing...');
+ }
msg.textContent = '';
var t0 = performance.now();
try {
@@ -1382,7 +1464,8 @@ async function initSearchSettings() {
msg.textContent = '✗ Test failed: ' + (e && e.message ? e.message : e);
msg.style.color = 'var(--red)';
} finally {
- testBtn.disabled = false; testBtn.textContent = orig;
+ if (wp) { try { wp.destroy(); } catch (_) {} }
+ testBtn.disabled = false; testBtn.innerHTML = origHtml;
}
});
}
@@ -1515,6 +1598,14 @@ async function initResearchSettings() {
async function initResearchSearchSettings() {
var searchSel = el('set-researchSearch');
var msg = el('set-researchSearchMsg');
+ var logoEl = el('set-researchSearch-logo');
+
+ function updateSearchLogo() {
+ if (!logoEl) return;
+ var opt = searchSel.selectedOptions[0];
+ var key = opt && opt.dataset ? opt.dataset.searchLogo : '';
+ logoEl.innerHTML = key ? (_SEARCH_PROVIDER_LOGOS[key] || '') : '';
+ }
function updateSearchOptions(settings) {
var options = searchSel.querySelectorAll('option');
@@ -1539,6 +1630,7 @@ async function initResearchSearchSettings() {
var settings = await res.json();
if (settings.research_search_provider) searchSel.value = settings.research_search_provider;
updateSearchOptions(settings);
+ updateSearchLogo();
} catch (e) { console.warn('Failed to load research search settings', e); }
async function saveResearchSearch() {
@@ -1552,7 +1644,7 @@ async function initResearchSearchSettings() {
} catch (e) { msg.textContent = 'Failed to save'; msg.style.color = 'var(--red)'; }
}
- searchSel.addEventListener('change', saveResearchSearch);
+ searchSel.addEventListener('change', function() { updateSearchLogo(); saveResearchSearch(); });
}
/* ── Agent Settings (AI tab) ── */
@@ -1667,15 +1759,25 @@ function initAppearance() {
});
});
- var resetBtn = el('set-uiVisResetBtn');
- if (resetBtn) {
- resetBtn.addEventListener('click', function() {
- localStorage.removeItem('odysseus-ui-visibility');
+ // Per-section reset buttons (arrow-circle-back icon in each card's h2).
+ // Removes only the keys belonging to this section from the persisted
+ // visibility map so other sections keep their user settings.
+ modalEl.querySelectorAll('[data-vis-reset]').forEach(function(btn) {
+ btn.addEventListener('click', function() {
+ var card = btn.closest('.admin-card');
+ if (!card) return;
+ var keys = Array.from(card.querySelectorAll('[data-ui-key]'))
+ .map(function(c) { return c.dataset.uiKey; })
+ .filter(Boolean);
+ if (!keys.length) return;
+ var s = window.loadUIVis ? window.loadUIVis() : {};
+ keys.forEach(function(k) { delete s[k]; });
+ if (window.saveUIVis) window.saveUIVis(s);
syncAppearanceCheckboxes();
syncPrivacyCheckboxes();
- window.applyUIVis({});
+ if (window.applyUIVis) window.applyUIVis(s);
});
- }
+ });
}
function syncAppearanceCheckboxes() {
@@ -1862,7 +1964,9 @@ async function initShortcuts() {
<span class="shortcut-hint" hidden></span>
<button class="shortcut-key${combo ? '' : ' shortcut-key-unset'}" data-action="${action}" title="Click to rebind">${keyContent}</button>
<button class="shortcut-action-btn ${isCustom ? 'is-reset' : ''}" data-action="${action}" title="${isCustom ? 'Reset to default' : 'Confirm'}" style="${isCustom ? '' : 'visibility:hidden'}">
- ${isCustom ? '\u21A9' : '\u2713'}
+ ${isCustom
+ ? '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/></svg>'
+ : '\u2713'}
</button>
</div>
`;
@@ -1934,7 +2038,7 @@ async function initShortcuts() {
btn.innerHTML = _formatKeyCaps(keybinds[action]);
const isCustom = keybinds[action] !== SHORTCUT_DEFAULTS[action];
if (isCustom) {
- actionBtn.textContent = '\u21A9';
+ actionBtn.innerHTML = '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/></svg>';
actionBtn.classList.add('is-reset');
actionBtn.title = 'Reset to default';
} else {
@@ -2182,6 +2286,7 @@ function initAll() {
initTabs();
initDrag();
initClose();
+ initOpenPromptModalLink();
initOpacityToggle();
initialized = true;
initDefaultChat();
@@ -2436,7 +2541,7 @@ async function initReminderSettings() {
// users don't think they have to choose between channels.
const CHANNEL_HINTS = {
browser: 'Reminders appear as browser notifications inside Odysseus.',
- email: 'Reminders are emailed AND shown as a browser notification.',
+ email: 'Reminders are emailed and shown as a browser notification.',
ntfy: 'Reminders are pushed via ntfy AND shown as a browser notification.',
webhook: 'Reminders are POSTed to the selected integration AND shown as a browser notification. Use {{title}} and {{message}} in the payload template.',
};
@@ -2466,6 +2571,38 @@ async function initReminderSettings() {
if (savedChannel === 'webhook' && !webhookConfigured) savedChannel = 'browser';
channelSel.value = savedChannel;
llmToggle.checked = !!s.reminder_llm_synthesis;
+ // Persona dropdown — populate from built-in PROMPT_TEMPLATES (characters)
+ // plus any custom character preset. Selected value persists to
+ // reminder_llm_persona (backend hook lives in src/notes.py once
+ // /api/notes/fire-reminder lands).
+ const personaSel = el('set-reminder-llm-persona');
+ if (personaSel) {
+ try {
+ const presetsMod = await import('./presets.js');
+ const tpl = presetsMod.PROMPT_TEMPLATES || [];
+ const chars = tpl.filter(t => t.isCharacter);
+ for (const c of chars) {
+ const opt = document.createElement('option');
+ opt.value = c.id;
+ opt.textContent = c.name;
+ personaSel.appendChild(opt);
+ }
+ // Custom character (single-slot preset)
+ try {
+ const all = (presetsMod.getAllPresets && presetsMod.getAllPresets()) || {};
+ if (all.custom && all.custom.character_name) {
+ const opt = document.createElement('option');
+ opt.value = 'custom';
+ opt.textContent = all.custom.character_name + ' (custom)';
+ personaSel.appendChild(opt);
+ }
+ } catch (_) {}
+ } catch (_) {}
+ personaSel.value = s.reminder_llm_persona || '';
+ personaSel.addEventListener('change', () => {
+ save({ reminder_llm_persona: personaSel.value });
+ });
+ }
if (emailToIn) emailToIn.value = s.reminder_email_to || '';
if (ntfyTopicIn) ntfyTopicIn.value = s.reminder_ntfy_topic || 'Reminders';
populateWebhookIntegrations(s.reminder_webhook_integration_id || '');
@@ -2567,8 +2704,8 @@ async function initReminderSettings() {
if (testBtn) {
testBtn.addEventListener('click', async () => {
testBtn.disabled = true;
- if (testMsg) { testMsg.textContent = 'Sending…'; testMsg.style.color = 'var(--fg)'; }
- // Whirlpool loader right next to the "Sending…" text while it sends.
+ if (testMsg) { testMsg.textContent = 'Sending'; testMsg.style.color = 'var(--fg)'; }
+ // Whirlpool loader right next to the "Sending" text while it sends.
let _testSpin = null;
try {
const _sp = (await import('./spinner.js')).default;
@@ -2578,6 +2715,9 @@ async function initReminderSettings() {
} catch (_) {}
const _stopTestSpin = () => { try { _testSpin && _testSpin.stop(); _testSpin && _testSpin.element.remove(); } catch (_) {} };
try {
+ // Persona picker is in a different scope (Reminders init), look it up
+ // by id so we can pass whatever is currently selected on screen.
+ const personaSel = el('set-reminder-llm-persona');
const res = await fetch('/api/notes/fire-reminder', {
method: 'POST',
credentials: 'same-origin',
@@ -2587,6 +2727,11 @@ async function initReminderSettings() {
title: 'Test Reminder',
body: 'This is a test reminder to verify your settings are working.',
channel: channelSel.value,
+ // Mirror the in-UI AI Synthesis toggle + persona so the test never
+ // races a pending save and lets the user preview changes before
+ // hitting Save.
+ llm_synthesis: !!(llmToggle && llmToggle.checked),
+ llm_persona: (personaSel && personaSel.value) || '',
...(channelSel.value === 'webhook' ? {
webhook_integration_id: webhookIntgSel?.value || '',
webhook_payload_template: webhookTemplateIn?.value.trim() || '',
@@ -2646,7 +2791,7 @@ async function initEmailAccountsSettings() {
try {
const mod = await import('./tasks.js');
const openTasks = mod.openTasks || (mod.default && mod.default.openTasks);
- if (typeof openTasks === 'function') openTasks();
+ if (typeof openTasks === 'function') openTasks(null, { filter: 'Email' });
else document.getElementById('tool-tasks-btn')?.click();
} catch (_) {
document.getElementById('tool-tasks-btn')?.click();
@@ -3261,7 +3406,7 @@ const AGENT_CONFIGS = {
namePrefix: 'codex agent',
defaultName: 'Codex Agent',
pluginPath: '/api/codex/plugin.zip',
- setupDescription: 'Downloads the plugin bundle and registers it with Codex. Sets <code>ODYSSEUS_URL</code> + <code>ODYSSEUS_API_TOKEN</code>, fetches the plugin from <a href="/api/codex/plugin.zip" style="color:var(--accent,var(--red));">this Odysseus instance</a>, and runs <code>codex plugin add odysseus@personal</code>.',
+ setupDescription: 'Downloads a plugin bundle and registers it.',
buildSetup: (origin, token) => `export ODYSSEUS_URL=${origin}
export ODYSSEUS_API_TOKEN='${token}'
mkdir -p ~/plugins
@@ -3299,7 +3444,7 @@ python3 ~/plugins/odysseus/scripts/odysseus_api.py capabilities`,
namePrefix: 'claude agent',
defaultName: 'Claude Agent',
pluginPath: '/api/claude/plugin.zip',
- setupDescription: 'Downloads the skill bundle into <code>~/.claude/skills/odysseus/</code>. Sets <code>ODYSSEUS_URL</code> + <code>ODYSSEUS_API_TOKEN</code>, fetches the skill from <a href="/api/claude/plugin.zip" style="color:var(--accent,var(--red));">this Odysseus instance</a>. Claude Code auto-loads the skill on next start.',
+ setupDescription: 'Downloads a plugin bundle and registers it.',
buildSetup: (origin, token) => `export ODYSSEUS_URL=${origin}
export ODYSSEUS_API_TOKEN='${token}'
mkdir -p ~/.claude
@@ -3321,6 +3466,21 @@ async function initUnifiedIntegrations() {
if (!listEl) return;
let integrationNotice = '';
+ // Hide the "+ Add Integration" button whenever the per-type create form
+ // is open so it doesn't compete visually with the in-progress form.
+ // Many call sites toggle formEl.style.display directly; observe instead
+ // of patching every one of them.
+ if (formEl && addBtn && addBtn.parentElement && !formEl._addBtnObserved) {
+ formEl._addBtnObserved = true;
+ const addBtnWrap = addBtn.parentElement;
+ const _syncAddBtnWrap = () => {
+ const formOpen = formEl.style.display && formEl.style.display !== 'none';
+ addBtnWrap.style.display = formOpen ? 'none' : '';
+ };
+ new MutationObserver(_syncAddBtnWrap).observe(formEl, { attributes: true, attributeFilter: ['style'] });
+ _syncAddBtnWrap();
+ }
+
function _openEmailSettings() {
open('email');
}
@@ -3407,7 +3567,7 @@ async function initUnifiedIntegrations() {
? '<span style="width:8px;height:8px;border-radius:50%;background:var(--color-success,#50fa7b);flex-shrink:0;--notif-glow:var(--color-success,#50fa7b);animation:cookbook-notif-pulse 2s ease-in-out infinite;" title="Active"></span>'
: '<span style="width:8px;height:8px;border-radius:50%;background:var(--fg);opacity:0.3;flex-shrink:0" title="Disabled"></span>';
return `<div class="intg-card" data-intg-id="${item.id}" data-intg-type="${item.type}" style="display:flex;align-items:center;gap:10px;padding:8px 10px;border:1px solid var(--border);border-radius:8px;background:color-mix(in srgb, var(--fg) 3%, transparent);margin-bottom:6px;cursor:pointer;transition:all 0.15s;" title="Click to edit">
- <span style="opacity:0.6;flex-shrink:0">${t.icon}</span>
+ <span style="color:var(--accent, var(--red));flex-shrink:0">${t.icon}</span>
<div style="flex:1;min-width:0">
<div style="font-size:12px;font-weight:600;display:flex;align-items:center;gap:6px">${item.name} <span style="font-size:9px;text-transform:uppercase;letter-spacing:0.5px;padding:1px 5px;border:1px solid color-mix(in srgb, var(--accent, var(--red)) 50%, transparent);border-radius:3px;color:var(--accent, var(--red));background:color-mix(in srgb, var(--accent, var(--red)) 12%, transparent);">${t.label}</span></div>
<div style="font-size:11px;opacity:0.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">${item.detail || ''}</div>
@@ -3441,9 +3601,11 @@ async function initUnifiedIntegrations() {
if (e.target.closest('.intg-del-btn')) return;
const type = card.dataset.intgType;
const id = card.dataset.intgId;
- const items2 = listEl.querySelectorAll('.intg-card');
- items2.forEach(c => c.style.borderColor = '');
- card.style.borderColor = 'var(--accent)';
+ // Toggle a class instead of mutating inline borderColor — the
+ // inline border shorthand made the reset unreliable, leaving
+ // stale accent borders on previously-clicked cards.
+ listEl.querySelectorAll('.intg-card.intg-card-active').forEach(c => c.classList.remove('intg-card-active'));
+ card.classList.add('intg-card-active');
showForm(type, id);
});
});
@@ -3555,7 +3717,12 @@ async function initUnifiedIntegrations() {
<div class="settings-row"><label class="settings-label">Auth${_apiHint('How this service expects the credential to be sent. <b>Bearer</b> = sends "Authorization: Bearer YOUR_KEY" (most modern APIs, ntfy, OpenAI-style). <b>Header</b> = sends YOUR_KEY verbatim under a header name you choose (Miniflux uses X-Auth-Token). <b>Basic</b> = HTTP basic auth (user:pass). <b>None</b> = the API is open / no auth.')}</label><select id="uf-api-auth" class="settings-input"><option value="bearer">Bearer (most common)</option><option value="header">Header</option><option value="basic">Basic</option><option value="none">None</option></select></div>
<div class="settings-row" id="uf-api-header-row"><label class="settings-label">Header${_apiHint('The HTTP header name the key goes under (Miniflux: X-Auth-Token; most others: Authorization). Only used when Auth = Header.')}</label><input id="uf-api-header" class="settings-input" placeholder="X-Auth-Token"></div>
<div class="settings-row"><label class="settings-label">API Key${_apiHint('The secret token the service issued you (generated in its admin panel / settings). Used to prove your identity on each request. Required for any Auth mode except None.')}</label><input id="uf-api-key" class="settings-input" type="password" placeholder="Token/key"></div>
- <div class="settings-row" style="margin-top:4px"><button class="admin-btn-sm" id="uf-api-save">Save</button><button class="admin-btn-sm" id="uf-api-test" style="opacity:0.7">Test</button><button class="admin-btn-sm" id="uf-api-cancel" style="opacity:0.7">Cancel</button><span id="uf-api-msg" style="font-size:11px"></span></div>
+ <div class="settings-row" style="margin-top:10px;align-items:center;justify-content:flex-end;gap:6px;">
+ <span id="uf-api-msg" style="font-size:11px;flex:1;margin-right:8px"></span>
+ <button class="admin-btn-add" id="uf-api-test" style="display:inline-flex;align-items:center;gap:5px;background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">Test</button>
+ <button class="admin-btn-add" id="uf-api-save" style="display:inline-flex;align-items:center;gap:5px;background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));font-weight:600;">Save</button>
+ <button class="admin-btn-add" id="uf-api-cancel" style="display:inline-flex;align-items:center;gap:5px;background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">Cancel</button>
+ </div>
</div>
</div>`;
// Custom preset dropdown wire-up (hidden select stays as data source).
@@ -3691,7 +3858,12 @@ async function initUnifiedIntegrations() {
<div class="settings-row"><label class="settings-label">Server URL</label><input id="uf-caldav-url" class="settings-input" placeholder="https://www.google.com/calendar/dav/[email protected]/user/"></div>
<div class="settings-row"><label class="settings-label">Username</label><input id="uf-caldav-user" class="settings-input" placeholder="[email protected]"></div>
<div class="settings-row"><label class="settings-label">Password</label><input id="uf-caldav-pass" class="settings-input" type="password" placeholder="${isNew ? '' : 'Leave blank to keep existing'}"></div>
- <div class="settings-row" style="margin-top:4px"><button class="admin-btn-sm" id="uf-caldav-save">Save</button><button class="admin-btn-sm" id="uf-caldav-test" style="opacity:0.7">Test</button><button class="admin-btn-sm" id="uf-caldav-cancel" style="opacity:0.7">Cancel</button><span id="uf-caldav-msg" style="font-size:11px;margin-left:6px"></span></div>
+ <div class="settings-row" style="margin-top:10px;align-items:center;justify-content:flex-end;gap:6px;">
+ <span id="uf-caldav-msg" style="font-size:11px;flex:1;margin-right:8px"></span>
+ <button class="admin-btn-add" id="uf-caldav-test" style="display:inline-flex;align-items:center;gap:5px;background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">Test</button>
+ <button class="admin-btn-add" id="uf-caldav-save" style="display:inline-flex;align-items:center;gap:5px;background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));font-weight:600;">Save</button>
+ <button class="admin-btn-add" id="uf-caldav-cancel" style="display:inline-flex;align-items:center;gap:5px;background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">Cancel</button>
+ </div>
</div>
</div>`;
@@ -3795,13 +3967,13 @@ async function initUnifiedIntegrations() {
<div class="settings-row"><label class="settings-label">URL</label><input id="uf-carddav-url" class="settings-input" placeholder="http://localhost:5232/user/contacts/"></div>
<div class="settings-row"><label class="settings-label">Username</label><input id="uf-carddav-user" class="settings-input"></div>
<div class="settings-row"><label class="settings-label">Password</label><input id="uf-carddav-pass" class="settings-input" type="password"></div>
- <div class="settings-row" style="margin-top:8px;align-items:center;">
- <button class="admin-btn-add" id="uf-carddav-save" style="background:var(--red);border-color:var(--red);color:#fff;display:inline-flex;align-items:center;gap:5px;font-weight:600;">
+ <div class="settings-row" style="margin-top:10px;align-items:center;justify-content:flex-end;gap:6px;">
+ <span id="uf-carddav-msg" style="font-size:11px;flex:1;margin-right:8px"></span>
+ <button class="admin-btn-add" id="uf-carddav-save" style="display:inline-flex;align-items:center;gap:5px;background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));font-weight:600;">
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg>
Save
</button>
- <span id="uf-carddav-msg" style="font-size:11px;flex:1;margin-left:8px"></span>
- <button class="admin-btn-add" id="uf-carddav-cancel" style="opacity:0.7;display:inline-flex;align-items:center;gap:5px;position:relative;top:1px;margin-left:auto;">
+ <button class="admin-btn-add" id="uf-carddav-cancel" style="display:inline-flex;align-items:center;gap:5px;background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
Cancel
</button>
@@ -4109,21 +4281,21 @@ async function initUnifiedIntegrations() {
<div class="settings-row uf-smtp-creds"><label class="settings-label">Username${_hint('Usually the same as your IMAP username (your email address).')}</label><input id="uf-smtp-user" class="settings-input"></div>
<div class="settings-row uf-smtp-creds"><label class="settings-label">Password${_hint('Your SMTP password — often the same as your IMAP password. Outlook / Office 365 generally requires OAuth and will not work with this password form.')}</label><input id="uf-smtp-pass" class="settings-input" type="password" placeholder="${placeholderPass}"></div>
<div class="settings-row" style="margin-top:4px"><label class="settings-label">Default${_hint('Use this account whenever no specific account is chosen.')}</label><label class="admin-switch" style="margin-left:0"><input type="checkbox" id="uf-email-default"><span class="admin-slider"></span></label><span style="font-size:10px;opacity:0.5;margin-left:6px">Used when nothing else is selected</span></div>
- <div class="settings-row" style="margin-top:10px;align-items:center;">
- <button class="admin-btn-add" id="uf-email-save" style="background:var(--red);border-color:var(--red);color:#fff;display:inline-flex;align-items:center;gap:5px;font-weight:600;">
- <span class="uf-email-save-ico" style="display:inline-flex;width:11px;height:11px;align-items:center;justify-content:center;">
- <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg>
- </span>
- <span class="uf-email-save-label">${isEdit ? 'Save' : 'Create'}</span>
- </button>
- <button class="admin-btn-add" id="uf-email-test" style="display:inline-flex;align-items:center;gap:5px;opacity:0.85;">
+ <div class="settings-row" style="margin-top:10px;align-items:center;justify-content:flex-end;gap:6px;">
+ <span id="uf-email-msg" style="font-size:11px;flex:1;margin-right:8px"></span>
+ <button class="admin-btn-add" id="uf-email-test" style="display:inline-flex;align-items:center;gap:5px;background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">
<span class="uf-email-test-ico" style="display:inline-flex;width:11px;height:11px;align-items:center;justify-content:center;">
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="22 4 12 14.01 9 11.01"/><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"/></svg>
</span>
Test
</button>
- <span id="uf-email-msg" style="font-size:11px;flex:1;margin-left:8px"></span>
- <button class="admin-btn-add" id="uf-email-cancel" style="opacity:0.7;display:inline-flex;align-items:center;gap:5px;position:relative;top:1px;margin-left:auto;">
+ <button class="admin-btn-add" id="uf-email-save" style="display:inline-flex;align-items:center;gap:5px;background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));font-weight:600;">
+ <span class="uf-email-save-ico" style="display:inline-flex;width:11px;height:11px;align-items:center;justify-content:center;">
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg>
+ </span>
+ <span class="uf-email-save-label">${isEdit ? 'Save' : 'Create'}</span>
+ </button>
+ <button class="admin-btn-add" id="uf-email-cancel" style="display:inline-flex;align-items:center;gap:5px;background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
Cancel
</button>
@@ -4396,7 +4568,15 @@ async function initUnifiedIntegrations() {
btn.style.color = '';
btn.style.boxShadow = '';
btn.style.animation = '';
- ico.innerHTML = _spinner;
+ // Use the canonical whirlpool spinner so this matches Probe / Test
+ // elsewhere; fall back to the inline CSS ring if the module fails.
+ try {
+ const sp = window.spinnerModule || (await import('./spinner.js')).default;
+ const wp = sp.createWhirlpool(11);
+ wp.element.style.cssText = 'display:inline-flex;width:11px;height:11px;position:relative;top:-2px;';
+ ico.innerHTML = '';
+ ico.appendChild(wp.element);
+ } catch (_) { ico.innerHTML = _spinner; }
msg.textContent = '';
msg.style.color = '';
try {
@@ -4499,14 +4679,14 @@ async function initUnifiedIntegrations() {
<div class="settings-row"><label class="settings-label">Server URL</label><input id="uf-vault-url" class="settings-input" placeholder="https://vault.example.com"></div>
<div class="settings-row"><label class="settings-label">Email</label><input id="uf-vault-email" class="settings-input" placeholder="[email protected]"></div>
<div class="settings-row"><label class="settings-label">Master Password</label><input id="uf-vault-pass" class="settings-input" type="password" placeholder="Only required for Login / Unlock"></div>
- <div class="settings-row" style="margin-top:4px;flex-wrap:wrap;gap:4px">
- <button class="admin-btn-sm" id="uf-vault-save">Save Config</button>
- <button class="admin-btn-sm" id="uf-vault-login">Login</button>
- <button class="admin-btn-sm" id="uf-vault-unlock">Unlock</button>
- <button class="admin-btn-sm" id="uf-vault-lock" style="opacity:0.7">Lock</button>
- <button class="admin-btn-sm" id="uf-vault-logout" style="opacity:0.7">Logout</button>
- <button class="admin-btn-sm" id="uf-vault-cancel" style="opacity:0.7">Cancel</button>
- <span id="uf-vault-msg" style="font-size:11px;margin-left:4px"></span>
+ <div class="settings-row" style="margin-top:10px;align-items:center;justify-content:flex-end;gap:6px;flex-wrap:wrap;">
+ <span id="uf-vault-msg" style="font-size:11px;flex:1;margin-right:8px"></span>
+ <button class="admin-btn-add" id="uf-vault-save" style="background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));font-weight:600;">Save Config</button>
+ <button class="admin-btn-add" id="uf-vault-login" style="background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">Login</button>
+ <button class="admin-btn-add" id="uf-vault-unlock" style="background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">Unlock</button>
+ <button class="admin-btn-add" id="uf-vault-lock" style="background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">Lock</button>
+ <button class="admin-btn-add" id="uf-vault-logout" style="background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">Logout</button>
+ <button class="admin-btn-add" id="uf-vault-cancel" style="background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">Cancel</button>
</div>
<div style="font-size:10px;opacity:0.5;margin-top:6px;line-height:1.4">
<strong>Login</strong> registers this device with your Vaultwarden account (once per account).<br>
@@ -4699,12 +4879,12 @@ async function initUnifiedIntegrations() {
<span style="display:inline-block;width:8px;height:8px;border-radius:50%;background:${statusColor}"></span>
<span style="font-size:11px;opacity:0.7">${statusText}</span>
</div>
- <div style="display:flex;gap:6px;flex-wrap:wrap;margin-bottom:8px">
- ${srv.needs_oauth ? `<a href="/api/mcp/oauth/authorize/${srv.id}" target="_blank" class="admin-btn-sm" style="background:var(--red);color:#fff;text-decoration:none">Authorize</a>` : ''}
- <button class="admin-btn-sm" id="uf-mcp-reconnect">Reconnect</button>
- <button class="admin-btn-sm" id="uf-mcp-toggle">${srv.is_enabled ? 'Disable' : 'Enable'}</button>
- <button class="admin-btn-sm" id="uf-mcp-cancel" style="opacity:0.7">Close</button>
- <span id="uf-mcp-msg" style="font-size:11px"></span>
+ <div style="display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-bottom:8px;justify-content:flex-end;">
+ <span id="uf-mcp-msg" style="font-size:11px;flex:1;margin-right:8px"></span>
+ ${srv.needs_oauth ? `<a href="/api/mcp/oauth/authorize/${srv.id}" target="_blank" class="admin-btn-add" style="background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));text-decoration:none;font-weight:600;">Authorize</a>` : ''}
+ <button class="admin-btn-add" id="uf-mcp-reconnect" style="background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">Reconnect</button>
+ <button class="admin-btn-add" id="uf-mcp-toggle" style="background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">${srv.is_enabled ? 'Disable' : 'Enable'}</button>
+ <button class="admin-btn-add" id="uf-mcp-cancel" style="background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">Close</button>
</div>
<div id="uf-mcp-tools-panel"></div>
</div>`;
@@ -4766,7 +4946,11 @@ async function initUnifiedIntegrations() {
<div id="uf-mcp-sse-fields" style="display:none;flex-direction:column;gap:6px;">
<div class="settings-row"><label class="settings-label">URL</label><input id="uf-mcp-url" class="settings-input" placeholder="http://localhost:3001/sse"></div>
</div>
- <div class="settings-row" style="margin-top:4px"><button class="admin-btn-sm" id="uf-mcp-save">Save</button><button class="admin-btn-sm" id="uf-mcp-cancel" style="opacity:0.7">Cancel</button><span id="uf-mcp-msg" style="font-size:11px"></span></div>
+ <div class="settings-row" style="margin-top:10px;align-items:center;justify-content:flex-end;gap:6px;">
+ <span id="uf-mcp-msg" style="font-size:11px;flex:1;margin-right:8px"></span>
+ <button class="admin-btn-add" id="uf-mcp-save" style="background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));font-weight:600;">Save</button>
+ <button class="admin-btn-add" id="uf-mcp-cancel" style="background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">Cancel</button>
+ </div>
</div>
</div>`;
el('uf-mcp-transport').addEventListener('change', () => {
@@ -4875,79 +5059,233 @@ async function initUnifiedIntegrations() {
</label>`;
}).join('');
};
- const tokenRows = agentTokens.length ? agentTokens.map(t => `
- <div class="uf-codex-token" data-token-id="${esc(t.id)}" style="border:1px solid var(--border);border-radius:6px;padding:9px 10px;margin-top:8px;">
- <div style="display:flex;align-items:center;gap:8px;margin-bottom:8px;">
- <div style="flex:1;min-width:0;">
- <input type="text" class="uf-codex-rename settings-input" data-token-id="${esc(t.id)}" value="${esc(t.name || cfg.defaultName)}" placeholder="${esc(cfg.defaultName)} (e.g. ${esc(cfg.word)} on laptop)" style="font-size:12px;font-weight:600;padding:3px 6px;width:100%;background:transparent;border:1px solid transparent;border-radius:4px;" title="Click to rename this agent">
- <div style="font-size:10px;opacity:0.52;margin-top:2px;">${esc(t.token_prefix || 'token')}...${t.last_used_at ? ` · Last used ${new Date(t.last_used_at).toLocaleDateString()}` : ' · Never used'}</div>
- </div>
- <button class="admin-btn-sm uf-codex-copy-prefix" data-token-prefix="${esc(t.token_prefix || '')}" title="Copy token prefix (full token only shown once, at creation)" style="opacity:0.7">Copy</button>
- <button class="admin-btn-delete uf-codex-revoke" data-token-id="${esc(t.id)}">Revoke</button>
- </div>
- <div style="font-size:11px;font-weight:600;opacity:0.62;margin-bottom:4px;">Tool access</div>
- ${scopeToggles(t)}
- <div class="uf-codex-scope-msg" data-token-id="${esc(t.id)}" style="font-size:11px;min-height:14px;"></div>
- </div>`).join('') : `<div style="opacity:0.45;font-size:11px;padding:8px 0;">No ${esc(cfg.word)} tokens yet.</div>`;
const origin = window.location.origin || '';
const setupForToken = (token) => cfg.buildSetup(origin, token);
+ // Inline editor for the existing token the user clicked into (current).
+ // Shows the rename input, the prefix/last-used, and scope toggles that
+ // PATCH /api/tokens/{id} on change. The integration row's trash button
+ // handles revoke, so no Revoke button in here.
+ const editExistingHtml = current ? `
+ <div style="border:1px solid var(--border);border-radius:6px;padding:9px 10px;margin-bottom:8px;">
+ <div style="display:flex;align-items:center;gap:8px;margin-bottom:8px;">
+ <input type="text" id="uf-codex-existing-rename" data-token-id="${esc(current.id)}" value="${esc(current.name || cfg.defaultName)}" style="font-size:12px;font-weight:600;padding:3px 6px;flex:1;background:transparent;border:1px solid transparent;border-radius:4px;" title="Click to rename">
+ <span style="font-size:10px;opacity:0.55;">${esc(current.token_prefix || 'token')}...${current.last_used_at ? ` · Last used ${new Date(current.last_used_at).toLocaleDateString()}` : ' · Never used'}</span>
+ </div>
+ <div style="font-size:11px;font-weight:600;opacity:0.62;margin-bottom:4px;">Permissions</div>
+ ${scopeToggles(current)}
+ <div id="uf-codex-existing-msg" style="font-size:11px;min-height:14px;margin-top:4px;"></div>
+ </div>` : '';
+
formEl.innerHTML = `
<div class="admin-card" style="margin-top:8px">
- <h2 style="font-size:13px">${esc(cfg.label)}</h2>
- <div style="font-size:11px;opacity:0.65;line-height:1.45;margin:-2px 0 8px;">Generates a scoped token + setup commands so ${esc(cfg.word)} on your own machine can read/write your Odysseus data (todos, email, calendar, etc.). The agent runs in your terminal — it isn't streamed inside Odysseus.</div>
<div class="settings-col">
- <div id="uf-codex-pending" style="display:${current ? 'none' : 'block'};font-size:11px;opacity:0.6;padding:6px 0;">Creating agent...</div>
- <div id="uf-codex-reveal" style="display:none;padding:10px 12px;border:1px solid var(--border);border-left:3px solid var(--accent, var(--red));border-radius:6px;background:rgba(0,0,0,0.04);width:100%;box-sizing:border-box;">
- <div style="font-weight:600;font-size:12px;margin-bottom:6px;">${esc(cfg.word)} setup</div>
-
- <div style="font-size:11px;opacity:0.62;margin-bottom:4px;">Copy this token now &mdash; it will not be shown again.</div>
- <code id="uf-codex-token" style="display:block;word-break:break-all;font-size:11px;padding:6px 8px;background:rgba(0,0,0,0.08);border-radius:4px;"></code>
- <div style="margin-top:6px;">
- <button class="admin-btn-sm" id="uf-codex-copy-token">Copy token</button>
+ ${editExistingHtml}
+ <div id="uf-codex-prompt" style="display:${current ? 'none' : 'block'};padding:6px 0;">
+ <div style="font-size:11px;opacity:0.7;margin-bottom:6px;">Name this ${esc(cfg.word)} agent so you can tell it apart from other ones (e.g. "${esc(cfg.defaultName)} — laptop").</div>
+ <input type="text" id="uf-codex-name-input" class="settings-select" placeholder="${esc(cfg.defaultName)}" style="width:100%;font-size:12px;padding:6px 8px;">
+ </div>
+ <div id="uf-codex-pending" style="display:none;align-items:center;gap:8px;padding:6px 0;font-size:11px;opacity:0.7;"></div>
+ <div id="uf-codex-reveal" style="display:none;width:100%;box-sizing:border-box;">
+ <div style="font-weight:600;font-size:12px;margin-bottom:6px;">Token</div>
+
+ <div style="font-size:11px;opacity:0.62;margin-bottom:4px;">Copy this token, it won't be shown again.</div>
+ <div style="position:relative;">
+ <code id="uf-codex-token" style="display:block;word-break:break-all;font-size:11px;padding:6px 30px 6px 8px;background:rgba(0,0,0,0.08);border-radius:4px;"></code>
+ <button type="button" class="admin-btn-sm" id="uf-codex-copy-token" title="Copy token" aria-label="Copy token" style="position:absolute;right:4px;top:50%;transform:translateY(-50%);padding:3px 5px;background:none;border:none;color:inherit;opacity:0.7;cursor:pointer;display:inline-flex;align-items:center;">
+ <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
+ </button>
</div>
- <div style="margin-top:14px;font-weight:600;font-size:11px;margin-bottom:4px;">Quickstart &mdash; or copy setup directly in your terminal</div>
+ <div style="margin-top:14px;font-weight:600;font-size:11px;margin-bottom:4px;">Quickstart &mdash; simply paste directly in your terminal.</div>
<div style="font-size:11px;opacity:0.62;margin-bottom:6px;">${cfg.setupDescription}</div>
<pre style="margin:0;white-space:pre;overflow-x:auto;max-height:220px;overflow-y:auto;font-size:10px;line-height:1.45;padding:8px 10px;background:rgba(0,0,0,0.08);border-radius:4px;width:100%;box-sizing:border-box;"><code id="uf-codex-setup-code"></code></pre>
- <div style="margin-top:6px;">
- <button class="admin-btn-sm" id="uf-codex-copy-setup">Copy setup</button>
- </div>
- <div style="margin-top:14px;font-weight:600;font-size:11px;margin-bottom:4px;">Configure access</div>
- <div style="font-size:11px;opacity:0.62;margin-bottom:6px;">Toggle which Odysseus tools this agent can use. New agents start with chat only.</div>
- <div id="uf-codex-inline-scopes"></div>
+ <div style="margin-top:14px;display:flex;align-items:center;gap:8px;">
+ <span style="font-weight:600;font-size:11px;">Configure access</span>
+ <span style="flex:1"></span>
+ <button type="button" class="admin-btn-sm" id="uf-codex-copy-setup" title="Copy setup" aria-label="Copy setup" style="font-size:11px;font-weight:normal;display:inline-flex;align-items:center;gap:5px;opacity:0.85;">
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
+ <span>Copy</span>
+ </button>
+ <button type="button" class="admin-btn-sm" id="uf-codex-toggle-config" aria-expanded="false" style="font-size:11px;font-weight:normal;display:inline-flex;align-items:center;gap:5px;opacity:0.85;">
+ <svg id="uf-codex-toggle-config-caret" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="transition:transform 0.15s"><polyline points="6 9 12 15 18 9"/></svg>
+ <span>Configure</span>
+ </button>
+ </div>
+ <div id="uf-codex-config-body" style="display:none;">
+ <div style="font-size:11px;opacity:0.62;margin:4px 0 6px;">Toggle which Odysseus tools this agent can use. New agents start with chat only.</div>
+ <div id="uf-codex-inline-scopes"></div>
+ </div>
</div>
- <div style="font-size:11px;font-weight:600;opacity:0.62;margin-top:10px;">${agentTokens.length ? 'Existing agents' : 'Agents'}</div>
- <div id="uf-codex-token-list">${tokenRows}</div>
- <div class="settings-row" style="margin-top:10px;align-items:center;">
- <button class="admin-btn-add" id="uf-codex-save" style="background:var(--red);border-color:var(--red);color:#fff;display:inline-flex;align-items:center;gap:5px;font-weight:600;">
- <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg>
- Save
- </button>
- <span id="uf-codex-msg" style="font-size:11px;flex:1;margin-left:8px"></span>
- <button class="admin-btn-add" id="uf-codex-cancel" style="opacity:0.7;display:inline-flex;align-items:center;gap:5px;position:relative;top:1px;margin-left:auto;">
+ <div class="settings-row" style="margin-top:10px;align-items:center;gap:6px;">
+ <button class="admin-btn-add" id="uf-codex-cancel" style="display:inline-flex;align-items:center;gap:5px;background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
Cancel
</button>
+ <span id="uf-codex-msg" style="font-size:11px;flex:1;text-align:center;"></span>
+ <button class="admin-btn-add" id="uf-codex-revoke" style="display:none;align-items:center;gap:5px;background:color-mix(in srgb, var(--color-error) 10%, transparent);color:var(--color-error);border:1px solid var(--color-error);font-weight:600;">
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/><path d="M10 11v6"/><path d="M14 11v6"/><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>
+ Revoke
+ </button>
+ <button class="admin-btn-add" id="uf-codex-create-btn" style="display:${current ? 'none' : 'inline-flex'};align-items:center;gap:5px;background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));">
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 2l-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/><path d="M15.5 7.5l3 3"/></svg>
+ Create token
+ </button>
+ <button class="admin-btn-add" id="uf-codex-save" style="display:none;align-items:center;gap:5px;background:transparent;color:var(--accent, var(--red));border-color:color-mix(in srgb, var(--accent, var(--red)) 45%, var(--border));font-weight:600;">
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg>
+ Save
+ </button>
</div>
</div>
</div>`;
+ // Editing an existing token: surface Revoke alongside Cancel, and stash
+ // the id so the Revoke handler knows what to DELETE.
+ if (current) {
+ formEl.dataset.createdTokenId = String(current.id);
+ const revokeBtn = el('uf-codex-revoke');
+ if (revokeBtn) revokeBtn.style.display = 'inline-flex';
+ // Inline rename + per-scope PATCH on change.
+ const renameInput = el('uf-codex-existing-rename');
+ if (renameInput) {
+ const original = renameInput.value;
+ const commit = async () => {
+ const name = (renameInput.value || '').trim();
+ if (!name || name === original) return;
+ try {
+ const r = await fetch(`/api/tokens/${renameInput.dataset.tokenId}`, {
+ method: 'PATCH', credentials: 'same-origin',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ name }),
+ });
+ if (!r.ok) throw new Error('Save failed');
+ notifyIntegrationsChanged();
+ } catch (_) { renameInput.value = original; }
+ };
+ renameInput.addEventListener('blur', commit);
+ renameInput.addEventListener('keydown', e => { if (e.key === 'Enter') { e.preventDefault(); renameInput.blur(); } });
+ }
+ formEl.querySelectorAll('.uf-codex-scope').forEach(cb => {
+ cb.addEventListener('change', async () => {
+ const msg = el('uf-codex-existing-msg');
+ const scopes = ['chat'].concat(
+ Array.from(formEl.querySelectorAll('.uf-codex-scope:checked')).map(input => input.dataset.scope)
+ );
+ try {
+ const r = await fetch(`/api/tokens/${cb.dataset.tokenId}`, {
+ method: 'PATCH', credentials: 'same-origin',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ scopes }),
+ });
+ const d = await r.json().catch(() => ({}));
+ if (!r.ok) throw new Error(d.detail || 'Failed');
+ if (msg) { msg.textContent = 'Saved'; msg.style.color = 'var(--green, #50fa7b)'; setTimeout(() => { msg.textContent = ''; }, 1200); }
+ notifyIntegrationsChanged();
+ } catch (err) {
+ cb.checked = !cb.checked;
+ if (msg) { msg.textContent = (err && err.message) || 'Failed'; msg.style.color = 'var(--red)'; }
+ }
+ });
+ });
+ }
+
el('uf-codex-cancel')?.addEventListener('click', () => { formEl.style.display = 'none'; });
- el('uf-codex-save')?.addEventListener('click', () => {
+
+ // Configure access — collapsed by default so the reveal panel doesn't
+ // dump 13 toggles at once. Click reveals + rotates the caret.
+ el('uf-codex-toggle-config')?.addEventListener('click', () => {
+ const body = el('uf-codex-config-body');
+ const btn = el('uf-codex-toggle-config');
+ const caret = el('uf-codex-toggle-config-caret');
+ if (!body || !btn) return;
+ const open = body.style.display === 'none';
+ body.style.display = open ? '' : 'none';
+ btn.setAttribute('aria-expanded', open ? 'true' : 'false');
+ if (caret) caret.style.transform = open ? 'rotate(180deg)' : '';
+ });
+
+ el('uf-codex-save')?.addEventListener('click', async () => {
const msg = el('uf-codex-msg');
- if (msg) { msg.textContent = 'Saved'; msg.style.color = 'var(--green, #50fa7b)'; }
- setTimeout(() => { formEl.style.display = 'none'; }, 350);
+ const tokenId = formEl.dataset.createdTokenId;
+ if (!tokenId) { formEl.style.display = 'none'; return; }
+ const scopes = ['chat'].concat(
+ Array.from(formEl.querySelectorAll('#uf-codex-inline-scopes .uf-codex-scope:checked'))
+ .map(input => input.dataset.scope)
+ );
+ try {
+ const r = await fetch(`/api/tokens/${tokenId}`, {
+ method: 'PATCH', credentials: 'same-origin',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ scopes }),
+ });
+ const d = await r.json().catch(() => ({}));
+ if (!r.ok) throw new Error(d.detail || 'Failed');
+ if (msg) { msg.textContent = 'Saved'; msg.style.color = 'var(--green, #50fa7b)'; }
+ await renderList();
+ setTimeout(() => { formEl.style.display = 'none'; }, 350);
+ } catch (err) {
+ if (msg) { msg.textContent = err?.message || 'Save failed'; msg.style.color = 'var(--red)'; }
+ }
+ });
+
+ // Revoke = delete this agent token entirely. Confirmation prompt keeps
+ // it from being a one-click footgun. Closes the form on success.
+ el('uf-codex-revoke')?.addEventListener('click', async () => {
+ const tokenId = formEl.dataset.createdTokenId;
+ if (!tokenId) return;
+ const ok = window.styledConfirm
+ ? await window.styledConfirm(`Revoke this ${cfg.word} agent token? Integrations using it will lose access.`, { confirmText: 'Revoke', danger: true })
+ : confirm(`Revoke this ${cfg.word} agent token? Integrations using it will lose access.`);
+ if (!ok) return;
+ const msg = el('uf-codex-msg');
+ try {
+ const r = await fetch(`/api/tokens/${tokenId}`, { method: 'DELETE', credentials: 'same-origin' });
+ if (!r.ok) throw new Error('Revoke failed');
+ if (msg) { msg.textContent = 'Revoked'; msg.style.color = 'var(--color-error)'; }
+ await renderList();
+ setTimeout(() => { formEl.style.display = 'none'; }, 350);
+ } catch (err) {
+ if (msg) { msg.textContent = err?.message || 'Revoke failed'; msg.style.color = 'var(--red)'; }
+ }
});
const _autoCreateCodex = async () => {
const msg = el('uf-codex-msg');
+ const prompt = el('uf-codex-prompt');
const pending = el('uf-codex-pending');
+ const createBtn = el('uf-codex-create-btn');
+ if (prompt) prompt.style.display = 'none';
+ if (createBtn) createBtn.style.display = 'none';
+ // Whirlpool spinner while the POST is in flight.
+ let _wp = null;
+ if (pending) {
+ pending.innerHTML = '';
+ pending.style.display = 'flex';
+ try {
+ const sp = window.spinnerModule || (await import('./spinner.js')).default;
+ _wp = sp.createWhirlpool(14);
+ _wp.element.style.cssText = 'display:inline-flex;width:14px;height:14px;margin:0 4px 0 0;';
+ pending.appendChild(_wp.element);
+ pending.appendChild(document.createTextNode('Creating token…'));
+ } catch (_) {
+ pending.textContent = 'Creating token…';
+ }
+ }
const existingNames = new Set(agentTokens.map(t => (t.name || '').trim()));
- let name = cfg.defaultName;
- let n = 2;
- while (existingNames.has(name)) { name = `${cfg.defaultName} ${n++}`; }
+ const nameInput = el('uf-codex-name-input');
+ // User-typed name wins. Empty / whitespace falls back to the default,
+ // auto-suffixed with " 2", " 3"… so two tokens never collide.
+ let name = (nameInput && nameInput.value || '').trim() || cfg.defaultName;
+ if (existingNames.has(name)) {
+ let n = 2;
+ const base = name;
+ while (existingNames.has(name)) { name = `${base} ${n++}`; }
+ }
+ // Minimum scope on creation so the token isn't effectively saved
+ // with everything granted before the user has clicked Save. The
+ // UI toggles below are pre-checked as a preview of what *will*
+ // be granted; nothing else is persisted server-side until Save.
const fd = new FormData();
fd.append('name', name);
fd.append('scopes', 'chat');
@@ -4955,6 +5293,7 @@ async function initUnifiedIntegrations() {
const r = await fetch('/api/tokens', { method: 'POST', credentials: 'same-origin', body: fd });
const d = await r.json();
if (!r.ok) throw new Error(d.detail || 'Failed');
+ if (_wp) { try { _wp.destroy(); } catch (_) {} }
if (pending) pending.style.display = 'none';
el('uf-codex-token').textContent = d.token || '';
el('uf-codex-reveal').style.display = '';
@@ -4962,23 +5301,31 @@ async function initUnifiedIntegrations() {
if (setupBtn) setupBtn.dataset.token = d.token || '';
const setupCode = el('uf-codex-setup-code');
if (setupCode) setupCode.textContent = setupForToken(d.token || '');
- // Populate inline scope toggles for the just-created token (Configure access already open)
- const newToken = { id: d.id, name, scopes: d.scopes || ['chat'] };
+ // Populate inline scope toggles for the just-created token with
+ // ALL scopes pre-checked as a UI preview — the underlying token
+ // still only has 'chat' until the user clicks Save below.
+ const uiToken = { id: d.id, scopes: ['chat'].concat(toolScopes.map(s => s.key)) };
const inlineEl = el('uf-codex-inline-scopes');
if (inlineEl) {
inlineEl.innerHTML = `
- <div class="uf-codex-token" data-token-id="${esc(newToken.id)}">
- ${scopeToggles(newToken)}
- <div class="uf-codex-scope-msg" data-token-id="${esc(newToken.id)}" style="font-size:11px;min-height:14px;"></div>
+ <div class="uf-codex-token" data-token-id="${esc(uiToken.id)}">
+ ${scopeToggles(uiToken)}
+ <div class="uf-codex-scope-msg" data-token-id="${esc(uiToken.id)}" style="font-size:11px;min-height:14px;"></div>
</div>`;
- _wireScopeChange(inlineEl);
+ // No auto-PATCH: scope toggles only persist on Save click below.
}
+ // Now that the token exists, surface the Save button.
+ const saveBtn = el('uf-codex-save');
+ if (saveBtn) saveBtn.style.display = 'inline-flex';
+ // Remember the created token id so Save can PATCH its scopes.
+ formEl.dataset.createdTokenId = String(uiToken.id);
if (msg) {
msg.textContent = `Created "${name}".`;
msg.style.color = 'var(--green, #50fa7b)';
}
await renderList();
} catch (err) {
+ if (_wp) { try { _wp.destroy(); } catch (_) {} }
if (pending) pending.style.display = 'none';
if (msg) {
msg.textContent = err?.message || 'Failed';
@@ -4986,7 +5333,8 @@ async function initUnifiedIntegrations() {
}
}
};
- if (!current) _autoCreateCodex();
+ // Bind the explicit Create button; no auto-creation.
+ el('uf-codex-create-btn')?.addEventListener('click', () => { _autoCreateCodex(); });
const _copyCodexToken = async (text) => {
const value = String(text || '');
if (!value) return false;
@@ -5020,88 +5368,43 @@ async function initUnifiedIntegrations() {
selection.removeAllRanges();
selection.addRange(range);
};
+ const COPY_ICON = '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';
+ const CHECK_ICON = '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>';
el('uf-codex-copy-setup')?.addEventListener('click', async () => {
const token = el('uf-codex-copy-setup')?.dataset.token || '';
const btn = el('uf-codex-copy-setup');
- if (!token) {
- if (btn) {
- btn.textContent = 'Add agent first';
- setTimeout(() => { const latest = el('uf-codex-copy-setup'); if (latest) latest.textContent = 'Copy setup'; }, 1600);
- }
- return;
- }
+ if (!token) return;
const setup = setupForToken(token);
const ok = await _copyCodexToken(setup);
if (!btn) return;
- btn.textContent = ok ? 'Copied setup' : 'Select setup';
- if (!ok) _selectTextFallback(setup, 'uf-codex-reveal');
- setTimeout(() => { const latest = el('uf-codex-copy-setup'); if (latest) latest.textContent = 'Copy setup'; }, 1600);
+ if (ok) {
+ btn.innerHTML = CHECK_ICON;
+ btn.style.color = 'var(--accent, var(--red))';
+ btn.style.opacity = '1';
+ } else {
+ _selectTextFallback(setup, 'uf-codex-reveal');
+ }
+ setTimeout(() => {
+ const latest = el('uf-codex-copy-setup');
+ if (latest) { latest.innerHTML = COPY_ICON; latest.style.color = ''; latest.style.opacity = '0.7'; }
+ }, 1600);
});
el('uf-codex-copy-token')?.addEventListener('click', async () => {
const token = el('uf-codex-token')?.textContent || '';
const ok = await _copyCodexToken(token);
const btn = el('uf-codex-copy-token');
if (!btn) return;
- btn.textContent = ok ? 'Copied token' : 'Select token';
- if (!ok) _selectTextFallback(token, 'uf-codex-reveal');
- setTimeout(() => { const latest = el('uf-codex-copy-token'); if (latest) latest.textContent = 'Copy token'; }, 1600);
- });
- formEl.querySelectorAll('.uf-codex-revoke').forEach(btn => {
- btn.addEventListener('click', async () => {
- if (!await window.styledConfirm(`Revoke this ${cfg.word} token? Integrations using it will lose access.`, { confirmText: 'Revoke', danger: true })) return;
- await fetch(`/api/tokens/${btn.dataset.tokenId}`, { method: 'DELETE', credentials: 'same-origin' });
- formEl.style.display = 'none';
- await renderList();
- });
- });
- // Rename: PATCH the token's name when the user blurs the input (or hits Enter).
- formEl.querySelectorAll('.uf-codex-rename').forEach(input => {
- const original = input.value;
- const commit = async () => {
- const name = (input.value || '').trim();
- if (!name || name === original) return;
- try {
- const r = await fetch(`/api/tokens/${input.dataset.tokenId}`, {
- method: 'PATCH',
- credentials: 'same-origin',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ name }),
- });
- if (!r.ok) throw new Error('Save failed');
- input.style.borderColor = 'var(--green, #50fa7b)';
- setTimeout(() => { input.style.borderColor = 'transparent'; }, 800);
- await renderList();
- } catch (_) {
- input.value = original;
- input.style.borderColor = 'var(--red)';
- setTimeout(() => { input.style.borderColor = 'transparent'; }, 1200);
- }
- };
- input.addEventListener('blur', commit);
- input.addEventListener('keydown', (e) => { if (e.key === 'Enter') { e.preventDefault(); input.blur(); } });
- });
- // Copy token prefix (full token irrecoverable after the one-time creation reveal).
- formEl.querySelectorAll('.uf-codex-copy-prefix').forEach(btn => {
- btn.addEventListener('click', async () => {
- const prefix = btn.dataset.tokenPrefix || '';
- if (!prefix) return;
- try {
- if (navigator.clipboard && window.isSecureContext) {
- await navigator.clipboard.writeText(prefix);
- } else {
- const ta = document.createElement('textarea');
- ta.value = prefix;
- ta.style.cssText = 'position:fixed;left:0;top:0;width:1px;height:1px;opacity:0;';
- document.body.appendChild(ta);
- ta.select();
- try { document.execCommand('copy'); } catch (_) {}
- ta.remove();
- }
- const label = btn.textContent;
- btn.textContent = 'Copied prefix';
- setTimeout(() => { btn.textContent = label; }, 1400);
- } catch (_) {}
- });
+ if (ok) {
+ btn.innerHTML = CHECK_ICON;
+ btn.style.color = 'var(--accent, var(--red))';
+ btn.style.opacity = '1';
+ } else {
+ _selectTextFallback(token, 'uf-codex-reveal');
+ }
+ setTimeout(() => {
+ const latest = el('uf-codex-copy-token');
+ if (latest) { latest.innerHTML = COPY_ICON; latest.style.color = ''; latest.style.opacity = '0.7'; }
+ }, 1600);
});
function _wireScopeChange(scope) {
scope.querySelectorAll('.uf-codex-scope').forEach(cb => {
@@ -5130,76 +5433,68 @@ async function initUnifiedIntegrations() {
});
});
}
- _wireScopeChange(formEl);
+ // Note: don't call _wireScopeChange(formEl) here. The existing-token
+ // editor (current) already wires its own change handler that PATCHes
+ // immediately. The inline scopes for a *just-created* token should
+ // remain unwired so they only persist on Save click below.
}
- // ── Add button with type picker ──
+ // ── Add button now drops a type-picker menu directly anchored to itself ──
if (addBtn) {
- addBtn.addEventListener('click', () => {
- formEl.style.display = '';
- const _typeOptions = [
- ['api', 'API Service'],
- ['caldav', 'CalDAV Calendar'],
- ['claude', 'Claude Agent'],
- ['codex', 'Codex Agent'],
- ['carddav', 'Contacts (CardDAV)'],
- ['contacts', 'Contacts Import'],
- ['email', 'Email (IMAP/SMTP)'],
- ['mcp', 'MCP Tool Server'],
- ];
- const _iconFor = (k) => (INTG_TYPES[k]?.icon || '').replace(/width="14"/, 'width="16"').replace(/height="14"/, 'height="16"');
- const _rowsHtml = _typeOptions.map(([k, label]) => `<button type="button" class="uf-type-option" data-value="${k}" style="display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;background:transparent;border:0;color:var(--fg);font:inherit;cursor:pointer;text-align:left;"><span style="display:inline-flex;color:var(--accent, var(--red));flex-shrink:0;">${_iconFor(k)}</span><span>${esc(label)}</span></button>`).join('');
- formEl.innerHTML = `
- <div class="admin-card" style="margin-top:8px">
- <h2 style="font-size:13px;display:flex;align-items:center;gap:6px;"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="color:var(--accent, var(--red));flex-shrink:0;"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>Add Integration</h2>
- <div class="settings-col">
- <div class="settings-row"><label class="settings-label">Type</label>
- <div style="position:relative;flex:1;min-width:0;">
- <button type="button" id="uf-type-trigger" class="settings-select" style="display:flex;align-items:center;gap:10px;cursor:pointer;text-align:left;width:100%;padding-right:24px;position:relative;">
- <span class="uf-type-icon" style="display:inline-flex;color:var(--accent, var(--red));"></span>
- <span class="uf-type-label" style="flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;opacity:0.65;">Select...</span>
- <span aria-hidden="true" style="position:absolute;right:8px;top:50%;transform:translateY(-50%);opacity:0.5;font-size:10px;pointer-events:none;">▾</span>
- </button>
- <div id="uf-type-menu" style="display:none;position:absolute;top:calc(100% + 2px);left:0;right:0;z-index:1000;background:var(--panel);border:1px solid var(--border);border-radius:6px;max-height:340px;overflow-y:auto;box-shadow:0 6px 18px rgba(0,0,0,0.25);">${_rowsHtml}</div>
- </div>
- </div>
- </div>
- </div>`;
- const trigger = el('uf-type-trigger');
- const menu = el('uf-type-menu');
- const labelEl = trigger.querySelector('.uf-type-label');
- const iconEl = trigger.querySelector('.uf-type-icon');
- const _closeMenu = () => { menu.style.display = 'none'; };
- const _openMenu = () => {
- menu.style.display = 'block';
- // Drop-up when there's not enough room below the trigger (mobile
- // landscape / docked keyboard / long lists near the bottom of screen).
- const tRect = trigger.getBoundingClientRect();
- const mRect = menu.getBoundingClientRect();
- const below = window.innerHeight - tRect.bottom;
- const above = tRect.top;
- if (mRect.height > below && above > below) {
- menu.style.top = 'auto'; menu.style.bottom = 'calc(100% + 2px)';
- } else {
- menu.style.top = 'calc(100% + 2px)'; menu.style.bottom = 'auto';
- }
- const onDoc = (ev) => { if (!menu.contains(ev.target) && ev.target !== trigger) { _closeMenu(); document.removeEventListener('click', onDoc, true); } };
- setTimeout(() => document.addEventListener('click', onDoc, true), 0);
- };
- trigger.addEventListener('click', (e) => { e.stopPropagation(); menu.style.display === 'block' ? _closeMenu() : _openMenu(); });
+ const _typeOptions = [
+ ['api', 'API Service'],
+ ['caldav', 'CalDAV Calendar'],
+ ['claude', 'Claude Agent'],
+ ['codex', 'Codex Agent'],
+ ['carddav', 'Contacts (CardDAV)'],
+ ['contacts', 'Contacts Import'],
+ ['email', 'Email (IMAP/SMTP)'],
+ ['mcp', 'MCP Tool Server'],
+ ];
+ const _iconFor = (k) => (INTG_TYPES[k]?.icon || '').replace(/width="14"/, 'width="16"').replace(/height="14"/, 'height="16"');
+ const _rowsHtml = _typeOptions.map(([k, label]) => `<button type="button" class="uf-type-option" data-value="${k}" style="display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;background:transparent;border:0;color:var(--fg);font:inherit;cursor:pointer;text-align:left;"><span style="display:inline-flex;color:var(--accent, var(--red));flex-shrink:0;">${_iconFor(k)}</span><span>${esc(label)}</span></button>`).join('');
+
+ // Anchor wrapper so the absolutely-positioned menu lands directly under
+ // the add button. The button is the wrapper's only sibling.
+ if (!addBtn.parentElement.classList.contains('uf-add-anchor')) {
+ addBtn.parentElement.style.position = 'relative';
+ addBtn.parentElement.classList.add('uf-add-anchor');
+ }
+ let _menuEl = null;
+ const _closeMenu = () => { if (_menuEl) { _menuEl.remove(); _menuEl = null; } };
+ addBtn.addEventListener('click', (e) => {
+ e.stopPropagation();
+ if (_menuEl) { _closeMenu(); return; }
+ const menu = document.createElement('div');
+ menu.className = 'uf-add-menu';
+ menu.innerHTML = _rowsHtml;
+ menu.style.cssText = 'position:absolute;right:0;z-index:1000;background:var(--panel);border:1px solid var(--border);border-radius:6px;max-height:340px;overflow-y:auto;box-shadow:0 6px 18px rgba(0,0,0,0.25);min-width:220px;';
+ addBtn.parentElement.appendChild(menu);
+ _menuEl = menu;
+ // Drop-up when there isn't enough room below the button (modal near
+ // the viewport bottom, mobile keyboard up, etc.).
+ const tRect = addBtn.getBoundingClientRect();
+ const mRect = menu.getBoundingClientRect();
+ const below = window.innerHeight - tRect.bottom;
+ const above = tRect.top;
+ if (mRect.height > below && above > below) {
+ menu.style.top = 'auto'; menu.style.bottom = 'calc(100% + 2px)';
+ } else {
+ menu.style.top = 'calc(100% + 2px)'; menu.style.bottom = 'auto';
+ }
menu.querySelectorAll('.uf-type-option').forEach(btn => {
btn.addEventListener('mouseenter', () => { btn.style.background = 'color-mix(in srgb, var(--fg) 8%, transparent)'; });
btn.addEventListener('mouseleave', () => { btn.style.background = 'transparent'; });
- btn.addEventListener('click', (e) => {
- e.stopPropagation();
+ btn.addEventListener('click', (ev) => {
+ ev.stopPropagation();
const k = btn.dataset.value;
- const lbl = btn.querySelector('span:last-child')?.textContent || '';
- if (labelEl) { labelEl.textContent = lbl; labelEl.style.opacity = '1'; }
- if (iconEl) iconEl.innerHTML = _iconFor(k);
_closeMenu();
+ formEl.style.display = '';
showForm(k, 'new');
});
});
+ const onDoc = (ev) => { if (!menu.contains(ev.target) && ev.target !== addBtn) { _closeMenu(); document.removeEventListener('click', onDoc, true); } };
+ setTimeout(() => document.addEventListener('click', onDoc, true), 0);
});
}
diff --git a/static/js/tasks.js b/static/js/tasks.js
index 03e426f73..8437b4250 100644
--- a/static/js/tasks.js
+++ b/static/js/tasks.js
@@ -2482,12 +2482,15 @@ function _renderMainView() {
// ---- Modal ----
-export function openTasks(focusId) {
+export function openTasks(focusId, opts) {
+ const o = opts || {};
if (_open) {
- // Already open — just focus the requested task.
+ // Already open — just focus the requested task / apply filter.
+ if (o.filter !== undefined) { _taskFilter = o.filter; _renderList(); }
if (focusId) _focusTask(focusId);
return;
}
+ if (o.filter !== undefined) _taskFilter = o.filter;
_pendingFocusTaskId = focusId || null;
_open = true;
_tasksCascadeNext = true;
diff --git a/static/style.css b/static/style.css
index ae5b68375..3575e907e 100644
--- a/static/style.css
+++ b/static/style.css
@@ -1239,23 +1239,27 @@ body.bg-pattern-sparkles {
.section-header-btn.active { opacity: 0.9; color: var(--accent); }
.section-header-btn svg { width: 12px; height: 12px; }
- /* Chats library — grid icon, hover-reveal so the header only toggles collapse */
+ /* Chats library — grid icon, hover-reveal so the header only toggles
+ collapse. Uses !important to win over .list-item-plus-btn's
+ opacity:1!important (the email-style plus button forces always-on,
+ which we don't want here — the manage button should fade until the
+ user actually hovers the section). */
#sessions-section .chats-manage-btn {
- opacity: 0;
+ opacity: 0 !important;
transition: opacity 0.12s, background 0.08s;
}
#sessions-section .section-header-flex:hover .chats-manage-btn,
#sessions-section .chats-manage-btn:hover,
#sessions-section .chats-manage-btn:focus-visible {
- opacity: 0.45;
+ opacity: 0.45 !important;
}
#sessions-section .chats-manage-btn:hover,
#sessions-section .chats-manage-btn:focus-visible {
- opacity: 1;
+ opacity: 1 !important;
}
@media (hover: none) {
- #sessions-section .chats-manage-btn { opacity: 0.35; }
- #sessions-section .chats-manage-btn:active { opacity: 1; }
+ #sessions-section .chats-manage-btn { opacity: 0.35 !important; }
+ #sessions-section .chats-manage-btn:active { opacity: 1 !important; }
}
/* Collapse chevron */
@@ -14011,7 +14015,7 @@ body:has(.doc-version-panel:not(.hidden)) .hamburger-btn {
background: color-mix(in srgb, var(--fg) 12%, transparent);
border-radius: 50%;
}
-.adm-provider-caret { flex-shrink: 0; opacity: 0.5; transition: transform 0.15s; }
+.adm-provider-caret { flex-shrink: 0; transition: transform 0.15s; }
.adm-provider-picker:has(.adm-provider-menu:not(.hidden)) .adm-provider-caret {
transform: rotate(180deg);
}
@@ -14273,6 +14277,25 @@ body:has(.doc-version-panel:not(.hidden)) .hamburger-btn {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
+ margin-top: -4px;
+}
+
+/* Settings panel — tint each card's h2 title icon with the user's accent
+ colour. Direct-child selector (`> h2 > svg`) so SVGs nested inside
+ header buttons (Test, kebab, etc.) are untouched. Each title icon uses
+ stroke="currentColor", so setting color propagates; existing inline
+ opacity:0.6 stays so the tint reads soft. */
+/* Selected integration card — class beats inline borderColor reset */
+.intg-card.intg-card-active { border-color: var(--accent, var(--red)) !important; }
+
+[data-settings-panel="ai"] .admin-card > h2 > svg,
+[data-settings-panel="services"] .admin-card > h2 > svg,
+[data-settings-panel="added-models"] .admin-card > h2 > svg,
+[data-settings-panel="search"] .admin-card > h2 > svg,
+[data-settings-panel="integrations"] .admin-card > h2 > svg,
+[data-settings-panel="reminders"] .admin-card > h2 > svg,
+[data-settings-panel="added-models"] .adm-ep-section-head > svg {
+ color: var(--accent, var(--red));
}
.admin-ep-actions {
display: flex;
@@ -21463,7 +21486,7 @@ body.gallery-selecting .gallery-dl-btn,
padding: 8px 10px;
border: none;
background: none;
- color: var(--color-muted);
+ color: color-mix(in srgb, var(--fg) 60%, transparent);
font-family: inherit;
font-size: 12px;
font-weight: 500;
@@ -21565,9 +21588,11 @@ body.gallery-selecting .gallery-dl-btn,
background: transparent; color: var(--fg); cursor: pointer; font-size: 13px;
display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
-.shortcut-action-btn:hover { border-color: var(--accent, #cc6a3a); background: color-mix(in srgb, var(--accent, #cc6a3a) 10%, var(--bg)); }
-.shortcut-action-btn.is-reset { opacity: 0.5; }
-.shortcut-action-btn.is-reset:hover { opacity: 1; }
+.shortcut-action-btn:not(.is-reset):hover { border-color: var(--accent, #cc6a3a); background: color-mix(in srgb, var(--accent, #cc6a3a) 10%, var(--bg)); }
+.shortcut-action-btn.is-reset { opacity: 0.55; border-color: transparent; background: transparent; }
+.shortcut-action-btn.is-reset:hover,
+.shortcut-action-btn.is-reset:focus,
+.shortcut-action-btn.is-reset:active { opacity: 0.55; background: transparent; border-color: transparent; }
@keyframes shortcut-pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.6; }
@@ -22659,23 +22684,17 @@ details.hwfit-serve-advanced > .hwfit-serve-checks:last-of-type {
.settings-fallback-remove {
flex-shrink: 0;
margin-right: 4px;
- width: 22px;
- height: 22px;
- line-height: 1;
- font-size: 15px;
- /* Nudge the × glyph 5px left within the button (button size unchanged). */
- text-indent: -5px;
+ width: 32px;
+ height: 32px;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
border: 1px solid var(--border);
border-radius: 6px;
background: transparent;
color: color-mix(in srgb, var(--fg) 55%, transparent);
cursor: pointer;
transition: border-color 0.12s, color 0.12s, background 0.12s;
- position: relative;
- top: -6px;
- /* Glyph baseline trim: nudge × up 1px inside the button without moving the
- button. line-height < 1 lets the glyph float toward the top of its line box. */
- line-height: 0.85;
}
.settings-fallback-remove:hover {
border-color: var(--red);