A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Keep one right panel open at a time
Fei24116f3cb7cc8065
diff --git a/ds-bot/client.js b/ds-bot/client.jsindex 116f6c74..32c23474 100644--- a/ds-bot/client.js+++ b/ds-bot/client.js@@ -741,8 +741,7 @@ var ZH = {"Updating memory": "正在更新记忆","Checking memory": "正在查看记忆","Memory updated": "记忆已更新",- "Show or hide the right sidebar": "显示或隐藏右侧栏",- "Right sidebar": "右侧栏",+ "New terminal": "新建终端","Team memory updated": "团队记忆已更新","Updated {name}'s memory": "已更新 {name} 的记忆","Memory updated. Open {name}'s memory": "记忆已更新,打开 {name} 的记忆",@@ -2390,8 +2389,6 @@ body[data-bt-motion=quiet] .bt-mark[data-poke]{cursor:default}.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}}.bt-pill:hover{background:color-mix(in srgb,var(--bt-main),#777 9%)}-.bt-head-side{position:absolute;right:12px;top:4px;width:32px;height:32px;border-radius:8px;pointer-events:auto;transition:background-color .12s ease}-.bt-head-side:hover{background:color-mix(in srgb,var(--bt-main),#777 12%);color:var(--bt-ink)}.bt-pill:active{transform:scale(.965)}.bt-pill-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500}.bt-pill-mem{flex:none;display:inline-flex;width:0;margin-left:-8px;overflow:hidden;transition:${spring(SPRING_SHAPE, "width", "margin-left")}}@@ -3697,7 +3694,7 @@ var TrashIcon = lineIcon(["M3.5 5.5h13", "M8 5.5V4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1var DuplicateIcon = lineIcon(["M7 7h8.5v9.5H7z", "M4.5 13V3.5H13", "M11.25 9.5v4.5M9 11.75h4.5"]);var SlidersIcon = lineIcon(["M4 6.5h5M12.5 6.5H16M4 13.5h4M11.5 13.5H16", "M10.5 4.5v4M9.5 11.5v4"]);var MemoryIcon = lineIcon(["M5.5 3.5h8A1.5 1.5 0 0 1 15 5v10a1.5 1.5 0 0 1-1.5 1.5h-8z", "M5.5 3.5v13", "M8.5 7.5h3.5M8.5 10.5h2.5", "M12 3.5v4l1-.8 1 .8"]);-var SidePanelIcon = lineIcon(["M4.5 4h11A1.5 1.5 0 0 1 17 5.5v9a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 14.5v-9A1.5 1.5 0 0 1 4.5 4z", "M12.5 4v12"]);+var TerminalIcon = lineIcon(["M4.5 4h11A1.5 1.5 0 0 1 17 5.5v9a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 14.5v-9A1.5 1.5 0 0 1 4.5 4z", "M6.5 8l2.5 2.5L6.5 13", "M11 13h3.5"]);var FolderIcon = lineIcon(["M3 6A1.5 1.5 0 0 1 4.5 4.5h3.2l1.8 2h6A1.5 1.5 0 0 1 17 8v6.5a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 14.5z"]);var ChatsIcon = lineIcon(["M3.5 5.5A1.5 1.5 0 0 1 5 4h7a1.5 1.5 0 0 1 1.5 1.5V10A1.5 1.5 0 0 1 12 11.5H8L5 14v-2.5A1.5 1.5 0 0 1 3.5 10z", "M13.5 7.5H15A1.5 1.5 0 0 1 16.5 9v4.5A1.5 1.5 0 0 1 15 15v2l-2.5-2h-3A1.5 1.5 0 0 1 8 13.5V13"]);var SETTINGS_ICONS = { general: GearIcon, bots: PeopleIcon, groups: ChatsIcon, usage: GaugeIcon };@@ -7691,9 +7688,7 @@ function HeaderPill({ sessionId, useRoster, useSessions, useSessionStatus, useSe),(0, import_react13.createElement)("span", { className: "bt-sr", role: "status" }, memoryNotice ? t("Memory updated") : ""),(0, import_react13.createElement)(NewMessagePills, { key: sessionId, sessionId, useSessions, useUi, useTurnClock }),- (0, import_react13.createElement)(ActivityIndicator, { key: `activity:${sessionId}`, sessionId, useRoster, useSessionStatus, useSession, useLive, useWork, actions }),- // DSH's way into its right sidebar sits in the session header this pill replaces.- actions.hasRightSidebar?.() ? (0, import_react13.createElement)("button", { type: "button", className: "bt-icon-btn bt-head-side", "data-bt-right-sidebar": "", "aria-label": t("Show or hide the right sidebar"), title: t("Right sidebar"), onClick: () => actions.toggleRightSidebar() }, (0, import_react13.createElement)(SidePanelIcon)) : null+ (0, import_react13.createElement)(ActivityIndicator, { key: `activity:${sessionId}`, sessionId, useRoster, useSessionStatus, useSession, useLive, useWork, actions }));}function useTranscriptView() {@@ -14314,6 +14309,7 @@ function DetailsDrawer({ sessionId, startRenaming, startTab, hasStrip, roster, a{ className: "bt-drawer-top", "data-move": side },bot || room2 ? (0, import_react37.createElement)("button", { type: "button", className: "bt-round", "aria-label": bot ? t("Edit Bot") : t("Group settings"), title: bot ? t("Edit Bot") : t("Group settings"), "data-info-row": "settings", onClick: () => setView("settings") }, (0, import_react37.createElement)(GearIcon)) : null,bot && roster.browser === true && actions.openBrowser ? (0, import_react37.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("Open browser"), title: t("Open this Bot's browser"), onClick: () => actions.openBrowser(sessionId) }, (0, import_react37.createElement)(GlobeIcon)) : null,+ bot || room2 ? actions.canOpenTerminal?.() ? (0, import_react37.createElement)("button", { type: "button", className: "bt-round", "data-info-row": "terminal", "aria-label": t("New terminal"), title: t("New terminal"), onClick: () => actions.newTerminal() }, (0, import_react37.createElement)(TerminalIcon)) : null : null,bot || room2 ? (0, import_react37.createElement)("button", { type: "button", className: "bt-round", "aria-label": copied ? t("Copied conversation") : t("Share conversation"), title: copied ? t("Copied") : t("Copy conversation as Markdown"), onClick: share }, copied ? (0, import_react37.createElement)("span", { key: "copied", className: "bt-pop-in" }, "✓") : (0, import_react37.createElement)(ShareIcon)) : null,hasStrip ? null : (0, import_react37.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("Close details"), onClick: close }, (0, import_react37.createElement)(CloseIcon)));@@ -16178,6 +16174,21 @@ function serveBrowserReads({ browsers, post, clientId = globalThis.crypto.random};}+// src/client/right-panel.js+var RIGHTBAR_ATTRIBUTES = ["data-rightbar-collapsed", "data-rightbar-fullscreen"];+function rightColumnOpen(doc) {+ if (doc.querySelector("[data-rightbar-fullscreen]")) return true;+ if (doc.querySelector("[data-rightbar-collapsed]")) return false;+ return doc.querySelector("[data-rightbar-col]") !== null;+}+function drawerOpened(columnOpen) {+ return columnOpen ? "collapse-column" : null;+}+function columnOpened(drawerOpen, moved) {+ if (!drawerOpen) return null;+ return moved ? "collapse-column" : "close-drawer";+}+// src/client/user-message.jsvar import_react40 = require("react");var ui = __toESM(require("@deepseek-ai/dsh-client-ui-primitives"), 1);@@ -16840,16 +16851,7 @@ function apply(ctx) {const reactions = reactionStore.update((saved) => toggleReaction(saved, key, index, emoji), ui2.getSnapshot().reactions);ui2.set((state) => ({ ...state, reactions }));},- clearUnread: (id) => writeUnread(id, false),- // DSH's right sidebar (files, terminals), which a plugin may load after this one.- hasRightSidebar: () => ctx.get("sidebarRight") !== void 0,- toggleRightSidebar: () => {- try {- ctx.get("sidebarRight")?.toggleExpanded();- } catch (error) {- actions.reportError(error, "right-sidebar");- }- }+ clearUnread: (id) => writeUnread(id, false)};if (browsers) {Object.assign(actions, {@@ -16983,6 +16985,62 @@ function apply(ctx) {};}};+ actions.canOpenTerminal = () => ctx.get("sidebarRight") !== void 0 && ctx.get("sidebarRightTabs")?.get("terminal") !== void 0;+ actions.newTerminal = () => {+ actions.closePanel();+ try {+ ctx.get("sidebarRight")?.openTab("terminal");+ } catch (error) {+ actions.reportError(error, "right-sidebar");+ }+ };+ ctx.effect(() => {+ const sidebar = ctx.get("sidebarRight");+ if (!sidebar) return void 0;+ let open = rightColumnOpen(document);+ let moved = false;+ const collapseColumn = () => {+ try {+ if (sidebar.isExpanded()) sidebar.toggleExpanded();+ } catch (error) {+ actions.reportError(error, "right-sidebar");+ }+ };+ const observer = new MutationObserver((records) => {+ if (!records.some((record) => record.type === "attributes")) {+ moved = false;+ return;+ }+ const inSwitch = moved;+ moved = false;+ const next = rightColumnOpen(document);+ const opening = next && !open;+ open = next;+ const verdict = opening ? columnOpened(ui2.getSnapshot().details !== null, inSwitch) : null;+ if (verdict === "close-drawer") actions.closePanel();+ else if (verdict === "collapse-column") collapseColumn();+ });+ observer.observe(document.documentElement, {+ subtree: true,+ childList: true,+ attributes: true,+ attributeFilter: RIGHTBAR_ATTRIBUTES+ });+ const offMounted = sidebar.mounted.subscribe(() => {+ moved = true;+ });+ let drawer = ui2.getSnapshot().details !== null;+ const offUi = ui2.subscribe(() => {+ const next = ui2.getSnapshot().details !== null;+ if (next && !drawer && drawerOpened(rightColumnOpen(document)) === "collapse-column") collapseColumn();+ drawer = next;+ });+ return () => {+ observer.disconnect();+ offMounted();+ offUi();+ };+ }, "ds-bot: one right panel");const BOT_PRIORITY = -100;const shadow = (name, options, component) => ctx.slots.inject(name, () => ctx.slots.register({name,diff --git a/ds-bot/src/client/details-drawer.js b/ds-bot/src/client/details-drawer.jsindex 35462ae8..0ca48d40 100644--- a/ds-bot/src/client/details-drawer.js+++ b/ds-bot/src/client/details-drawer.js@@ -1,7 +1,7 @@import { createElement as h, Fragment, useEffect, useRef, useState } from 'react'import { isMainOf } from './sources.js'import { HEADER, currentPart, runStatsOf, stripHeader, usageOf } from './text.js'-import { PlusIcon, ShareIcon, CloseIcon, ChevronLeftIcon, GearIcon } from './icons.js'+import { PlusIcon, ShareIcon, CloseIcon, ChevronLeftIcon, GearIcon, TerminalIcon } from './icons.js'import { botState, BotMark, BotAvatar } from './mark.js'import { GlobeIcon, Favicon } from './browser-pane.js'import { useEscape } from './overlay-hooks.js'@@ -223,6 +223,9 @@ export function DetailsDrawer({ sessionId, startRenaming, startTab, hasStrip, robot && roster.browser === true && actions.openBrowser? h('button', { type: 'button', className: 'bt-round', 'aria-label': t('Open browser'), title: t("Open this Bot's browser"), onClick: () => actions.openBrowser(sessionId) }, h(GlobeIcon)): null,+ bot || room ? (actions.canOpenTerminal?.()+ ? h('button', { type: 'button', className: 'bt-round', 'data-info-row': 'terminal', 'aria-label': t('New terminal'), title: t('New terminal'), onClick: () => actions.newTerminal() }, h(TerminalIcon))+ : null) : null,bot || room ? h('button', { type: 'button', className: 'bt-round', 'aria-label': copied ? t('Copied conversation') : t('Share conversation'), title: copied ? t('Copied') : t('Copy conversation as Markdown'), onClick: share }, copied ? h('span', { key: 'copied', className: 'bt-pop-in' }, '✓') : h(ShareIcon)) : null,hasStrip ? null : h('button', { type: 'button', className: 'bt-round', 'aria-label': t('Close details'), onClick: close }, h(CloseIcon)))if (!bot && !room) {diff --git a/ds-bot/src/client/header.js b/ds-bot/src/client/header.jsindex 239f4fef..4e3948d6 100644--- a/ds-bot/src/client/header.js+++ b/ds-bot/src/client/header.js@@ -1,7 +1,7 @@import { createElement as h, Fragment, useEffect, useLayoutEffect, useRef, useState } from 'react'import { createPortal } from 'react-dom'import { currentPart, latestMemoryChange } from './text.js'-import { ArrowUpIcon, CloseIcon, ArrowDownIcon, MemoryIcon, SidePanelIcon } from './icons.js'+import { ArrowUpIcon, CloseIcon, ArrowDownIcon, MemoryIcon } from './icons.js'import { botState, BotAvatar, RoomAvatar } from './mark.js'import { ActivityIndicator } from './activity-row.js'import { clockLabel, openingTurn, unseenSince } from './cells.js'@@ -107,11 +107,7 @@ export function HeaderPill({ sessionId, useRoster, useSessions, useSessionStatush('span', { className: 'bt-pill-go', 'aria-hidden': true }, h(GoArrow))),h('span', { className: 'bt-sr', role: 'status' }, memoryNotice ? t('Memory updated') : ''),h(NewMessagePills, { key: sessionId, sessionId, useSessions, useUi, useTurnClock }),- h(ActivityIndicator, { key: `activity:${sessionId}`, sessionId, useRoster, useSessionStatus, useSession, useLive, useWork, actions }),- // DSH's way into its right sidebar sits in the session header this pill replaces.- actions.hasRightSidebar?.()- ? h('button', { type: 'button', className: 'bt-icon-btn bt-head-side', 'data-bt-right-sidebar': '', 'aria-label': t('Show or hide the right sidebar'), title: t('Right sidebar'), onClick: () => actions.toggleRightSidebar() }, h(SidePanelIcon))- : null)+ h(ActivityIndicator, { key: `activity:${sessionId}`, sessionId, useRoster, useSessionStatus, useSession, useLive, useWork, actions }))}// New-message pills. "N new messages ↓" takes Back to bottom's place whendiff --git a/ds-bot/src/client/i18n.js b/ds-bot/src/client/i18n.jsindex 83be2ebc..b2c1c625 100644--- a/ds-bot/src/client/i18n.js+++ b/ds-bot/src/client/i18n.js@@ -690,8 +690,7 @@ const ZH = {'Updating memory': '正在更新记忆','Checking memory': '正在查看记忆','Memory updated': '记忆已更新',- 'Show or hide the right sidebar': '显示或隐藏右侧栏',- 'Right sidebar': '右侧栏',+ 'New terminal': '新建终端','Team memory updated': '团队记忆已更新',"Updated {name}'s memory": '已更新 {name} 的记忆',"Memory updated. Open {name}'s memory": '记忆已更新,打开 {name} 的记忆',diff --git a/ds-bot/src/client/icons.js b/ds-bot/src/client/icons.jsindex 71fb14fe..3d6fc6d9 100644--- a/ds-bot/src/client/icons.js+++ b/ds-bot/src/client/icons.js@@ -89,7 +89,8 @@ export const DuplicateIcon = lineIcon(['M7 7h8.5v9.5H7z', 'M4.5 13V3.5H13', 'M11export const SlidersIcon = lineIcon(['M4 6.5h5M12.5 6.5H16M4 13.5h4M11.5 13.5H16', 'M10.5 4.5v4M9.5 11.5v4'])// A notebook with a ribbon: what a Bot remembers.export const MemoryIcon = lineIcon(['M5.5 3.5h8A1.5 1.5 0 0 1 15 5v10a1.5 1.5 0 0 1-1.5 1.5h-8z', 'M5.5 3.5v13', 'M8.5 7.5h3.5M8.5 10.5h2.5', 'M12 3.5v4l1-.8 1 .8'])-export const SidePanelIcon = lineIcon(['M4.5 4h11A1.5 1.5 0 0 1 17 5.5v9a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 14.5v-9A1.5 1.5 0 0 1 4.5 4z', 'M12.5 4v12'])+// A command prompt in a window: the `>` caret and the cursor's `_`.+export const TerminalIcon = lineIcon(['M4.5 4h11A1.5 1.5 0 0 1 17 5.5v9a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 14.5v-9A1.5 1.5 0 0 1 4.5 4z', 'M6.5 8l2.5 2.5L6.5 13', 'M11 13h3.5'])export const FolderIcon = lineIcon(['M3 6A1.5 1.5 0 0 1 4.5 4.5h3.2l1.8 2h6A1.5 1.5 0 0 1 17 8v6.5a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 14.5z'])// Defined here, after the icons: SettingsDialog only reads them at render time.// Two speech bubbles, the back one peeking out: a group chat.diff --git a/ds-bot/src/client/index.js b/ds-bot/src/client/index.jsindex 66e82144..e28e0643 100644--- a/ds-bot/src/client/index.js+++ b/ds-bot/src/client/index.js@@ -33,6 +33,7 @@ import { noteLeft, setUnread, sharedMap, toggleReaction } from './shared-map.js'import { freePriority, groupsFor, readMode, surfaceGroups, writeMode } from './surface.js'import { installLocale, language, t } from './i18n.js'import { noteClientError, quietly } from './diagnostics.js'+import { RIGHTBAR_ATTRIBUTES, columnOpened, drawerOpened, rightColumnOpen } from './right-panel.js'import { ErrorToast, FEEDBACK_CSS } from './feedback.js'import { ABOUT_CSS } from './about.js'import { MEMBER_CSS, MemberDock } from './member-status.js'@@ -491,15 +492,6 @@ export function apply(ctx) {ui.set(state => ({ ...state, reactions }))},clearUnread: id => writeUnread(id, false),- // DSH's right sidebar (files, terminals), which a plugin may load after this one.- hasRightSidebar: () => ctx.get('sidebarRight') !== undefined,- toggleRightSidebar: () => {- try {- ctx.get('sidebarRight')?.toggleExpanded()- } catch (error) {- actions.reportError(error, 'right-sidebar')- }- },}// Without the Desktop bridge these stay undefined, and no browser control renders.if (browsers) {@@ -639,6 +631,61 @@ export function apply(ctx) {return () => {}}}+ // A terminal tab in DSH's right column, only where the terminal plugin+ // registered its type and the column face is there.+ actions.canOpenTerminal = () => ctx.get('sidebarRight') !== undefined && ctx.get('sidebarRightTabs')?.get('terminal') !== undefined+ actions.newTerminal = () => {+ // The column takes the drawer's space: hand it over first.+ actions.closePanel()+ try {+ ctx.get('sidebarRight')?.openTab('terminal')+ } catch (error) {+ actions.reportError(error, 'right-sidebar')+ }+ }++ // The drawer and DSH's right column never share the window: whichever the+ // user asked for last wins. The column's state is read off the frame's+ // attributes through a MutationObserver. `mounted` moves before the DOM of a+ // Session switch does, so a switch is only marked; the next DOM batch settles+ // it — a batch that touches the column is the switch revealing that Session's+ // own column (the drawer wins and folds it back), while any other batch+ // clears the mark, so a later opening is the user's own (the column wins).+ ctx.effect(() => {+ const sidebar = ctx.get('sidebarRight')+ if (!sidebar) return undefined+ let open = rightColumnOpen(document)+ let moved = false+ const collapseColumn = () => {+ try {+ if (sidebar.isExpanded()) sidebar.toggleExpanded()+ } catch (error) {+ actions.reportError(error, 'right-sidebar')+ }+ }+ const observer = new MutationObserver((records) => {+ if (!records.some(record => record.type === 'attributes')) { moved = false; return }+ const inSwitch = moved+ moved = false+ const next = rightColumnOpen(document)+ const opening = next && !open+ open = next+ const verdict = opening ? columnOpened(ui.getSnapshot().details !== null, inSwitch) : null+ if (verdict === 'close-drawer') actions.closePanel()+ else if (verdict === 'collapse-column') collapseColumn()+ })+ observer.observe(document.documentElement, {+ subtree: true, childList: true, attributes: true, attributeFilter: RIGHTBAR_ATTRIBUTES,+ })+ const offMounted = sidebar.mounted.subscribe(() => { moved = true })+ let drawer = ui.getSnapshot().details !== null+ const offUi = ui.subscribe(() => {+ const next = ui.getSnapshot().details !== null+ if (next && !drawer && drawerOpened(rightColumnOpen(document)) === 'collapse-column') collapseColumn()+ drawer = next+ })+ return () => { observer.disconnect(); offMounted(); offUi() }+ }, 'ds-bot: one right panel')// A Bot surface owns the cells it shadows. It starts far below the -10 that plugins// commonly use and goes below whatever already holds the cell, so a plugin thatdiff --git a/ds-bot/src/client/right-panel.js b/ds-bot/src/client/right-panel.jsnew file mode 100644index 00000000..cbf480ba--- /dev/null+++ b/ds-bot/src/client/right-panel.js@@ -0,0 +1,32 @@+// One right-side panel at a time: the Bot drawer and DSH's right column never+// share the window (public#456: both open squeezed the conversation). Whichever+// the user asked for last wins.++// DSH's AppFrame marks the column on the frame element: `data-rightbar-collapsed`+// while it has no track, `data-rightbar-fullscreen` while a narrow viewport+// presents it fullscreen — with no track, so the two marks come together and it+// still counts as open. `data-rightbar-col` is the column itself, mounted+// whenever the frame is, so a frame with neither mark is open. These names are+// DSH's frame attributes.+export const RIGHTBAR_ATTRIBUTES = ['data-rightbar-collapsed', 'data-rightbar-fullscreen']++// The column's on-screen state, read off the document.+export function rightColumnOpen(doc) {+ if (doc.querySelector('[data-rightbar-fullscreen]')) return true+ if (doc.querySelector('[data-rightbar-collapsed]')) return false+ return doc.querySelector('[data-rightbar-col]') !== null+}++// The drawer opened: it needs the space an open column is holding.+export function drawerOpened(columnOpen) {+ return columnOpen ? 'collapse-column' : null+}++// The column appeared. `moved` marks a Session switch whose DOM has not settled+// (mounted moves before the DOM that follows it), so the opening is that+// Session's own column and the drawer wins; an unmoved opening is the user's+// own — a file link, a subagent, a shortcut — and takes the space.+export function columnOpened(drawerOpen, moved) {+ if (!drawerOpen) return null+ return moved ? 'collapse-column' : 'close-drawer'+}diff --git a/ds-bot/src/client/styles.js b/ds-bot/src/client/styles.jsindex e572cd95..f668477c 100644--- a/ds-bot/src/client/styles.js+++ b/ds-bot/src/client/styles.js@@ -155,8 +155,6 @@ body[data-bt-motion=quiet] .bt-mark[data-poke]{cursor:default}.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}}.bt-pill:hover{background:color-mix(in srgb,var(--bt-main),#777 9%)}-.bt-head-side{position:absolute;right:12px;top:4px;width:32px;height:32px;border-radius:8px;pointer-events:auto;transition:background-color .12s ease}-.bt-head-side:hover{background:color-mix(in srgb,var(--bt-main),#777 12%);color:var(--bt-ink)}.bt-pill:active{transform:scale(.965)}.bt-pill-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500}.bt-pill-mem{flex:none;display:inline-flex;width:0;margin-left:-8px;overflow:hidden;transition:${spring(SPRING_SHAPE, 'width', 'margin-left')}}diff --git a/ds-bot/test/header.test.js b/ds-bot/test/header.test.jsindex 20b73fcb..67dac92b 100644--- a/ds-bot/test/header.test.js+++ b/ds-bot/test/header.test.js@@ -51,19 +51,11 @@ const sideButton = (node) => {return null}-// 公开#172: the Bot header replaces DSH's session header, and with it the corner seat-// where DSH puts the button that opens its right sidebar; only the shortcut was left.-test('the Bot header has the right sidebar toggle that DSH keeps in the header it replaces', () => {- let toggled = 0- const button = sideButton(header({ hasRightSidebar: () => true, toggleRightSidebar: () => { toggled += 1 } }))- assert.ok(button)- assert.equal(button.props['aria-label'], 'Show or hide the right sidebar')- button.props.onClick()- assert.equal(toggled, 1)-})--test('without DSH\'s right sidebar the Bot header shows no toggle', () => {- assert.equal(sideButton(header({ hasRightSidebar: () => false, toggleRightSidebar: () => {} })), null)+// 公开#456: the Bot header carries no right-sidebar toggle — the drawer and the+// column never share the window, and the way in sits in the drawer instead.+test('the Bot header has no right sidebar button', () => {+ assert.equal(sideButton(header({ hasRightSidebar: () => true, toggleRightSidebar: () => {} })), null)+ assert.equal(sideButton(header({})), null)})test('a Bot in another Conversation View can return to chat without changing its draft', () => {diff --git a/ds-bot/test/right-panel.test.js b/ds-bot/test/right-panel.test.jsnew file mode 100644index 00000000..5106f260--- /dev/null+++ b/ds-bot/test/right-panel.test.js@@ -0,0 +1,112 @@+import assert from 'node:assert/strict'+import { test } from 'node:test'+import { createRequire } from 'node:module'+import { dirname, join } from 'node:path'+import { fileURLToPath } from 'node:url'+import { runInNewContext } from 'node:vm'+import { build } from 'esbuild'+import { columnOpened, drawerOpened, rightColumnOpen } from '../src/client/right-panel.js'++// jsdom comes from the harness that test/harness-resolve.mjs found, like the dsh packages.+const PLUGIN = dirname(dirname(fileURLToPath(import.meta.url)))+const { JSDOM } = createRequire(join(process.env.DSH_HARNESS ?? join(PLUGIN, '..', 'deepseek-harness'), 'package.json'))('jsdom')++const document = attrs => new JSDOM(`<!doctype html><body><div ${attrs}><div data-rightbar-col></div></div></body>`).window.document++// 公开#456: the Bot drawer and DSH's right column never share the window; whichever+// the user asked for last wins. The column's state lives on the frame's attributes.+test('the frame attributes read as the column state', () => {+ assert.equal(rightColumnOpen(document('')), true)+ assert.equal(rightColumnOpen(document('data-rightbar-collapsed')), false)+ assert.equal(rightColumnOpen(document('data-rightbar-fullscreen')), true)+ // A narrow window presents the panel fullscreen with no track: both marks.+ assert.equal(rightColumnOpen(document('data-rightbar-collapsed data-rightbar-fullscreen')), true)+ // No frame at all reads as closed.+ assert.equal(rightColumnOpen(new JSDOM('<!doctype html><body></body>').window.document), false)+})++test('a drawer opening folds an open column back', () => {+ assert.equal(drawerOpened(true), 'collapse-column')+ assert.equal(drawerOpened(false), null)+})++test('a column the user opens takes the space from an open drawer', () => {+ assert.equal(columnOpened(true, false), 'close-drawer')+})++test('a column a Session switch revealed yields to the open drawer', () => {+ assert.equal(columnOpened(true, true), 'collapse-column')+})++test('with no drawer open the column opens on its own', () => {+ assert.equal(columnOpened(false, false), null)+ assert.equal(columnOpened(false, true), null)+})++// The drawer's top row, bundled once and run with a minimal React stand-in; the+// row's components are vnodes, so only the drawer's own body runs.+const bundle = await build({+ entryPoints: [fileURLToPath(new URL('../src/client/details-drawer.js', import.meta.url))],+ bundle: true, format: 'cjs', platform: 'node', write: false,+ external: ['react', 'react-dom', '@deepseek-ai/dsh-client-ui-primitives'],+})+const module = { exports: {} }+runInNewContext(bundle.outputFiles[0].text, {+ module, exports: module.exports, URL, URLSearchParams, setTimeout, clearTimeout,+ require: (name) => {+ const platform = {+ react: {+ createElement: (type, props, ...children) => ({ type, props: props ?? {}, children: children.flat(Infinity) }),+ useState: initial => [initial, () => {}], useEffect: () => {}, useRef: current => ({ current }),+ useLayoutEffect: () => {}, useMemo: make => make(), useCallback: fn => fn,+ useSyncExternalStore: (_subscribe, get) => get(), Fragment: 'fragment',+ },+ 'react-dom': { createPortal: node => node },+ '@deepseek-ai/dsh-client-ui-primitives': { MarkdownText: () => null },+ }+ if (!(name in platform)) throw new Error(`no platform module ${name}`)+ return platform[name]+ },+})+const { DetailsDrawer } = module.exports++const bot = { id: 'a', name: 'Chief', sessionId: 'a' }+const room = { id: 'g', name: 'Writers', named: true, members: ['a'] }+const roster = { byId: { a: bot }, roomsById: { g: room }, bots: [], exchangeTurns: {}, questions: {}, memory: false }+const hook = value => select => select(value)+const drawer = (sessionId, actions) => DetailsDrawer({+ sessionId, roster, actions,+ useSessions: hook({ byId: {} }),+ useSessionStatus: hook(new Map()),+ useActivity: hook({}),+ useWork: hook({ bots: {}, approvals: [] }),+ useBrowserTabs: hook({}),+ useBrowserPages: hook({}),+})+const terminalButton = (node) => {+ if (Array.isArray(node)) return node.map(terminalButton).find(found => found !== null) ?? null+ if (node === null || typeof node !== 'object') return null+ if (node.props?.['data-info-row'] === 'terminal') return node+ for (const child of node.children ?? []) {+ const found = terminalButton(child)+ if (found) return found+ }+ return null+}++test('the drawer top row offers a new terminal where DSH has the tab type', () => {+ for (const sessionId of ['a', 'g']) {+ let opened = 0+ const button = terminalButton(drawer(sessionId, { canOpenTerminal: () => true, newTerminal: () => { opened += 1 } }))+ assert.ok(button, `${sessionId} shows the button`)+ assert.equal(button.props['aria-label'], 'New terminal')+ button.props.onClick()+ assert.equal(opened, 1)+ }+})++test('without the terminal tab type or the column face the row keeps no button', () => {+ assert.equal(terminalButton(drawer('a', { canOpenTerminal: () => false })), null)+ assert.equal(terminalButton(drawer('a', {})), null)+ assert.equal(terminalButton(drawer('g', { canOpenTerminal: () => false })), null)+})diff --git a/ds-bot/test/style-debt.json b/ds-bot/test/style-debt.jsonindex b60bcce3..4985bf19 100644--- a/ds-bot/test/style-debt.json+++ b/ds-bot/test/style-debt.json@@ -47,7 +47,7 @@"#00c972": 1,"#1cc3b0": 1,"#2a92fe": 1,- "#777": 2,+ "#777": 1,"#a97efe": 1,"#e02135": 1,"#ff3e51": 4,