theseus/llm-picker.html
Local Dev aea158ab05 Theseus 0.3.122 followups: AI engines page, Pick-AI edit button, Pithos panel, Did-you-mean on DNS failures, LLM picker UI polish, real-brand icon preference
Shipped on top of the 0.3.122 Settings restructure commit.

AI engines settings page. New top-level nav entry "AI engines" with its own
Default picker, Enabled list, catalog, discover filter and + Add AI engine
form. The Search page is now LLM-free — ENGINE_KINDS is `["search"]`, the
Search catalog filters out kind="llm" entries, and the Search custom-URL
form only adds kind="search" engines. add-engine IPC now accepts a kind:
"llm" field (sets defaultLlmId instead of searchEngine for LLM customs).

Pick-AI picker. Borders removed, corners rounded (16px), heavier shadow;
"Pick AI engines…" footer row dropped. Edit button (pencil icon) added to
the header; opens the new AI engines settings page via `llm-picker-settings`,
which now routes to the "ai-engines" slug (openSettingsTab falls through to
"search" for legacy profiles that lack the section).

Icon priority flipped. allEngines() now prefers a fetched favicon (the
site's own brand mark, cached per profile) over the bundled generic tile.
Bundled tiles still carry the first paint while the fetch runs, and the
emit after fetch swaps in the real brand. Offline profiles see the tile
indefinitely — same reliability as before.

Pithos sidebar panel. bundled-addons/pithos/addon.json declares a `panels`
block so sidebarLeftPanels() returns Pithos's panel BEFORE the add-on's
on-demand activation. Previously, the Sidebar settings' Theseus native
apps card was missing Pithos: it only appeared after first launch, when
the add-on's own registerSidebarPanel call ran. Hermes already did this.

Did-you-mean on DNS failures. The error page's "Did you mean" row now
merges BCNR warm-index matches with ICANN alternative-TLD swaps + history
base-name matches. For my.mynymbox.com the suggestions are my.mynymbox.io,
mynymbox.io, my.mynymbox.net, mynymbox.net — the subdomain-strip is
interleaved so a mistake like typing my.mynymbox.com when the real site
is client.mynymbox.io still surfaces mynymbox.io near the top. Both paths
are local-only; no network, no leak of what the user is browsing.

Sidebar settings tightened. "How panels open" collapsed to one row with
two side-by-side option cards; "Reset panel widths" and "AI engine in the
sidebar" are one-liners now.
2026-10-27 20:50:40 +02:00

111 lines
5.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Pick AI</title>
<style>
:root {
--bg: #141a24; --card: #1a2130; --card-hi: #212a3b; --line: #2a3344;
--ink: #e7eaf1; --mut: #8b98a9; --acid: #d6ff3d; --acid-tint: #d6ff3d1a;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: transparent; }
body {
display: inline-block;
font: 13px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif;
color: var(--ink);
user-select: none;
-webkit-user-select: none;
}
.pop {
display: flex; flex-direction: column;
background: var(--bg); border-radius: 16px;
box-shadow: 0 16px 48px rgba(0,0,0,.55), 0 4px 12px rgba(0,0,0,.4);
overflow: hidden; width: 240px;
}
.hdr { padding: 10px 14px 4px; font-size: 11px; font-weight: 600;
color: var(--mut); text-transform: uppercase; letter-spacing: .5px;
display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hdr .edit { background: transparent; border: 0; padding: 2px; margin: -2px;
color: var(--mut); cursor: pointer; border-radius: 6px;
display: inline-grid; place-items: center; }
.hdr .edit:hover { color: var(--ink); background: var(--card-hi); }
.hdr .edit svg { width: 14px; height: 14px; display: block; }
.list { display: flex; flex-direction: column; padding: 4px; }
.row { display: flex; align-items: center; gap: 10px;
padding: 8px 10px; border-radius: 10px; cursor: pointer; position: relative;
transition: background .08s; }
.row:hover { background: var(--card-hi); }
.row.cur { background: var(--acid-tint); }
.row.cur::before { content: ""; position: absolute; left: 2px; top: 20%; bottom: 20%;
width: 3px; border-radius: 2px; background: var(--acid); }
.ico { flex: none; width: 28px; height: 28px; border-radius: 8px; overflow: hidden;
display: grid; place-items: center; background: #0b0e14; }
.ico img, .ico svg { width: 100%; height: 100%; display: block; }
.ico .letter { font-weight: 800; font-size: 15px; color: var(--acid); }
.name { flex: 1; font-weight: 600; font-size: 13px; color: var(--ink); }
.check { flex: none; width: 14px; height: 14px; color: var(--acid); opacity: 0; }
.row.cur .check { opacity: 1; }
.footer { padding: 4px; }
.footer .row { color: var(--mut); font-weight: 500; }
.footer .ico { background: transparent; }
.footer .ico svg { width: 18px; height: 18px; color: var(--mut); }
.empty { padding: 16px; text-align: center; color: var(--mut); font-size: 12px; }
</style>
</head>
<body>
<div class="pop" id="pop">
<div class="hdr"><span>AI engine</span><button class="edit" id="editBtn" title="Edit AI engines" aria-label="Edit AI engines"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><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></button></div>
<div class="list" id="list"></div>
</div>
<script>
const api = window.llmPicker;
const list = document.getElementById("list");
const esc = (s) => String(s || "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
function render(state) {
const engines = state.engines || [];
const cur = state.current;
list.innerHTML = "";
if (!engines.length) {
list.innerHTML = '<div class="empty">No AI engine enabled.</div>';
return;
}
for (const e of engines) {
const row = document.createElement("div");
row.className = "row" + (e.id === cur ? " cur" : "");
const ico = e.icon
? '<img src="' + esc(e.icon) + '" alt="">'
: '<div class="letter">' + esc((e.name || "?").slice(0, 1).toUpperCase()) + '</div>';
row.innerHTML =
'<div class="ico">' + ico + '</div>' +
'<div class="name">' + esc(e.name) + '</div>' +
'<svg class="check" 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>';
row.addEventListener("click", () => api.pick(e.id));
list.appendChild(row);
}
}
document.addEventListener("keydown", (e) => { if (e.key === "Escape") api.close(); });
// Edit button → opens Settings on the dedicated AI engines page (handled
// in main via the picker's own `settings` IPC).
document.getElementById("editBtn").addEventListener("click", () => api.settings());
// Close-on-click-away is driven from main (see closeOnClickAway registration);
// relying on a client-side window.blur here closes the picker the moment it
// opens if Electron's focus flickers between the strip view and the pop,
// which is what happened in 0.3.106–0.3.119 — the pop briefly rendered then
// vanished and users saw the Pick-AI button as a no-op.
api.onState(render);
api.ready();
// Report rendered size so the main process can size the WebContentsView
// to match the pop's natural content. Measuring documentElement's scroll
// size — the pop's own getBoundingClientRect may still be clipped by the
// view bounds until the host resizes to our ask.
function reportSize() {
const w = document.documentElement.scrollWidth;
const h = document.documentElement.scrollHeight;
api.resize(w, h);
}
new ResizeObserver(reportSize).observe(document.body);
requestAnimationFrame(reportSize);
</script>
</body>
</html>