diff --git a/apps/desktop/src/plugins/hermes-bots/plugin.js b/apps/desktop/src/plugins/hermes-bots/plugin.js index 9446ebc1b3..cf7b36a5cd 100644 --- a/apps/desktop/src/plugins/hermes-bots/plugin.js +++ b/apps/desktop/src/plugins/hermes-bots/plugin.js @@ -4949,19 +4949,22 @@ function BotRow({ bot, onDelete, onEdit, onGroup }) { }) : null, jsx('span', { - className: 'truncate text-[0.8125rem] font-medium', + className: cn( + 'truncate text-[0.8125rem] font-medium', + bot.remoteSource && 'max-w-[42%] shrink-0' + ), children: displayName(bot, meta) }), showsHandle(bot.name, meta, bot) ? jsx('span', { - className: 'shrink-0 font-mono text-[0.6875rem] text-(--ui-text-quaternary)', + className: 'min-w-0 truncate font-mono text-[0.6875rem] text-(--ui-text-quaternary)', children: `@${botHandle(bot.name, bot)}` }) : null, bot.remoteSource ? jsx('span', { className: - 'shrink-0 rounded bg-(--chrome-action-hover) px-1 font-mono text-[0.625rem] text-(--ui-text-tertiary)', + 'max-w-[28%] shrink-0 truncate rounded bg-(--chrome-action-hover) px-1 font-mono text-[0.625rem] text-(--ui-text-tertiary)', title: `Lives on ${bot.connectionLabel}`, children: bot.connectionLabel }) diff --git a/apps/desktop/src/plugins/hermes-bots/tests/roster-preview.test.mjs b/apps/desktop/src/plugins/hermes-bots/tests/roster-preview.test.mjs index 7b32d664ce..200f00cbe9 100644 --- a/apps/desktop/src/plugins/hermes-bots/tests/roster-preview.test.mjs +++ b/apps/desktop/src/plugins/hermes-bots/tests/roster-preview.test.mjs @@ -148,6 +148,19 @@ function textOf(node) { return '' } +function findNode(node, predicate) { + if (node == null || typeof node !== 'object') return null + if (Array.isArray(node)) { + for (const child of node) { + const found = findNode(child, predicate) + if (found) return found + } + return null + } + if (predicate(node)) return node + return findNode(node.props?.children, predicate) +} + const DM_BOT = { name: 'scribe', title: 'Scribe', @@ -190,6 +203,29 @@ test('render: BotRow tolerates a fresh bot with no sessions yet', () => { assert.match(text, /Fresh bot/) }) +test('render: a remote gateway name is not squeezed out by its handle', () => { + const r = renderRuntime() + const tree = r.__BotRow({ + bot: { + connectionId: 'studio-over-ssh', + connectionLabel: 'Studio over SSH', + handle: 'default-studio-over-ssh', + name: 'default', + remoteSource: true + }, + onEdit: () => undefined + }) + const name = findNode(tree, node => node.type === 'span' && textOf(node) === 'Studio over SSH') + const handle = findNode(tree, node => node.type === 'span' && textOf(node) === '@default-studio-over-ssh') + + assert.ok(name) + assert.match(name.props.className, /shrink-0/) + assert.ok(handle) + assert.match(handle.props.className, /min-w-0/) + assert.match(handle.props.className, /truncate/) + assert.doesNotMatch(handle.props.className, /shrink-0/) +}) + test('render: BotRow previews the pinned canonical chat, not an unrelated latest session', () => { // hermes-agent#88200: the row opens the pinned chat on click, so the // preview must describe that same session — not the profile's most recent