A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Show a group's name on hover when the sidebar hides or cuts it
AdamPlatin123a918aee7fd30
diff --git a/ds-bot/client.js b/ds-bot/client.jsindex 00524466..da7f87b4 100644--- a/ds-bot/client.js+++ b/ds-bot/client.js@@ -8410,6 +8410,12 @@ function useMarkedUnread(id, active, marked, actions) {}, [active, marked]);}var PinMark = () => (0, import_react15.createElement)("span", { className: "bt-pin", "aria-hidden": true }, (0, import_react15.createElement)(PinMarkIcon));+var nameIfCut = (event) => {+ const row = event.currentTarget;+ const name = row.querySelector(".bt-row-title");+ if (name && name.scrollWidth > name.clientWidth) row.title = name.textContent;+ else row.removeAttribute("title");+};var useApproval = (useWork, match) => useWork ? useWork((work) => (work.approvals ?? []).some(match)) : false;var useGroupWork = (useWork, pick2) => useWork ? useWork((work) => JSON.stringify(pick2(work.rooms ?? {}))) : "[]";var workKeys = (text) => JSON.parse(text);@@ -8474,6 +8480,7 @@ function BotRow({ bot, roster, actions, useSessions, useSessionStatus, useSessio"aria-current": active ? "page" : void 0,"data-bot-id": id,title: wide ? void 0 : bot.name,+ onMouseEnter: wide ? nameIfCut : void 0,onClick: () => actions.openSession(id),onContextMenu},@@ -8510,6 +8517,8 @@ function RoomRow({ room: room2, roster, actions, useSessions, useSessionStatus,"aria-label": label,"aria-current": active ? "page" : void 0,"data-room-id": id,+ title: wide ? void 0 : room2.name,+ onMouseEnter: wide ? nameIfCut : void 0,onClick: () => actions.openSession(id),onContextMenu: (event) => {event.preventDefault();diff --git a/ds-bot/src/client/sidebar.js b/ds-bot/src/client/sidebar.jsindex e1fda0e1..0eb9df73 100644--- a/ds-bot/src/client/sidebar.js+++ b/ds-bot/src/client/sidebar.js@@ -24,6 +24,15 @@ function useMarkedUnread(id, active, marked, actions) {const PinMark = () => h('span', { className: 'bt-pin', 'aria-hidden': true }, h(PinMarkIcon))+// The rail shows a row's name only on hover; the wide list does so when the name is+// cut, which only the laid-out row can tell, so it is measured as the pointer enters.+const nameIfCut = (event) => {+ const row = event.currentTarget+ const name = row.querySelector('.bt-row-title')+ if (name && name.scrollWidth > name.clientWidth) row.title = name.textContent+ else row.removeAttribute('title')+}+// Whether an approval waits for the user: for a Bot, in any of its Sessions; for a group,// from any of its members there.const useApproval = (useWork, match) => (useWork ? useWork(work => (work.approvals ?? []).some(match)) : false)@@ -83,7 +92,7 @@ function BotRow({ bot, roster, actions, useSessions, useSessionStatus, useSessio}return h('button', {type: 'button', className: 'bt-row', 'aria-label': label, 'aria-current': active ? 'page' : undefined,- 'data-bot-id': id, title: wide ? undefined : bot.name, onClick: () => actions.openSession(id), onContextMenu,+ 'data-bot-id': id, title: wide ? undefined : bot.name, onMouseEnter: wide ? nameIfCut : undefined, onClick: () => actions.openSession(id), onContextMenu,},h(BotAvatar, { bot, size: 36, state, main }),pinned && !wide ? h(PinMark) : null,@@ -112,7 +121,7 @@ function RoomRow({ room, roster, actions, useSessions, useSessionStatus, useSessconst label = [room.name, pinned ? t('Pinned') : '', members.length > 0 ? t('Working') : '', approval ? t('Waiting for your approval') : ''].filter(Boolean).join(', ')return h('button', {type: 'button', className: 'bt-row', 'aria-label': label, 'aria-current': active ? 'page' : undefined,- 'data-room-id': id, onClick: () => actions.openSession(id),+ 'data-room-id': id, title: wide ? undefined : room.name, onMouseEnter: wide ? nameIfCut : undefined, onClick: () => actions.openSession(id),onContextMenu: (event) => { event.preventDefault(); actions.openMenu({ kind: 'room', id, x: event.clientX, y: event.clientY }) },},h(RoomAvatar, { room, roster, size: 36 }),diff --git a/ds-bot/test/sidebar-switch.test.js b/ds-bot/test/sidebar-switch.test.jsindex af4a499e..fdea9121 100644--- a/ds-bot/test/sidebar-switch.test.js+++ b/ds-bot/test/sidebar-switch.test.js@@ -256,6 +256,50 @@ test('an idle Bot\'s sidebar row keeps the message preview', () => {assert.equal(previews.length, 0)})+// The rail shows avatars only, and a group's name can be 60 characters long: a row whose+// name is not on screen in full shows it on hover.+test('a sidebar row shows its name on hover when the name is hidden or cut', () => {+ viewport.innerWidth = 1280+ const bot = { id: 'writer', name: 'Writer', createdAt: 1 }+ const room = { id: 'room', name: 'Launch plan for the spring release', members: ['writer'], createdAt: 2 }+ const roster = { bots: [bot], rooms: [room], agents: [], byId: { writer: bot }, roomsById: { room }, ready: true, exchangeTurns: {} }+ const rowsOf = (wide) => {+ const rows = []+ const walk = (node) => {+ if (Array.isArray(node)) { node.forEach(walk); return }+ if (!node || typeof node !== 'object') return+ if (['BotRow', 'RoomRow'].includes(node.type?.name)) rows.push(node)+ walk(node.props?.children)+ }+ walk(TeamSidebar({+ wide,+ actions: Object.fromEntries(['openSession', 'openMenu', 'openPalette', 'openNewChat', 'toggleSidebar', 'clearUnread'].map(name => [name, () => {}])),+ useRoster: pick => pick(roster), useUi: pick => pick({ unread: {} }), useRegistry: pick => pick({}),+ useSessions: pick => pick({ ids: [], byId: {} }), useUpdate: () => ({}),+ useSessionStatus: pick => pick(new Map()), useSessionRetainInfo: () => null,+ useActivity: pick => pick({}), useWork: pick => pick({ waiting: {}, rooms: {}, approvals: [] }),+ }))+ return Object.fromEntries(rows.map(row => [row.type.name, row.type(row.props)]))+ }+ const rail = rowsOf(false)+ assert.equal(rail.BotRow.props.title, 'Writer')+ assert.equal(rail.RoomRow.props.title, 'Launch plan for the spring release')+ const wide = rowsOf(true)+ assert.equal(wide.RoomRow.props.title, undefined)+ // jsdom lays nothing out, so the name's widths are set by hand.+ const { document } = new JSDOM('<button title="stale"><span class="bt-row-title">Launch plan for the spring release</span></button>').window+ const button = document.querySelector('button')+ const name = button.firstChild+ Object.defineProperty(name, 'clientWidth', { value: 120 })+ Object.defineProperty(name, 'scrollWidth', { value: 120, configurable: true })+ wide.RoomRow.props.onMouseEnter({ currentTarget: button })+ assert.equal(button.hasAttribute('title'), false)+ Object.defineProperty(name, 'scrollWidth', { value: 260 })+ wide.RoomRow.props.onMouseEnter({ currentTarget: button })+ assert.equal(button.title, 'Launch plan for the spring release')+ assert.equal(wide.BotRow.props.onMouseEnter, wide.RoomRow.props.onMouseEnter)+})+test('preparing sidebar navigation leaves actions elsewhere unchanged', () => {viewport.innerWidth = 390const { actions, calls } = navigationSidebar(true)