基于WebView2实现的Win11桌面框架,利用插件自定义
chunhualin1
2026-08-17 9b5711d3124622b1f1b18500d442c76492da877a
samples/plugins/sample.llm-command-palette/index.html
@@ -32,6 +32,7 @@
    html,
    body {
      width: 100%;
      height: 100%;
      min-width: 0;
      margin: 0;
      overflow: hidden;
@@ -45,13 +46,20 @@
    .palette-shell {
      width: 100%;
      height: 100%;
      min-width: 360px;
      min-height: 250px;
      min-height: 0;
      padding: 8px;
      display: flex;
      flex-direction: column;
    }
    .palette {
      width: 100%;
      flex: 1 1 auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
      border: 1px solid var(--line);
      border-radius: 20px;
      background: var(--bar-bg-solid);
@@ -72,6 +80,7 @@
      grid-template-columns: 24px minmax(96px, 154px) 1fr auto minmax(92px, 132px);
      align-items: center;
      gap: 8px;
      flex: 0 0 auto;
      min-height: 54px;
      padding: 0 14px 0 18px;
    }
@@ -264,7 +273,11 @@
      max-height: 0;
      opacity: 0;
      overflow: hidden;
      border-top: 1px solid transparent;
      border-top: 0 solid transparent;
      transition: opacity 140ms ease, border-color 140ms ease;
    }
    .memory-panel {
      transition: max-height 160ms ease, opacity 140ms ease, border-color 140ms ease;
    }
@@ -272,17 +285,74 @@
    .memory-panel.open {
      max-height: var(--panel-max-height);
      opacity: 1;
      border-top-color: rgba(255, 255, 255, 0.08);
      border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    .output-panel.open {
      flex: 1 0 auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      max-height: none;
    }
    .output-scroll {
      position: relative;
      flex: 1 1 auto;
      min-height: 0;
    }
    .output-inner {
      height: auto;
      max-height: var(--response-max-height);
      overflow: auto;
      padding: 14px 18px 8px 18px;
      overflow-x: hidden;
      overflow-y: auto;
      overscroll-behavior: contain;
      padding: 8px 22px 14px 18px;
      color: rgba(255, 255, 255, 0.86);
      font: 14px/1.58 "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif;
      white-space: pre-wrap;
      user-select: text;
      background: rgba(0, 0, 0, 0.16);
    }
    .output-inner::-webkit-scrollbar {
      width: 0;
      height: 0;
    }
    .output-scrollbar {
      position: absolute;
      top: 8px;
      right: 6px;
      bottom: 8px;
      width: 10px;
      border-radius: 999px;
      background: rgb(58, 56, 54);
      opacity: 0.5;
      z-index: 4;
    }
    .output-scrollbar[hidden] {
      display: none;
    }
    .output-thumb {
      position: absolute;
      left: 1px;
      right: 1px;
      min-height: 28px;
      border-radius: 999px;
      background: rgb(196, 194, 191);
      cursor: grab;
      touch-action: none;
    }
    .output-thumb:hover,
    .output-thumb.dragging {
      background: rgb(230, 228, 225);
      cursor: grabbing;
    }
    .output-inner.error {
@@ -306,21 +376,35 @@
    }
    .actions {
      flex: 0 0 auto;
      display: flex;
      justify-content: flex-end;
      gap: 6px;
      padding: 0 12px 10px;
      padding: 8px 12px 0;
    }
    .icon-action {
      width: 30px;
      height: 28px;
      display: grid;
      place-items: center;
      border: 1px solid transparent;
      border-radius: 8px;
      background: transparent;
      color: var(--muted);
      font: 600 13px/1 "Segoe UI", system-ui, sans-serif;
      cursor: pointer;
    }
    .icon-action svg {
      width: 14px;
      height: 14px;
      display: block;
      fill: none;
      stroke: currentColor;
      stroke-width: 1.7;
      stroke-linecap: round;
      stroke-linejoin: round;
    }
    .icon-action:hover,
@@ -494,13 +578,30 @@
      </div>
      <div id="outputPanel" class="output-panel" aria-live="polite" role="region" aria-label="LLM response">
        <div id="outputText" class="output-inner" data-placeholder="Waiting for response"></div>
        <div class="actions">
          <div id="copyButton" class="icon-action" role="button" tabindex="0" title="Copy" aria-label="Copy">C</div>
          <div id="retryButton" class="icon-action" role="button" tabindex="0" title="Regenerate"
            aria-label="Regenerate">R</div>
          <div id="collapseButton" class="icon-action" role="button" tabindex="0" title="Collapse"
            aria-label="Collapse">X</div>
          <div id="copyButton" class="icon-action" role="button" tabindex="0" title="Copy" aria-label="Copy">
            <svg viewBox="0 0 16 16" aria-hidden="true">
              <rect x="5.2" y="5.2" width="8" height="8" rx="1.4"></rect>
              <path d="M10.8 5.2V3.8A1.4 1.4 0 0 0 9.4 2.4H3.8A1.4 1.4 0 0 0 2.4 3.8v5.6A1.4 1.4 0 0 0 3.8 10.8H5.2"></path>
            </svg>
          </div>
          <div id="retryButton" class="icon-action" role="button" tabindex="0" title="Regenerate" aria-label="Regenerate">
            <svg viewBox="0 0 16 16" aria-hidden="true">
              <path d="M13.2 8A5.2 5.2 0 1 1 11.4 3.7"></path>
              <path d="M11.2 2.2h2.4V4.6"></path>
            </svg>
          </div>
          <div id="collapseButton" class="icon-action" role="button" tabindex="0" title="Collapse" aria-label="Collapse">
            <svg viewBox="0 0 16 16" aria-hidden="true">
              <path d="M4 4l8 8M12 4l-8 8"></path>
            </svg>
          </div>
        </div>
        <div class="output-scroll">
          <div id="outputText" class="output-inner" tabindex="0" data-placeholder="Waiting for response"></div>
          <div id="outputScrollbar" class="output-scrollbar" hidden>
            <div id="outputThumb" class="output-thumb"></div>
          </div>
        </div>
      </div>
    </div>
@@ -514,6 +615,7 @@
      mode: "provider-direct",
      models: [],
      projects: [],
      projectStatus: "",
      selectedModelId: "",
      selectedProjectId: "",
      requestId: "",
@@ -529,9 +631,10 @@
      config: {}
    };
    let _resizeTimer;
    let _resizeFrame = 0;
    const els = {
      paletteShell: document.querySelector(".palette-shell"),
      statusMark: document.getElementById("statusMark"),
      projectSelect: document.getElementById("projectSelect"),
      projectMenu: document.getElementById("projectMenu"),
@@ -540,6 +643,8 @@
      promptInput: document.getElementById("promptInput"),
      outputPanel: document.getElementById("outputPanel"),
      outputText: document.getElementById("outputText"),
      outputScrollbar: document.getElementById("outputScrollbar"),
      outputThumb: document.getElementById("outputThumb"),
      memoryButton: document.getElementById("memoryButton"),
      memoryPanel: document.getElementById("memoryPanel"),
      memoryList: document.getElementById("memoryList"),
@@ -558,6 +663,7 @@
      { id: "kimi-k2.6", label: "Kimi", provider: "kimi", supportsStreaming: true, enabled: true },
      { id: "glm-4.7-flash", label: "GLM", provider: "bigmodel", supportsStreaming: true, enabled: true }
    ];
    const MODEL_PAGE_SIZE = 20;
    const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
@@ -620,6 +726,78 @@
      els.statusMark.title = title || "Idle";
    }
    function getResponseMaxHeight() {
      const raw = getComputedStyle(document.documentElement).getPropertyValue("--response-max-height");
      const parsed = parseFloat(raw);
      return Number.isFinite(parsed) && parsed > 0 ? parsed : 376;
    }
    function getShellChrome() {
      const palette = document.querySelector(".palette");
      const shellStyle = getComputedStyle(els.paletteShell);
      const paletteStyle = getComputedStyle(palette);
      return (parseFloat(shellStyle.paddingTop) || 0)
        + (parseFloat(shellStyle.paddingBottom) || 0)
        + (parseFloat(paletteStyle.borderTopWidth) || 0)
        + (parseFloat(paletteStyle.borderBottomWidth) || 0);
    }
    function getChromeHeight() {
      const inputRow = document.querySelector(".input-row");
      const actions = document.querySelector(".actions");
      const memoryH = els.memoryPanel.offsetHeight;
      const actionsH = els.outputPanel.classList.contains("open") && actions ? actions.offsetHeight : 0;
      const panelStyle = getComputedStyle(els.outputPanel);
      const panelBorder = els.outputPanel.classList.contains("open")
        ? (parseFloat(panelStyle.borderTopWidth) || 0) + (parseFloat(panelStyle.borderBottomWidth) || 0)
        : 0;
      return getShellChrome() + (inputRow ? inputRow.offsetHeight : 54) + memoryH + actionsH + panelBorder;
    }
    function measureOutputNaturalHeight() {
      const el = els.outputText;
      const prevHeight = el.style.height;
      const prevMax = el.style.maxHeight;
      el.style.height = "auto";
      el.style.maxHeight = "none";
      const natural = el.scrollHeight;
      el.style.height = prevHeight;
      el.style.maxHeight = prevMax;
      return natural;
    }
    function getOutputScrollPortHeight(natural) {
      const cssMax = getResponseMaxHeight();
      const available = window.innerHeight - getChromeHeight();
      if (available >= natural - 1) return Math.min(natural, cssMax);
      if (available > 48) return Math.min(natural, cssMax, available);
      return Math.min(natural, cssMax);
    }
    function syncOutputScrollbar() {
      const scroller = els.outputText;
      const track = els.outputScrollbar;
      const thumb = els.outputThumb;
      if (!scroller || !track || !thumb) return;
      const canScroll = scroller.scrollHeight > scroller.clientHeight + 1;
      track.hidden = !canScroll;
      if (!canScroll) return;
      const trackH = track.clientHeight;
      const thumbH = Math.max(28, Math.floor(trackH * (scroller.clientHeight / scroller.scrollHeight)));
      const maxTop = Math.max(0, trackH - thumbH);
      const range = scroller.scrollHeight - scroller.clientHeight;
      const progress = range > 0 ? scroller.scrollTop / range : 0;
      thumb.style.height = thumbH + "px";
      thumb.style.top = (maxTop * progress) + "px";
    }
    function syncOutputScrollbox() {
      const natural = measureOutputNaturalHeight();
      const port = getOutputScrollPortHeight(natural);
      els.outputText.style.height = natural > port + 1 ? port + "px" : "";
      syncOutputScrollbar();
    }
    function setOutput(text, options = {}) {
      state.output = text || "";
      els.outputText.classList.toggle("error", options.error === true);
@@ -631,7 +809,9 @@
      }
      els.outputPanel.classList.add("open");
      requestHostResize();
      syncOutputScrollbox();
      els.outputText.scrollTop = els.outputText.scrollHeight;
      syncOutputScrollbar();
    }
    function appendOutput(delta) {
@@ -641,7 +821,63 @@
    function collapseOutput() {
      els.outputPanel.classList.remove("open");
      requestHostResize(72);
      els.outputText.style.height = "";
      els.outputText.style.maxHeight = "";
      if (els.outputScrollbar) els.outputScrollbar.hidden = true;
      closeSelects();
      requestPaletteResize();
    }
    function bindOutputScrolling() {
      let drag = null;
      els.outputText.addEventListener("scroll", syncOutputScrollbar);
      document.addEventListener("wheel", (event) => {
        if (!els.outputPanel.classList.contains("open")) return;
        if (event.target.closest(".select-menu, .memory-list")) return;
        if (els.outputText.scrollHeight <= els.outputText.clientHeight + 1) return;
        els.outputText.scrollTop += event.deltaY;
        event.preventDefault();
        syncOutputScrollbar();
      }, { passive: false });
      els.outputThumb.addEventListener("pointerdown", (event) => {
        drag = {
          pointerId: event.pointerId,
          startY: event.clientY,
          startTop: els.outputThumb.offsetTop
        };
        els.outputThumb.classList.add("dragging");
        els.outputThumb.setPointerCapture(event.pointerId);
        event.preventDefault();
        event.stopPropagation();
      });
      els.outputThumb.addEventListener("pointermove", (event) => {
        if (!drag || event.pointerId !== drag.pointerId) return;
        const trackH = els.outputScrollbar.clientHeight;
        const thumbH = els.outputThumb.offsetHeight;
        const maxTop = Math.max(0, trackH - thumbH);
        const top = Math.min(maxTop, Math.max(0, drag.startTop + (event.clientY - drag.startY)));
        const range = els.outputText.scrollHeight - els.outputText.clientHeight;
        els.outputText.scrollTop = maxTop > 0 && range > 0 ? (top / maxTop) * range : 0;
        syncOutputScrollbar();
      });
      const endDrag = (event) => {
        if (!drag || event.pointerId !== drag.pointerId) return;
        drag = null;
        els.outputThumb.classList.remove("dragging");
      };
      els.outputThumb.addEventListener("pointerup", endDrag);
      els.outputThumb.addEventListener("pointercancel", endDrag);
      els.outputScrollbar.addEventListener("pointerdown", (event) => {
        if (event.target === els.outputThumb) return;
        const rect = els.outputScrollbar.getBoundingClientRect();
        const thumbH = els.outputThumb.offsetHeight;
        const maxTop = Math.max(0, els.outputScrollbar.clientHeight - thumbH);
        const top = Math.min(maxTop, Math.max(0, event.clientY - rect.top - thumbH / 2));
        const range = els.outputText.scrollHeight - els.outputText.clientHeight;
        els.outputText.scrollTop = maxTop > 0 && range > 0 ? (top / maxTop) * range : 0;
        syncOutputScrollbar();
      });
    }
    function resizeTextarea() {
@@ -650,20 +886,76 @@
      els.promptInput.style.height = height + "px";
    }
    function isSelectOpen(control) {
      return control.classList.contains("open");
    }
    function isPaletteExpanded() {
      return els.outputPanel.classList.contains("open")
        || els.memoryPanel.classList.contains("open")
        || isSelectOpen(els.projectSelect)
        || isSelectOpen(els.modelSelect);
    }
    function getOpenMenuExtent() {
      let bottom = 0;
      for (const control of [els.projectSelect, els.modelSelect]) {
        if (!isSelectOpen(control)) continue;
        const menu = control.nextElementSibling;
        if (!menu) continue;
        const rect = menu.getBoundingClientRect();
        if (rect.height > 0) {
          bottom = Math.max(bottom, Math.ceil(rect.bottom + 12));
        }
      }
      return bottom;
    }
    function syncOpenMenuSpace() {
      const extent = getOpenMenuExtent();
      els.paletteShell.style.minHeight = extent > 0 ? extent + "px" : "";
    }
    function measureDesiredHeight() {
      const outputH = els.outputPanel.classList.contains("open")
        ? Math.min(measureOutputNaturalHeight(), getResponseMaxHeight())
        : 0;
      return Math.max(Math.ceil(getChromeHeight() + outputH + 15), getOpenMenuExtent());
    }
    function requestHostResize(explicitHeight) {
      if (!bridge || typeof bridge.requestResize !== "function") return;
      const screenHeight = window.screen && window.screen.availHeight ? window.screen.availHeight : 900;
      const heightLimit = Math.floor(screenHeight * 0.5) + 88;
      const height = explicitHeight || Math.min(Math.ceil(document.body.scrollHeight + 2), heightLimit);
      const apply = (height) => {
        bridge.requestResize({ height }).catch(() => {});
      };
      if (_resizeFrame) {
        cancelAnimationFrame(_resizeFrame);
        _resizeFrame = 0;
      }
      if (explicitHeight != null) {
        clearTimeout(_resizeTimer);
        bridge.requestResize({ width: Math.ceil(document.body.scrollWidth), height }).catch(() => {});
        apply(explicitHeight);
        return;
      }
      clearTimeout(_resizeTimer);
      _resizeTimer = setTimeout(function() {
        bridge.requestResize({ width: Math.ceil(document.body.scrollWidth), height }).catch(() => {});
      }, 50);
      _resizeFrame = requestAnimationFrame(() => {
        _resizeFrame = 0;
        syncOpenMenuSpace();
        apply(Math.min(measureDesiredHeight(), heightLimit));
      });
    }
    function requestPaletteResize() {
      if (!isPaletteExpanded()) {
        syncOpenMenuSpace();
        requestHostResize(72);
        return;
      }
      requestHostResize();
    }
    function scheduleSelectResize() {
      requestAnimationFrame(() => requestPaletteResize());
    }
    function updatePanelLimits() {
@@ -671,6 +963,9 @@
      const panelMax = Math.max(180, Math.floor(screenHeight * 0.5));
      document.documentElement.style.setProperty("--panel-max-height", panelMax + "px");
      document.documentElement.style.setProperty("--response-max-height", Math.max(132, panelMax - 44) + "px");
      if (els.outputPanel.classList.contains("open")) {
        syncOutputScrollbox();
      }
    }
    function closeSelects() {
@@ -692,9 +987,11 @@
      control.dispatchEvent(new CustomEvent("change", { detail: { value } }));
    }
    function setSelectOptions(control, menu, items, emptyLabel, selectedId) {
    function setSelectOptions(control, menu, items, emptyLabel, selectedId, settings) {
      const config = settings || {};
      const autoSelectFirst = config.autoSelectFirst !== false;
      const pageSize = config.pageSize || 0;
      control.dataset.emptyLabel = emptyLabel;
      menu.textContent = "";
      const options = items
        .map((item) => ({
@@ -704,7 +1001,29 @@
        }))
        .filter((item) => item.value);
      for (const option of options) {
      menu._allOptions = options;
      menu._pageSize = pageSize;
      renderSelectPage(control, menu, true);
      const selected = options.find((option) => option.value === selectedId)
        || (autoSelectFirst ? options[0] : null)
        || null;
      setSelectValue(control, menu, selected || { value: "", label: emptyLabel, title: emptyLabel });
    }
    function renderSelectPage(control, menu, reset) {
      const options = menu._allOptions || [];
      const pageSize = menu._pageSize || 0;
      if (reset) {
        menu._renderedCount = 0;
        menu.textContent = "";
      }
      const start = menu._renderedCount || 0;
      const end = pageSize > 0 ? Math.min(options.length, start + pageSize) : options.length;
      const selectedValue = control.dataset.value || "";
      for (let index = start; index < end; index += 1) {
        const option = options[index];
        const item = document.createElement("div");
        item.className = "select-option";
        item.setAttribute("role", "option");
@@ -712,23 +1031,35 @@
        item.dataset.value = option.value;
        item.textContent = option.label;
        item.title = option.title || option.label;
        if (option.value === selectedValue) item.classList.add("selected");
        item.addEventListener("click", () => {
          setSelectValue(control, menu, option);
          closeSelects();
          scheduleSelectResize();
        });
        menu.appendChild(item);
      }
      const selected = options.find((option) => option.value === selectedId) || options[0] || null;
      setSelectValue(control, menu, selected || { value: "", label: emptyLabel, title: emptyLabel });
      menu._renderedCount = end;
      menu.style.overflow = end > 6 ? "auto" : "hidden";
    }
    function bindSelect(control, menu) {
      invokeOnAction(control, () => {
        const willOpen = !control.classList.contains("open");
        closeSelects();
        if (willOpen && menu._pageSize) {
          renderSelectPage(control, menu, true);
          const selected = (menu._allOptions || []).find((option) => option.value === (control.dataset.value || ""));
          if (selected) {
            for (const child of menu.children) {
              child.classList.toggle("selected", child.dataset.value === selected.value);
            }
          }
        }
        control.classList.toggle("open", willOpen);
        control.setAttribute("aria-expanded", willOpen ? "true" : "false");
        scheduleSelectResize();
      });
      control.addEventListener("keydown", (event) => {
        const options = [...menu.children];
@@ -742,6 +1073,15 @@
          options[nextIndex].click();
        } else if (event.key === "Escape") {
          closeSelects();
          scheduleSelectResize();
        }
      });
      menu.addEventListener("scroll", () => {
        if (!menu._pageSize) return;
        const all = menu._allOptions || [];
        if ((menu._renderedCount || 0) >= all.length) return;
        if (menu.scrollTop + menu.clientHeight >= menu.scrollHeight - 24) {
          renderSelectPage(control, menu, false);
        }
      });
    }
@@ -774,13 +1114,46 @@
    async function loadProjects() {
      try {
        if (!llm || typeof llm.getProjects !== "function") throw new Error("AiChat bridge unavailable.");
        state.projects = asArray(await llm.getProjects());
        setSelectOptions(els.projectSelect, els.projectMenu, state.projects, state.projects.length ? "Project" : "No project", state.selectedProjectId);
        const result = await llm.getProjects();
        const packed = result && !Array.isArray(result);
        const status = String((packed ? (result.status || result.Status) : "ready") || "ready").toLowerCase();
        const projects = packed ? asArray(result.projects || result.Projects) : asArray(result);
        const message = packed ? (result.message || result.Message || "") : "";
        state.projects = projects;
        state.projectStatus = status;
        if (status === "not-configured") {
          setSelectOptions(els.projectSelect, els.projectMenu, [], "Not configured", "", { autoSelectFirst: false });
          els.projectSelect.title = "AiChat is not configured.";
          state.selectedProjectId = "";
          return;
        }
        if (status === "not-connected") {
          setSelectOptions(els.projectSelect, els.projectMenu, [], "Not connected", "", { autoSelectFirst: false });
          els.projectSelect.title = message || "AiChat is not connected.";
          state.selectedProjectId = "";
          return;
        }
        const selectedId = projects.some((item) => (item.id || item.Id) === state.selectedProjectId)
          ? state.selectedProjectId
          : "";
        setSelectOptions(
          els.projectSelect,
          els.projectMenu,
          projects,
          projects.length ? "Project" : "No project",
          selectedId,
          { autoSelectFirst: false }
        );
        state.selectedProjectId = getSelectValue(els.projectSelect);
      } catch (error) {
        state.projects = [];
        setSelectOptions(els.projectSelect, els.projectMenu, [], "No project", "");
        state.projectStatus = "not-connected";
        setSelectOptions(els.projectSelect, els.projectMenu, [], "Not connected", "", { autoSelectFirst: false });
        els.projectSelect.title = getErrorMessage(error, "Project list unavailable.");
        state.selectedProjectId = "";
      }
    }
@@ -794,13 +1167,26 @@
      if (!state.models.length) state.models = fallbackModels;
      state.selectedModelId = state.config.defaultModel || state.selectedModelId || "";
      setSelectOptions(els.modelSelect, els.modelMenu, state.models, "Model", state.selectedModelId);
      setSelectOptions(els.modelSelect, els.modelMenu, state.models, "Model", state.selectedModelId, { pageSize: MODEL_PAGE_SIZE });
      state.selectedModelId = getSelectValue(els.modelSelect);
    }
    function applyMemoryAvailability() {
      const available = state.memoryCapabilities.canUseMemory ||
        state.memoryCapabilities.canViewMemory ||
        state.memoryCapabilities.canManageMemory;
      setDisabled(els.memoryButton, !available);
      els.memoryButton.title = available ? "Memories" : "Memory requires a configured AiChat account";
      if (!available) {
        els.memoryPanel.classList.remove("open");
        els.memoryButton.classList.remove("active");
      }
    }
    async function loadMemoryCapabilities() {
      if (state.mode === "aichat-api") {
        state.memoryCapabilities = { canUseMemory: false, canViewMemory: false, canManageMemory: false };
        applyMemoryAvailability();
        renderMemories("AiChat mode uses service-side memory.");
        return;
      }
@@ -816,7 +1202,7 @@
      } catch {
        state.memoryCapabilities = { canUseMemory: false, canViewMemory: false, canManageMemory: false };
      }
      setDisabled(els.memoryButton, false);
      applyMemoryAvailability();
    }
    async function loadMemories() {
@@ -1012,6 +1398,15 @@
    function bindUi() {
      bindSelect(els.projectSelect, els.projectMenu);
      bindSelect(els.modelSelect, els.modelMenu);
      bindOutputScrolling();
      window.addEventListener("moli:interactable-changed", (event) => {
        const detail = event.detail || {};
        const enabled = Boolean(detail.enabled ?? detail.Enabled);
        if (enabled) {
          els.promptInput.focus({ preventScroll: true });
        }
      });
      els.promptInput.addEventListener("input", resizeTextarea);
      els.promptInput.addEventListener("keydown", (event) => {
@@ -1051,7 +1446,7 @@
        els.memoryPanel.classList.toggle("open", isOpen);
        els.memoryButton.classList.toggle("active", isOpen);
        if (isOpen) await loadMemories();
        requestHostResize();
        requestPaletteResize();
      });
      invokeOnAction(els.addMemoryButton, () => createMemory(getText(els.memoryInput)));
@@ -1080,6 +1475,7 @@
      document.addEventListener("click", (event) => {
        if (!els.projectSelect.parentElement.contains(event.target) && !els.modelSelect.parentElement.contains(event.target)) {
          closeSelects();
          scheduleSelectResize();
        }
      });
    }