A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Merge origin/dev and settle the shell's sidebar after a lapsed request
Fei2411ac20ee82b5d7
diff --cc app/src/main.mjsindex dbbb5adb,796c3b56..dba3de48--- a/app/src/main.mjs+++ b/app/src/main.mjs@@@ -498,10 -590,8 +590,10 @@@ async function flushDeferredUpdate()function createWindow() {const dark = nativeTheme.shouldUseDarkColorsconst win32 = process.platform === 'win32'- mainWindow = new BrowserWindow({+ const win = new BrowserWindow({- width: 1320, height: 860, minWidth: 720, minHeight: 480,+ // The window never squeezes the chat: RAIL_WIDTH + MIN_CHAT from ds-bot's+ // src/client/frame-layout.js is the avatar rail plus the smallest chat column.+ width: 1320, height: 860, minWidth: 508, minHeight: 480,title: 'DeepSeek Bot', show: false, icon: iconFile,backgroundColor: mica ? '#00000000' : dark ? '#1b1b1c' : '#ffffff',// Frameless as in DSH Desktop: the caption buttons overlay the page's band. They keep thediff --cc ds-bot/client.jsindex a3481bb5,6d5969a5..77da178b--- a/ds-bot/client.js+++ b/ds-bot/client.js@@@ -2476,33 -2496,9 +2498,29 @@@ body[data-bt-motion=quiet] .bt-mark[dat.bt-row-preview{font-size:13px;line-height:18px;color:var(--bt-ink-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.bt-unread{width:8px;height:8px;border-radius:50%;background:var(--bt-accent);flex:none;margin-right:2px;animation:bt-fade .13s cubic-bezier(.22,1,.36,1)}.bt-unread-wait{background:var(--bt-star)}-.bt-rail{align-items:center;padding:0 0 8px}-.bt-rail .bt-row{justify-content:center;padding:6px 0;min-height:44px}+/* Our own left column, portalled over the shell's collapsed sidebar. It reaches+ the window's top edge so the title band and the column share one fill (under+ Mica the app styles DSH's sidebar the same way, via --bt-leftcol-fill there);+ it stays under the shell's title-bar switch (z 30) and the popovers (z 60),+ and the floating drawer keeps the opaque fill over the conversation. */+.bt-leftcol{position:fixed;left:0;top:0;bottom:0;z-index:25;display:flex;--bt-lc-clear:var(--dsh-frame-top-clearance,var(--dsh-windows-titlebar-height,0px));background:var(--bt-leftcol-fill,var(--bt-sidebar));border-right:.5px solid var(--bt-line);box-sizing:border-box;padding:calc(var(--bt-lc-clear) + 6px) 12px 6px;color:var(--bt-ink);font-family:var(--bt-font)}+html[data-windows-titlebar] .bt-leftcol,html[data-platform=darwin] .bt-leftcol{border-right:none}+.bt-leftcol[data-left=drawer]{background:var(--bt-sidebar);box-shadow:8px 0 24px rgba(0,0,0,.14)}+.bt-leftcol>.bt-side{width:100%}+.bt-leftcol-foot{display:flex;align-items:center;gap:9px;padding-top:8px;flex:none}+.bt-rail{align-items:center;padding:0}+.bt-rail .bt-row{justify-content:center;width:56px;height:56px;min-height:56px;padding:0;border-radius:16px}+.bt-rail-top{display:flex;flex-direction:column;align-items:center;gap:6px;padding-bottom:8px}+.bt-rail-sep{width:24px;height:1px;flex:none;background:var(--bt-line)}+.bt-rail .bt-agent-ava{width:44px;height:44px}+.bt-rail .bt-list{align-self:stretch;align-items:center;gap:4px}+/* The rail's list spans the whole column: the badges and dots that sit on a row's+ edge need room beside the 56px rows, or the list scrolls sideways. */+.bt-leftcol[data-left=rail]{padding:calc(var(--bt-lc-clear) + 8px) 0 8px}+.bt-leftcol-foot-rail{flex-direction:column;gap:6px}+.bt-dot{position:absolute;top:4px;right:8px;width:8px;height:8px;border-radius:50%;background:var(--bt-accent);box-shadow:0 0 0 1.5px var(--bt-sidebar)}+.bt-dot-wait{background:var(--bt-star)}.bt-side-foot{display:flex;padding-top:8px}- .bt-connect{flex:1;height:36px;border-radius:999px;border:1px solid var(--bt-line);background:var(--bt-main);color:var(--bt-ink);font-family:inherit;font-size:14px;line-height:20px;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px;transition:background-color .12s ease}- .bt-connect:hover{background:var(--bt-hover)}- .bt-connect svg{flex:none;width:15px;height:15px}- .bt-connect-wrap{position:relative;display:flex;flex:1 1 auto;min-width:0}.bt-head{position:relative;display:flex;justify-content:center;align-items:center;height:40px;flex:none;pointer-events:none}.bt-pill{pointer-events:auto;display:inline-flex;align-items:center;gap:8px;height:40px;padding:7.5px 13.5px 7.5px 7.5px;border-radius:999px;background:var(--bt-main);border:.5px solid var(--bt-line-2);box-shadow:0 2px 8px -1px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.04);color:var(--bt-ink);font-family:inherit;font-size:14px;line-height:20px;cursor:pointer;max-width:70%;box-sizing:border-box;transition:background-color .12s ease,transform ${SPRING_TAP.duration}ms ${SPRING_TAP.easing}}@@@ -2903,17 -2899,10 +2921,17 @@@ button.bt-set-row:hover{background:var(the sidebar is open. Elsewhere an open sidebar uses the team's own top row. */html:not([data-windows-titlebar]) :not([class*="_collapsed"])>[class*="_logoRow"]{display:none!important}html[data-windows-titlebar] :not([class*="_collapsed"])>[class*="_logoRow"]{height:0!important;margin:0!important}-html[data-windows-titlebar] .bt-side-collapse,html[data-platform=darwin] .bt-side-collapse{display:none}+html[data-windows-titlebar] :is(.bt-side-collapse,.bt-rail-expand),html[data-platform=darwin] :is(.bt-side-collapse,.bt-rail-expand){display:none}+/* Under a Windows title bar our own switch replaces the shell's: the shell's+ toggle expands the shell sidebar first, and pulling it back afterwards is a+ visible flash of the shell's column. */+html[data-windows-titlebar] [class*="_logoRow"]>[class*="_toggle"]{display:none!important}+.bt-title-toggle{display:none;position:fixed;left:12px;top:calc((var(--dsh-windows-titlebar-height,0px) - 28px) / 2);width:28px;height:28px;z-index:30;-webkit-app-region:no-drag;align-items:center;justify-content:center;border:0;border-radius:6px;padding:0;background:transparent;color:var(--bt-ink);cursor:pointer;font-family:var(--bt-font)}+html[data-windows-titlebar] .bt-title-toggle{display:inline-flex}+.bt-title-toggle:hover{background:var(--bt-hover)}- /* The footer ends in the Bot row: the whale's settings seat, then Connect plugins. Every- other plugin's entry takes a whole row above it, in the shell's order, so none of them- squeezes the Bot row. */+ /* The footer ends in the Bot row: the whale's settings seat, then the account menu+ when no plugin holds that seat. Every other plugin's entry takes a whole row above+ it, in the shell's order, so none of them squeezes the Bot row. */[class*="_footArea"]{grid-template-columns:auto minmax(0,1fr);grid-auto-flow:row dense;align-items:center;gap:4px 9px;padding:8px 6px 6px!important}/* DSH hides the footer of a collapsed sidebar under a Windows title bar; the gridstays out of that one place. */@@@ -9060,82 -8850,15 +9108,84 @@@ function TeamSidebar(props)return entries2.sort((a, b) => Number(Boolean(b.item.pinned)) - Number(Boolean(a.item.pinned)) || b.at - a.at);}, [roster, updated]);const main = roster.byId[roster.mainBotId];- useListGlide(listRef, wide, order.map((entry) => entry.item.id).join(","));+ useListGlide(listRef, wideContent, order.map((entry) => entry.item.id).join(","));useLandOnMainBot(roster, useSessions, actions);+ const ourWidth = layout.left === "rail" ? RAIL_WIDTH : frameSnap.sidebarWidth;+ const pushed = layout.left === "open" ? frameSnap.sidebarWidth : RAIL_WIDTH;+ (0, import_react15.useLayoutEffect)(() => {+ if (typeof document === "undefined") return;+ chatRoom.setLeft(mode === "inline" ? null : Math.max(0, pushed - (frameSnap.collapsedWidth ?? 0)));+ }, [mode, pushed, frameSnap.collapsedWidth]);+ (0, import_react15.useEffect)(() => () => {+ if (typeof document !== "undefined") chatRoom.setLeft(null);+ }, []);+ const dsh = (0, import_react15.useRef)(null);+ const requested = (0, import_react15.useRef)(false);+ const requestLapse = (0, import_react15.useRef)(0);++ const [lapsed, setLapsed] = (0, import_react15.useState)(0);+ (0, import_react15.useEffect)(() => () => clearTimeout(requestLapse.current), []);+ const resizedAt = (0, import_react15.useRef)(0);+ (0, import_react15.useEffect)(() => {+ const onResize = () => {+ resizedAt.current = performance.now();+ };+ window.addEventListener("resize", onResize);+ return () => window.removeEventListener("resize", onResize);+ }, []);+ (0, import_react15.useLayoutEffect)(() => {+ if (typeof document === "undefined" || typeof actions.toggleSidebar !== "function") return void 0;+ const collapsed = dshCollapsed() ?? !wide;+ const prev = dsh.current;+ const viewport = window.innerWidth;+ dsh.current = { collapsed, viewport, left: layout.left };+ if (prev !== null && collapsed !== prev.collapsed) {+ if (requested.current) requested.current = false;+ else if (userSidebarToggle({ before: prev, after: { collapsed, viewport }, sinceResize: performance.now() - resizedAt.current })) {+ if (prev.left === "open") actions.setSidebarPref?.("rail");+ else {+ actions.setSidebarPref?.("open");+ if (frameSnap.viewport < frameSnap.sidebarWidth + MIN_CHAT) actions.setLeftDrawer?.(true);+ }+ actions.setPanelYield?.(false);+ return void 0;+ }+ }+ const wantOpen = dshExpandedFor(frameSnap.viewport, layout.left);+ if (collapsed === !wantOpen) {+ requested.current = false;+ return void 0;+ }+ if (requested.current) return void 0;+ requested.current = true;+ actions.toggleSidebar();+ clearTimeout(requestLapse.current);+ requestLapse.current = setTimeout(() => {+ requested.current = false;++ setLapsed((value) => value + 1);+ }, 300);+ return void 0;- }, [wide, frameSnap.viewport, frameSnap.sidebarWidth, layout.left]);++ }, [wide, frameSnap.viewport, frameSnap.sidebarWidth, layout.left, lapsed]);+ (0, import_react15.useEffect)(() => {+ if (mode !== "drawer") return void 0;+ const onDown = (event) => {+ if (event.target instanceof Element && event.target.closest(".bt-leftcol")) return;+ actions.setLeftDrawer?.(false);+ };+ const onKey = (event) => {+ if (event.key !== "Escape") return;+ event.stopPropagation();+ actions.setLeftDrawer?.(false);+ };+ window.addEventListener("mousedown", onDown);+ window.addEventListener("keydown", onKey, true);+ return () => {+ window.removeEventListener("mousedown", onDown);+ window.removeEventListener("keydown", onKey, true);+ };+ }, [mode]);const navigate = (open, id) => {const result = open(id);- if (wide && window.innerWidth < 1024 && !closing.current) {- closing.current = true;- expandSidebar?.();- actions.toggleSidebar();- }+ if (uiNow.leftDrawer === true) actions.setLeftDrawer?.(false);return result;};const rowActions = {@@@ -9152,63 -8875,24 +9202,62 @@@event.preventDefault();actions.openPalette(event.key);};- return (0, import_react15.createElement)(+ const expandLeft = () => {+ actions.setPanelYield?.(false);+ actions.setSidebarPref?.("open");+ if (frameSnap.viewport < frameSnap.sidebarWidth + MIN_CHAT) actions.setLeftDrawer?.(true);+ };+ const onTitleToggle = () => {+ if (layout.left === "open") {+ actions.setLeftDrawer?.(false);+ actions.setSidebarPref?.("rail");+ } else if (layout.left === "drawer") actions.setLeftDrawer?.(false);+ else expandLeft();+ };+ const toggleRef = (0, import_react15.useRef)(onTitleToggle);+ toggleRef.current = onTitleToggle;+ (0, import_react15.useEffect)(() => {+ const onKey = (event) => {+ if (event.defaultPrevented || event.isComposing || !pressesShellShortcut(event, "sidebar.left.toggle")) return;+ if (event.target instanceof Element && event.target.closest(".xterm")) return;+ if (document.querySelector('[aria-modal="true"]')) return;+ event.preventDefault();+ event.stopPropagation();+ toggleRef.current();+ };+ document.addEventListener("keydown", onKey, true);+ return () => document.removeEventListener("keydown", onKey, true);+ }, []);+ const top = wideContent ? (0, import_react15.createElement)("div",- { className: wide ? "bt-side" : "bt-side bt-rail", onKeyDown: typeToSearch },- wide ? (0, import_react15.createElement)(- "div",- { className: "bt-side-top" },- (0, import_react15.createElement)("span", { className: "bt-brand" }, (0, import_react15.createElement)(BrandMark, { size: 22 }), (0, import_react15.createElement)(BrandName)),- (0, import_react15.createElement)(UpdateButton, { useUpdate: props.useUpdate, actions }),- (0, import_react15.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("Search"), title: t("Search"), onClick: () => actions.openPalette() }, (0, import_react15.createElement)(SearchIcon)),- (0, import_react15.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("New…"), title: t("New…"), onClick: () => actions.openNewChat("new") }, (0, import_react15.createElement)(PlusIcon)),- (0, import_react15.createElement)("button", { type: "button", className: "bt-round bt-side-collapse", "aria-label": t("Collapse sidebar"), title: t("Collapse sidebar"), onClick: () => actions.toggleSidebar() }, (0, import_react15.createElement)(SidebarIcon))- ) : (0, import_react15.createElement)(- import_react15.Fragment,- null,- (0, import_react15.createElement)(UpdateButton, { useUpdate: props.useUpdate, actions }),- (0, import_react15.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("New…"), title: t("New…"), onClick: () => actions.openNewChat("new") }, (0, import_react15.createElement)(PlusIcon))- ),- wide && roster.readOnly ? (0, import_react15.createElement)("div", { className: "bt-hint bt-read-only", role: "status" }, hostText(roster.readOnly)) : null,+ { className: "bt-side-top" },+ (0, import_react15.createElement)("span", { className: "bt-brand" }, (0, import_react15.createElement)(BrandMark, { size: 22 }), (0, import_react15.createElement)(BrandName)),+ (0, import_react15.createElement)(UpdateButton, { useUpdate: props.useUpdate, actions }),+ (0, import_react15.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("Search"), title: t("Search"), onClick: () => actions.openPalette() }, (0, import_react15.createElement)(SearchIcon)),+ (0, import_react15.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("New…"), title: t("New…"), onClick: () => actions.openNewChat("new") }, (0, import_react15.createElement)(PlusIcon)),+ (0, import_react15.createElement)("button", { type: "button", className: "bt-round bt-side-collapse", "aria-label": t("Collapse sidebar"), title: t("Collapse sidebar"), onClick: () => {+ actions.setLeftDrawer?.(false);+ actions.setSidebarPref?.("rail");+ } }, (0, import_react15.createElement)(SidebarIcon))+ ) : (0, import_react15.createElement)(+ "div",+ { className: "bt-rail-top" },+ (0, import_react15.createElement)(UpdateButton, { useUpdate: props.useUpdate, actions }),+ (0, import_react15.createElement)("button", { type: "button", className: "bt-round bt-rail-expand", "aria-label": t("Expand sidebar"), title: t("Expand sidebar"), onClick: expandLeft }, (0, import_react15.createElement)(SidebarIcon)),+ main ? (0, import_react15.createElement)(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : (0, import_react15.createElement)("div", { className: "bt-hint" }, t("Setting up your Main Bot…")),+ (0, import_react15.createElement)("span", { className: "bt-rail-sep", "aria-hidden": true })+ );- const foot = mode === "inline" ? null : wideContent ? (0, import_react15.createElement)("div", { className: "bt-leftcol-foot" }, (0, import_react15.createElement)(AccountLauncher, { seat: false, actions }), (0, import_react15.createElement)(ConnectPlugins, { wide: true, actions })) : (0, import_react15.createElement)(++ const foot = mode === "inline" ? null : wideContent ? (0, import_react15.createElement)("div", { className: "bt-leftcol-foot" }, (0, import_react15.createElement)(AccountLauncher, { seat: false, actions })) : (0, import_react15.createElement)(+ "div",+ { className: "bt-leftcol-foot bt-leftcol-foot-rail" },+ (0, import_react15.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("New…"), title: t("New…"), onClick: () => actions.openNewChat("new") }, (0, import_react15.createElement)(PlusIcon)),- (0, import_react15.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("Connect plugins"), title: t("Connect plugins"), onClick: () => actions.selectPanel("plugins") }, (0, import_react15.createElement)(PlugIcon)),+ (0, import_react15.createElement)(AccountLauncher, { seat: false, actions })+ );+ const content = (0, import_react15.createElement)(+ "div",+ { className: wideContent ? "bt-side" : "bt-side bt-rail", onKeyDown: typeToSearch },+ top,+ wideContent && roster.readOnly ? (0, import_react15.createElement)("div", { className: "bt-hint bt-read-only", role: "status" }, hostText(roster.readOnly)) : null,(0, import_react15.createElement)("div",{ ref: listRef, className: "bt-list", role: "region", "aria-label": t("Bot list") },@@@ -17621,23 -17548,25 +17819,23 @@@ function BotPanel({ pane, leaving, roomconst active = tabState.active;const page = useBrowserPages((pages) => (active ? pages[active] : null) ?? EMPTY_PAGE);const hold = useBrowserHolds?.((map) => bot ? map[bot.id] ?? null : null) ?? null;- const root = (0, import_react43.useRef)(null);- const fly = (0, import_react43.useRef)(null);- const [landed, setLanded] = (0, import_react43.useState)(false);- const [settling, setSettling] = (0, import_react43.useState)(false);- const [width, setWidth] = (0, import_react43.useState)(savedWidth);- const [dragging, setDragging] = (0, import_react43.useState)(false);- const [resizing, setResizing] = (0, import_react43.useState)(false);+ const root = (0, import_react44.useRef)(null);+ const fly = (0, import_react44.useRef)(null);+ const [landed, setLanded] = (0, import_react44.useState)(false);+ const [settling, setSettling] = (0, import_react44.useState)(false);+ const [width, setWidth] = (0, import_react44.useState)(savedWidth);- const [viewport, setViewport] = (0, import_react44.useState)(() => window.innerWidth);+ const [dragging, setDragging] = (0, import_react44.useState)(false);+ const [resizing, setResizing] = (0, import_react44.useState)(false);const instant = dragging || resizing;- const [reading, setReading] = (0, import_react43.useState)(false);+ const [reading, setReading] = (0, import_react44.useState)(false);- const overlay = overlayAt(view, viewport);- const panelWidth = fitWidth(width ?? (view === "browser" ? DEFAULT_WIDTH : DETAILS_WIDTH), widthRange(view, viewport));+ const panelWidth = fitWidth(width ?? (view === "browser" ? DEFAULT_WIDTH : DETAILS_WIDTH), widthRange(view, room2));- (0, import_react43.useLayoutEffect)(() => {+ (0, import_react44.useLayoutEffect)(() => {if (view === "browser" && width === null) setWidth(DEFAULT_WIDTH);}, [view, width]);- (0, import_react43.useLayoutEffect)(() => {+ (0, import_react44.useLayoutEffect)(() => {chatRoom.hold(instant);}, [instant]);- const [last, setLast] = (0, import_react43.useState)({ view, width: panelWidth });+ const [last, setLast] = (0, import_react44.useState)({ view, width: panelWidth });if (last.view !== view || last.width !== panelWidth) {setLast({ view, width: panelWidth });if (last.view !== view) setSettling(last.width !== panelWidth && !instant);@@@ -17647,24 -17576,28 +17845,24 @@@const switched = settling && shownView.current !== view;shownView.current = view;if (switched) chatRoom.hold(true);- chatRoom.set(leaving || overlay ? null : panelWidth);+ chatRoom.setRight(leaving || overlay ? null : panelWidth);if (switched) chatRoom.hold(false);}, [view, panelWidth, leaving, overlay]);- (0, import_react43.useEffect)(() => () => {+ (0, import_react44.useEffect)(() => () => {- chatRoom.set(null);+ chatRoom.setRight(null);chatRoom.hold(false);}, []);- const mounted = (0, import_react43.useRef)(false);- (0, import_react43.useEffect)(() => {++ const mounted = (0, import_react44.useRef)(false);+ (0, import_react44.useEffect)(() => {- let timer;- const onResize = () => {- setResizing(true);- setViewport(window.innerWidth);- clearTimeout(timer);- timer = setTimeout(() => setResizing(false), 160);- };- window.addEventListener("resize", onResize);- return () => {- clearTimeout(timer);- window.removeEventListener("resize", onResize);- };- }, []);+ if (!mounted.current) {+ mounted.current = true;+ return void 0;+ }+ setResizing(true);+ const timer = setTimeout(() => setResizing(false), 160);+ return () => clearTimeout(timer);+ }, [room2]);- (0, import_react43.useEffect)(() => {+ (0, import_react44.useEffect)(() => {if (!settling) return void 0;const timer = setTimeout(() => setSettling(false), SPRING_SHAPE.duration + 40);return () => clearTimeout(timer);@@@ -17989,28 -17922,18 +18187,28 @@@ function Overlays({ useRoster, useUi, uconst roster = useRoster((value) => value);const ui2 = useUi((value) => value);useRegistry((value) => value);+ const frameSnap = useFrame ? useFrame((value) => value) : { viewport: window.innerWidth, sidebarWidth: FALLBACK_SIDEBAR_WIDTH, collapsedWidth: 0 };+ const pref = useSidebarPref ? useSidebarPref((value) => value) : "open";const current = useSessions((list) => Object.values(list.byId).find((session) => (session?.retainedBy?.mainView ?? 0) > 0)?.id ?? null);- const previous = (0, import_react44.useRef)(current);- (0, import_react44.useEffect)(() => {+ const previous = (0, import_react45.useRef)(current);+ (0, import_react45.useEffect)(() => {if (previous.current === current) return;previous.current = current;if (current) actions.followPanel?.(current);}, [current]);const open = ui2.details ? { id: ui2.details, view: ui2.view ?? "details", renaming: ui2.renaming, tab: ui2.tab, side: ui2.side } : null;- const [kept, setKept] = (0, import_react45.useState)(open);+ const layout = frameLayout({+ viewport: frameSnap.viewport,+ sidebarWidth: frameSnap.sidebarWidth,+ pref,+ drawer: ui2.leftDrawer === true,+ panel: open ? { view: open.view, yielded: ui2.panelYield === true } : null+ });+ const shown = open !== null && layout.panel !== "folded" ? open : null;- const [kept, setKept] = (0, import_react44.useState)(shown);- (0, import_react44.useEffect)(() => {++ const [kept, setKept] = (0, import_react45.useState)(shown);+ (0, import_react45.useEffect)(() => {- if (open) {- setKept(open);+ if (shown) {+ setKept(shown);return void 0;}const timer = setTimeout(() => setKept(null), PANEL_LINGER_MS);@@@ -18027,17 -17950,17 +18225,17 @@@const [memory, memoryLeaving] = useLinger(ui2.memory && memoryOwner(ui2.memory) ? ui2.memory : null, DIALOG_EXIT_MS);const owner = memory ? memoryOwner(memory) : null;const [menu, menuLeaving] = useLinger(ui2.menu, MENU_EXIT_MS3);- return (0, import_react44.createElement)(- import_react44.Fragment,+ return (0, import_react45.createElement)(+ import_react45.Fragment,null,- pane ? (0, import_react_dom9.createPortal)((0, import_react44.createElement)(BotPanel, { pane, leaving: shown === null, room: layout.room, overlay: layout.panel === "overlay", roster, actions, useSessions, useSessionStatus, useActivity, useWork, useBrowserTabs, useBrowserPages, useBrowserHolds }), document.body) : null,- ui2.newChat ? (0, import_react_dom9.createPortal)((0, import_react44.createElement)(NewChat, { key: ui2.newChat, mode: ui2.newChat, roster, actions }), document.body) : null,- ui2.palette ? (0, import_react_dom9.createPortal)((0, import_react44.createElement)(CommandPalette, { key: ui2.palette.token, start: ui2.palette.query, token: ui2.palette.token, roster, actions, useSessions }), document.body) : null,- ui2.exchange ? (0, import_react_dom9.createPortal)((0, import_react44.createElement)(ExchangeDialog, { pair: ui2.exchange, roster, actions }), document.body) : null,- ui2.voice ? (0, import_react_dom9.createPortal)((0, import_react44.createElement)(VoiceMode, { key: ui2.voice, sessionId: ui2.voice, roster, actions, useSessions, useSessionStatus }), document.body) : null,- menu ? (0, import_react_dom9.createPortal)((0, import_react44.createElement)(ContextMenu, { key: `${menu.kind ?? ""}:${menu.id}:${menu.x}:${menu.y}`, menu, roster, actions, leaving: menuLeaving }), document.body) : null,- settings ? (0, import_react_dom9.createPortal)((0, import_react44.createElement)(SettingsDialog, { page: settings.page, id: settings.id, roster, actions, useUpdate, leaving: settingsLeaving }), document.body) : null,- owner ? (0, import_react_dom9.createPortal)((0, import_react44.createElement)(MemoryDialog, { key: owner.id, owner, actions, leaving: memoryLeaving }), document.body) : null- pane ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(BotPanel, { pane, leaving: open === null, roster, actions, useSessions, useSessionStatus, useActivity, useWork, useBrowserTabs, useBrowserPages, useBrowserHolds }), document.body) : null,++ pane ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(BotPanel, { pane, leaving: shown === null, room: layout.room, overlay: layout.panel === "overlay", roster, actions, useSessions, useSessionStatus, useActivity, useWork, useBrowserTabs, useBrowserPages, useBrowserHolds }), document.body) : null,+ ui2.newChat ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(NewChat, { key: ui2.newChat, mode: ui2.newChat, roster, actions }), document.body) : null,+ ui2.palette ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(CommandPalette, { key: ui2.palette.token, start: ui2.palette.query, token: ui2.palette.token, roster, actions, useSessions }), document.body) : null,+ ui2.exchange ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(ExchangeDialog, { pair: ui2.exchange, roster, actions }), document.body) : null,+ ui2.voice ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(VoiceMode, { key: ui2.voice, sessionId: ui2.voice, roster, actions, useSessions, useSessionStatus }), document.body) : null,+ menu ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(ContextMenu, { key: `${menu.kind ?? ""}:${menu.id}:${menu.x}:${menu.y}`, menu, roster, actions, leaving: menuLeaving }), document.body) : null,+ settings ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(SettingsDialog, { page: settings.page, id: settings.id, roster, actions, useUpdate, leaving: settingsLeaving }), document.body) : null,+ owner ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(MemoryDialog, { key: owner.id, owner, actions, leaving: memoryLeaving }), document.body) : null);}diff --cc ds-bot/src/client/index.jsindex d86d921d,daf7dd4a..34c59061--- a/ds-bot/src/client/index.js+++ b/ds-bot/src/client/index.js@@@ -7,9 -7,7 +7,9 @@@ import { themeCss, shellTokens, registrimport { MENTION_ORIGIN, currentPart } from './text.js'import { SHELL_CSS, CONVERSATION_CSS, installStyles, installCompiledStyles } from './styles.js'import { lookOf } from './mark.js'- import { TeamSidebar, ConnectPlugins, YouAvatar, AccountLauncher, FooterAccount, BrandMark, BrandName, BotReturn, SIDEBAR_CSS, RETURN_CSS, holdShellShortcuts, openHarnessOnboarding, openHarnessSettings } from './sidebar.js'+ import { TeamSidebar, YouAvatar, AccountLauncher, FooterAccount, BrandMark, BrandName, BotReturn, SIDEBAR_CSS, RETURN_CSS, holdShellShortcuts, openHarnessOnboarding, openHarnessSettings } from './sidebar.js'+import { frameLayout, readSidebarPref, writeSidebarPref, FALLBACK_SIDEBAR_WIDTH } from './frame-layout.js'+import { installFrameWatch } from './frame-watch.js'import { HeaderPill } from './header.js'import { ComposerPlus, ComposerVoice, menuIcons } from './composer.js'import { CHATS_SOURCE, atSources } from './at-menu.js'diff --cc ds-bot/src/client/sidebar.jsindex 2238acc2,58d1840d..28b77d8e--- a/ds-bot/src/client/sidebar.js+++ b/ds-bot/src/client/sidebar.js@@@ -306,87 -272,18 +306,90 @@@ export function TeamSidebar(props)return entries.sort((a, b) => Number(Boolean(b.item.pinned)) - Number(Boolean(a.item.pinned)) || b.at - a.at)}, [roster, updated])const main = roster.byId[roster.mainBotId]- useListGlide(listRef, wide, order.map(entry => entry.item.id).join(','))+ useListGlide(listRef, wideContent, order.map(entry => entry.item.id).join(','))useLandOnMainBot(roster, useSessions, actions)- // The shell keeps wide content during its collapse fade. Normalize through its- // public expansion action before toggling; coalesce synchronous activations- // until React commits the result.++ // Our column pushes the conversation over by what it takes beyond the shell's+ // collapsed track; a drawer floats over the rail's place, so it pushes as much+ // as the rail and the chat stays put when it opens or closes.+ const ourWidth = layout.left === 'rail' ? RAIL_WIDTH : frameSnap.sidebarWidth+ const pushed = layout.left === 'open' ? frameSnap.sidebarWidth : RAIL_WIDTH+ useLayoutEffect(() => {+ if (typeof document === 'undefined') return+ chatRoom.setLeft(mode === 'inline' ? null : Math.max(0, pushed - (frameSnap.collapsedWidth ?? 0)))+ }, [mode, pushed, frameSnap.collapsedWidth])+ useEffect(() => () => { if (typeof document !== 'undefined') chatRoom.setLeft(null) }, [])++ // The shell sidebar's collapsed flag follows what our column needs. A flip we+ // did not ask for is the user's own switch gesture (the shell's title-bar+ // button or shortcut), unless the width just crossed the auto-collapse line.+ const dsh = useRef(null)+ const requested = useRef(false)+ // The request mark always lapses on its own: a re-render before the shell's+ // flip must not leave it set, or the user's next switch would read as ours.++ // A lapse checks the shell again, since our flip and another one landing in++ // the same frame cancel out and no flip arrives to settle it.+ const requestLapse = useRef(0)++ const [lapsed, setLapsed] = useState(0)+ useEffect(() => () => clearTimeout(requestLapse.current), [])+ // The window's own resize event lands before the shell's next-frame measure,+ // so it dates a width change even while our frame source still holds the old one.+ const resizedAt = useRef(0)+ useEffect(() => {+ const onResize = () => { resizedAt.current = performance.now() }+ window.addEventListener('resize', onResize)+ return () => window.removeEventListener('resize', onResize)+ }, [])+ useLayoutEffect(() => {+ if (typeof document === 'undefined' || typeof actions.toggleSidebar !== 'function') return undefined+ const collapsed = dshCollapsed() ?? !wide+ const prev = dsh.current+ const viewport = window.innerWidth+ dsh.current = { collapsed, viewport, left: layout.left }+ if (prev !== null && collapsed !== prev.collapsed) {+ if (requested.current) requested.current = false+ else if (userSidebarToggle({ before: prev, after: { collapsed, viewport }, sinceResize: performance.now() - resizedAt.current })) {+ // The last explicit gesture wins: fold to the rail, or open the column —+ // as a drawer when it no longer fits docked.+ if (prev.left === 'open') actions.setSidebarPref?.('rail')+ else {+ actions.setSidebarPref?.('open')+ if (frameSnap.viewport < frameSnap.sidebarWidth + MIN_CHAT) actions.setLeftDrawer?.(true)+ }+ actions.setPanelYield?.(false)+ return undefined+ }+ }+ const wantOpen = dshExpandedFor(frameSnap.viewport, layout.left)+ if (collapsed === !wantOpen) { requested.current = false; return undefined }+ if (requested.current) return undefined+ requested.current = true+ actions.toggleSidebar()+ clearTimeout(requestLapse.current)- requestLapse.current = setTimeout(() => { requested.current = false }, 300)++ requestLapse.current = setTimeout(() => { requested.current = false; setLapsed(value => value + 1) }, 300)+ return undefined- }, [wide, frameSnap.viewport, frameSnap.sidebarWidth, layout.left])++ }, [wide, frameSnap.viewport, frameSnap.sidebarWidth, layout.left, lapsed])++ // The drawer closes on a row pick, on Escape and on a press outside it.+ useEffect(() => {+ if (mode !== 'drawer') return undefined+ const onDown = (event) => {+ if (event.target instanceof Element && event.target.closest('.bt-leftcol')) return+ actions.setLeftDrawer?.(false)+ }+ const onKey = (event) => {+ if (event.key !== 'Escape') return+ event.stopPropagation()+ actions.setLeftDrawer?.(false)+ }+ window.addEventListener('mousedown', onDown)+ window.addEventListener('keydown', onKey, true)+ return () => { window.removeEventListener('mousedown', onDown); window.removeEventListener('keydown', onKey, true) }+ }, [mode])+const navigate = (open, id) => {const result = open(id)- if (wide && window.innerWidth < 1024 && !closing.current) {- closing.current = true- expandSidebar?.()- actions.toggleSidebar()- }+ if (uiNow.leftDrawer === true) actions.setLeftDrawer?.(false)return result}const rowActions = {@@@ -404,60 -301,19 +407,59 @@@event.preventDefault()actions.openPalette(event.key)}- return h('div', { className: wide ? 'bt-side' : 'bt-side bt-rail', onKeyDown: typeToSearch },- wide ? h('div', { className: 'bt-side-top' },- h('span', { className: 'bt-brand' }, h(BrandMark, { size: 22 }), h(BrandName)),- h(UpdateButton, { useUpdate: props.useUpdate, actions }),- h('button', { type: 'button', className: 'bt-round', 'aria-label': t('Search'), title: t('Search'), onClick: () => actions.openPalette() }, h(SearchIcon)),- h('button', { type: 'button', className: 'bt-round', 'aria-label': t('New…'), title: t('New…'), onClick: () => actions.openNewChat('new') }, h(PlusIcon)),- h('button', { type: 'button', className: 'bt-round bt-side-collapse', 'aria-label': t('Collapse sidebar'), title: t('Collapse sidebar'), onClick: () => actions.toggleSidebar() }, h(SidebarIcon)))- : h(Fragment, null,- h(UpdateButton, { useUpdate: props.useUpdate, actions }),- h('button', { type: 'button', className: 'bt-round', 'aria-label': t('New…'), title: t('New…'), onClick: () => actions.openNewChat('new') }, h(PlusIcon))),- wide && roster.readOnly ? h('div', { className: 'bt-hint bt-read-only', role: 'status' }, hostText(roster.readOnly)) : null,+ // Opening the column is the latest explicit gesture: it takes back the room a+ // yielded panel had, and opens as a drawer when it cannot dock.+ const expandLeft = () => {+ actions.setPanelYield?.(false)+ actions.setSidebarPref?.('open')+ if (frameSnap.viewport < frameSnap.sidebarWidth + MIN_CHAT) actions.setLeftDrawer?.(true)+ }+ const onTitleToggle = () => {+ if (layout.left === 'open') { actions.setLeftDrawer?.(false); actions.setSidebarPref?.('rail') }+ else if (layout.left === 'drawer') actions.setLeftDrawer?.(false)+ else expandLeft()+ }+ // The shell's sidebar shortcut is caught on its way down, before the shell's+ // own listener on window sees it: left to the shell, it would expand the shell's+ // sidebar first and our sync would pull it back, a visible flash.+ const toggleRef = useRef(onTitleToggle)+ toggleRef.current = onTitleToggle+ useEffect(() => {+ const onKey = (event) => {+ if (event.defaultPrevented || event.isComposing || !pressesShellShortcut(event, 'sidebar.left.toggle')) return+ if (event.target instanceof Element && event.target.closest('.xterm')) return+ if (document.querySelector('[aria-modal="true"]')) return+ event.preventDefault()+ event.stopPropagation()+ toggleRef.current()+ }+ document.addEventListener('keydown', onKey, true)+ return () => document.removeEventListener('keydown', onKey, true)+ }, [])+ const top = wideContent+ ? h('div', { className: 'bt-side-top' },+ h('span', { className: 'bt-brand' }, h(BrandMark, { size: 22 }), h(BrandName)),+ h(UpdateButton, { useUpdate: props.useUpdate, actions }),+ h('button', { type: 'button', className: 'bt-round', 'aria-label': t('Search'), title: t('Search'), onClick: () => actions.openPalette() }, h(SearchIcon)),+ h('button', { type: 'button', className: 'bt-round', 'aria-label': t('New…'), title: t('New…'), onClick: () => actions.openNewChat('new') }, h(PlusIcon)),+ h('button', { type: 'button', className: 'bt-round bt-side-collapse', 'aria-label': t('Collapse sidebar'), title: t('Collapse sidebar'), onClick: () => { actions.setLeftDrawer?.(false); actions.setSidebarPref?.('rail') } }, h(SidebarIcon)))+ : h('div', { className: 'bt-rail-top' },+ h(UpdateButton, { useUpdate: props.useUpdate, actions }),+ h('button', { type: 'button', className: 'bt-round bt-rail-expand', 'aria-label': t('Expand sidebar'), title: t('Expand sidebar'), onClick: expandLeft }, h(SidebarIcon)),+ main ? h(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : h('div', { className: 'bt-hint' }, t('Setting up your Main Bot…')),+ h('span', { className: 'bt-rail-sep', 'aria-hidden': true }))- // The foot stands in for the shell's hidden footer: the account avatar, then- // Connect plugins as its row, and on the rail the new-chat and plug buttons.++ // The foot stands in for the shell's hidden footer: the account avatar, and on++ // the rail the new-chat button above it.+ const foot = mode === 'inline' ? null : wideContent- ? h('div', { className: 'bt-leftcol-foot' }, h(AccountLauncher, { seat: false, actions }), h(ConnectPlugins, { wide: true, actions }))++ ? h('div', { className: 'bt-leftcol-foot' }, h(AccountLauncher, { seat: false, actions }))+ : h('div', { className: 'bt-leftcol-foot bt-leftcol-foot-rail' },+ h('button', { type: 'button', className: 'bt-round', 'aria-label': t('New…'), title: t('New…'), onClick: () => actions.openNewChat('new') }, h(PlusIcon)),- h('button', { type: 'button', className: 'bt-round', 'aria-label': t('Connect plugins'), title: t('Connect plugins'), onClick: () => actions.selectPanel('plugins') }, h(PlugIcon)),+ h(AccountLauncher, { seat: false, actions }))+ const content = h('div', { className: wideContent ? 'bt-side' : 'bt-side bt-rail', onKeyDown: typeToSearch },+ top,+ wideContent && roster.readOnly ? h('div', { className: 'bt-hint bt-read-only', role: 'status' }, hostText(roster.readOnly)) : null,h('div', { ref: listRef, className: 'bt-list', role: 'region', 'aria-label': t('Bot list') },- main ? h(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : h('div', { className: 'bt-hint' }, t('Setting up your Main Bot…')),+ wideContent ? (main ? h(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : h('div', { className: 'bt-hint' }, t('Setting up your Main Bot…'))) : null,order.map(entry => (entry.kind === 'bot'? h(BotRow, { key: entry.item.id, ...rowProps, bot: entry.item, marked: markedUnread[entry.item.id] === true }): entry.kind === 'room'diff --cc ds-bot/src/client/styles.jsindex 49120478,aa38a3bc..ff4fd8ad--- a/ds-bot/src/client/styles.js+++ b/ds-bot/src/client/styles.js@@@ -150,33 -145,9 +145,29 @@@ body[data-bt-motion=quiet] .bt-mark[dat.bt-row-preview{font-size:13px;line-height:18px;color:var(--bt-ink-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.bt-unread{width:8px;height:8px;border-radius:50%;background:var(--bt-accent);flex:none;margin-right:2px;animation:bt-fade .13s cubic-bezier(.22,1,.36,1)}.bt-unread-wait{background:var(--bt-star)}-.bt-rail{align-items:center;padding:0 0 8px}-.bt-rail .bt-row{justify-content:center;padding:6px 0;min-height:44px}+/* Our own left column, portalled over the shell's collapsed sidebar. It reaches+ the window's top edge so the title band and the column share one fill (under+ Mica the app styles DSH's sidebar the same way, via --bt-leftcol-fill there);+ it stays under the shell's title-bar switch (z 30) and the popovers (z 60),+ and the floating drawer keeps the opaque fill over the conversation. */+.bt-leftcol{position:fixed;left:0;top:0;bottom:0;z-index:25;display:flex;--bt-lc-clear:var(--dsh-frame-top-clearance,var(--dsh-windows-titlebar-height,0px));background:var(--bt-leftcol-fill,var(--bt-sidebar));border-right:.5px solid var(--bt-line);box-sizing:border-box;padding:calc(var(--bt-lc-clear) + 6px) 12px 6px;color:var(--bt-ink);font-family:var(--bt-font)}+html[data-windows-titlebar] .bt-leftcol,html[data-platform=darwin] .bt-leftcol{border-right:none}+.bt-leftcol[data-left=drawer]{background:var(--bt-sidebar);box-shadow:8px 0 24px rgba(0,0,0,.14)}+.bt-leftcol>.bt-side{width:100%}+.bt-leftcol-foot{display:flex;align-items:center;gap:9px;padding-top:8px;flex:none}+.bt-rail{align-items:center;padding:0}+.bt-rail .bt-row{justify-content:center;width:56px;height:56px;min-height:56px;padding:0;border-radius:16px}+.bt-rail-top{display:flex;flex-direction:column;align-items:center;gap:6px;padding-bottom:8px}+.bt-rail-sep{width:24px;height:1px;flex:none;background:var(--bt-line)}+.bt-rail .bt-agent-ava{width:44px;height:44px}+.bt-rail .bt-list{align-self:stretch;align-items:center;gap:4px}+/* The rail's list spans the whole column: the badges and dots that sit on a row's+ edge need room beside the 56px rows, or the list scrolls sideways. */+.bt-leftcol[data-left=rail]{padding:calc(var(--bt-lc-clear) + 8px) 0 8px}+.bt-leftcol-foot-rail{flex-direction:column;gap:6px}+.bt-dot{position:absolute;top:4px;right:8px;width:8px;height:8px;border-radius:50%;background:var(--bt-accent);box-shadow:0 0 0 1.5px var(--bt-sidebar)}+.bt-dot-wait{background:var(--bt-star)}.bt-side-foot{display:flex;padding-top:8px}- .bt-connect{flex:1;height:36px;border-radius:999px;border:1px solid var(--bt-line);background:var(--bt-main);color:var(--bt-ink);font-family:inherit;font-size:14px;line-height:20px;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px;transition:background-color .12s ease}- .bt-connect:hover{background:var(--bt-hover)}- .bt-connect svg{flex:none;width:15px;height:15px}- .bt-connect-wrap{position:relative;display:flex;flex:1 1 auto;min-width:0}.bt-head{position:relative;display:flex;justify-content:center;align-items:center;height:40px;flex:none;pointer-events:none}.bt-pill{pointer-events:auto;display:inline-flex;align-items:center;gap:8px;height:40px;padding:7.5px 13.5px 7.5px 7.5px;border-radius:999px;background:var(--bt-main);border:.5px solid var(--bt-line-2);box-shadow:0 2px 8px -1px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.04);color:var(--bt-ink);font-family:inherit;font-size:14px;line-height:20px;cursor:pointer;max-width:70%;box-sizing:border-box;transition:background-color .12s ease,transform ${SPRING_TAP.duration}ms ${SPRING_TAP.easing}}@@@ -577,17 -548,10 +568,17 @@@ button.bt-set-row:hover{background:var(the sidebar is open. Elsewhere an open sidebar uses the team's own top row. */html:not([data-windows-titlebar]) :not([class*="_collapsed"])>[class*="_logoRow"]{display:none!important}html[data-windows-titlebar] :not([class*="_collapsed"])>[class*="_logoRow"]{height:0!important;margin:0!important}-html[data-windows-titlebar] .bt-side-collapse,html[data-platform=darwin] .bt-side-collapse{display:none}+html[data-windows-titlebar] :is(.bt-side-collapse,.bt-rail-expand),html[data-platform=darwin] :is(.bt-side-collapse,.bt-rail-expand){display:none}+/* Under a Windows title bar our own switch replaces the shell's: the shell's+ toggle expands the shell sidebar first, and pulling it back afterwards is a+ visible flash of the shell's column. */+html[data-windows-titlebar] [class*="_logoRow"]>[class*="_toggle"]{display:none!important}+.bt-title-toggle{display:none;position:fixed;left:12px;top:calc((var(--dsh-windows-titlebar-height,0px) - 28px) / 2);width:28px;height:28px;z-index:30;-webkit-app-region:no-drag;align-items:center;justify-content:center;border:0;border-radius:6px;padding:0;background:transparent;color:var(--bt-ink);cursor:pointer;font-family:var(--bt-font)}+html[data-windows-titlebar] .bt-title-toggle{display:inline-flex}+.bt-title-toggle:hover{background:var(--bt-hover)}- /* The footer ends in the Bot row: the whale's settings seat, then Connect plugins. Every- other plugin's entry takes a whole row above it, in the shell's order, so none of them- squeezes the Bot row. */+ /* The footer ends in the Bot row: the whale's settings seat, then the account menu+ when no plugin holds that seat. Every other plugin's entry takes a whole row above+ it, in the shell's order, so none of them squeezes the Bot row. */[class*="_footArea"]{grid-template-columns:auto minmax(0,1fr);grid-auto-flow:row dense;align-items:center;gap:4px 9px;padding:8px 6px 6px!important}/* DSH hides the footer of a collapsed sidebar under a Windows title bar; the gridstays out of that one place. */