Skip to content

The agent that grows with you

fix(desktop): three latent bugs in the bot rail, and the dead declarations

Brooklyn Nicholsond7f6ef8a17dd
diff --git a/apps/desktop/src/plugins/hermes-bots/data.bot-meta.test.ts b/apps/desktop/src/plugins/hermes-bots/data.bot-meta.test.ts
index 59940e5df98..23d080e801e 100644
--- a/apps/desktop/src/plugins/hermes-bots/data.bot-meta.test.ts
+++ b/apps/desktop/src/plugins/hermes-bots/data.bot-meta.test.ts
@@ -298,4 +298,23 @@ describe('server metadata reconciliation', () => {
expect($botMeta.get().builder.groups).toEqual(['Team'])
})
+
+ it('forgets write stamps far too old to fence any snapshot', async () => {
+ vi.useFakeTimers()
+
+ try {
+ await saveBotMeta('builder', { title: 'Builder' })
+
+ expect([...botMetaWriteAt.keys()]).toEqual(['builder'])
+
+ // The renderer stays up for days. Once no snapshot can still be in
+ // flight from before a stamp, keeping it just costs a row per bot.
+ vi.advanceTimersByTime(120_000)
+ await saveBotMeta('researcher', { title: 'Research' })
+
+ expect([...botMetaWriteAt.keys()]).toEqual(['researcher'])
+ } finally {
+ vi.useRealTimers()
+ }
+ })
})
diff --git a/apps/desktop/src/plugins/hermes-bots/data.ts b/apps/desktop/src/plugins/hermes-bots/data.ts
index 0a0c7b82a77..188aa756c10 100644
--- a/apps/desktop/src/plugins/hermes-bots/data.ts
+++ b/apps/desktop/src/plugins/hermes-bots/data.ts
@@ -11,6 +11,7 @@ import { atom, host, queryClient, useQuery, useValue } from '@hermes/plugin-sdk'
import { displayName } from './labels'
import {
aliasIdentityFor,
+ beginAliasRouteIndex,
botConnectionRoute,
botRosterMeta,
botRouteKey,
@@ -267,8 +268,23 @@ export function botOwner(owner: RosterRow | string): BotOwner {
* before the latest local/server metadata write must not overwrite it. */
export const botMetaWriteAt = new Map<string, number>()
+/** How long a write can still outrank a roster snapshot. The overlay only
+ * skips a bot while some snapshot ISSUED before the write is still landing,
+ * and the roster refetches every 5s with retry backoff capped at 15s — well
+ * inside a minute. Past that the stamp can never fence anything again, so
+ * keeping it just grows the map for the life of the renderer. */
+const BOT_META_WRITE_FENCE_MS = 60_000
+
export function noteBotMetaWrite(key: string) {
- botMetaWriteAt.set(key, Date.now())
+ const now = Date.now()
+
+ for (const [written, at] of botMetaWriteAt) {
+ if (now - at > BOT_META_WRITE_FENCE_MS) {
+ botMetaWriteAt.delete(written)
+ }
+ }
+
+ botMetaWriteAt.set(key, now)
}
/** Three-way outcome of the server half of a save — see the block comment on
@@ -637,8 +653,10 @@ export function useRoster() {
// Best-effort and feature-detected — a failed read keeps the last
// good index rather than dropping identities mid-session.
if (typeof host.profileRoutes === 'function') {
+ const epoch = beginAliasRouteIndex()
+
try {
- indexAliasRoutes(await host.profileRoutes())
+ indexAliasRoutes(await host.profileRoutes(), epoch)
} catch {
/* keep the previous alias index */
}
@@ -1010,7 +1028,10 @@ interface RosterOwnerRef {
name?: null | string
}
-export function isActiveRosterBot(bot: Partial<RosterRow> | null | undefined, active: RosterOwnerRef | null | undefined) {
+export function isActiveRosterBot(
+ bot: Partial<RosterRow> | null | undefined,
+ active: RosterOwnerRef | null | undefined
+) {
if (!active) {
return false
}
@@ -1035,12 +1056,14 @@ export function isActiveRosterBot(bot: Partial<RosterRow> | null | undefined, ac
* load-bearing on the nullable overload — callers use it to CLEAR a
* selection, so it must never be coerced to a 'default' fallback the way
* botRosterKey does. A real row always yields a key (`name` is required). */
+/* eslint-disable no-redeclare -- overload signatures; the rule predates TS */
export function botSelectionKey(bot: RosterRow): string
export function botSelectionKey(bot: Partial<RosterRow> | null | undefined): string | undefined
export function botSelectionKey(bot: Partial<RosterRow> | null | undefined): string | undefined {
return bot?.sourceScoped || bot?.remoteSource ? botRosterKey(bot) : bot?.name
}
+/* eslint-enable no-redeclare */
export function isDefaultBot(bot: Partial<RosterRow> | null | undefined): boolean {
const route = botConnectionRoute(bot)
@@ -1056,7 +1079,8 @@ export function newBotChat(bot: RosterRow) {
if (typeof host.newChat !== 'function') {
host.notify?.({
kind: 'error',
- message: getPluginCtx()?.i18n.t('bot.openAnotherChatUnsupported') ?? 'Update Hermes Desktop to open another Bot chat.'
+ message:
+ getPluginCtx()?.i18n?.t('bot.openAnotherChatUnsupported') ?? 'Update Hermes Desktop to open another Bot chat.'
})
return
@@ -1067,7 +1091,8 @@ export function newBotChat(bot: RosterRow) {
if (!route) {
host.notify?.({
kind: 'error',
- message: getPluginCtx()?.i18n.t('bot.openAnotherChatUnsupported') ?? 'Update Hermes Desktop to open another Bot chat.'
+ message:
+ getPluginCtx()?.i18n?.t('bot.openAnotherChatUnsupported') ?? 'Update Hermes Desktop to open another Bot chat.'
})
return
@@ -1179,6 +1204,7 @@ export function botRosterKey(bot: Partial<RosterRow> | null | undefined): string
/** The key a bot's persisted appearance/meta lives under. Same nullable
* contract as botSelectionKey: a real row always resolves to a key, a
* partial/absent one may not. */
+/* eslint-disable no-redeclare -- overload signatures; the rule predates TS */
export function botMetaKey(bot: RosterRow): string
export function botMetaKey(bot: Partial<RosterRow> | null | undefined): string | undefined
@@ -1187,6 +1213,7 @@ export function botMetaKey(bot: Partial<RosterRow> | null | undefined): string |
return route ? botRouteKey(route) : bot?.name
}
+/* eslint-enable no-redeclare */
export function persistBotMetaSnapshot(value: Record<string, BotMeta>, scoped = false): Promise<void> {
try {
@@ -1258,6 +1285,14 @@ interface BotSourceStatus {
tone: 'bad' | 'good' | 'muted' | 'warn'
}
+/** Called from plain functions rather than components, so there is no `useBots`
+ * to lean on and the ctx may not be installed yet — the English text is the
+ * floor, not the intended reading. Guard `i18n` as well as the ctx: this runs
+ * on every roster row, and a throw here paints an empty rail. */
+function sourceLabel(key: string, fallback: string): string {
+ return getPluginCtx()?.i18n?.t(`roster.${key}`) ?? fallback
+}
+
export function botSourceStatus(bot: BotSourceFields | null | undefined): BotSourceStatus {
const error = String(bot?.sourceError || '').trim()
@@ -1265,7 +1300,7 @@ export function botSourceStatus(bot: BotSourceFields | null | undefined): BotSou
return {
available: false,
key: 'missing',
- label: 'Gateway removed',
+ label: sourceLabel('gatewayRemoved', 'Gateway removed'),
tone: 'bad'
}
}
@@ -1274,7 +1309,7 @@ export function botSourceStatus(bot: BotSourceFields | null | undefined): BotSou
return {
available: true,
key: 'on-demand',
- label: 'On demand',
+ label: sourceLabel('onDemand', 'On demand'),
tone: 'muted'
}
}
@@ -1283,7 +1318,7 @@ export function botSourceStatus(bot: BotSourceFields | null | undefined): BotSou
return {
available: false,
key: 'unavailable',
- label: getPluginCtx()?.i18n.t('roster.unavailable') ?? 'Unavailable',
+ label: sourceLabel('unavailable', 'Unavailable'),
tone: 'warn'
}
}
@@ -1292,7 +1327,7 @@ export function botSourceStatus(bot: BotSourceFields | null | undefined): BotSou
return {
available: true,
key: 'ready',
- label: 'Ready',
+ label: sourceLabel('ready', 'Ready'),
tone: 'good'
}
}
@@ -1300,7 +1335,7 @@ export function botSourceStatus(bot: BotSourceFields | null | undefined): BotSou
return {
available: true,
key: 'unknown',
- label: 'Status unknown',
+ label: sourceLabel('statusUnknown', 'Status unknown'),
tone: 'muted'
}
}
diff --git a/apps/desktop/src/plugins/hermes-bots/group-chat.test.ts b/apps/desktop/src/plugins/hermes-bots/group-chat.test.ts
index e3e6efc2b6a..b88c7056d17 100644
--- a/apps/desktop/src/plugins/hermes-bots/group-chat.test.ts
+++ b/apps/desktop/src/plugins/hermes-bots/group-chat.test.ts
@@ -649,6 +649,43 @@ describe('cold hydrate', () => {
expect(merged.Shared.syncRevision).toBe(4)
expect(merged.Shared.log.map(entry => entry.id).sort()).toEqual(['local', 'remote'])
})
+
+ it('seats a member once when the projection re-derived its label and handle', async () => {
+ const { chat } = await loadRoom()
+
+ const merged = chat.mergeRemoteGroupChatSnapshotIntoRooms(
+ {
+ rooms: {
+ Shared: {
+ log: [],
+ members: [{ connectionId: 'mini', connectionLabel: 'Home lab', name: 'research', sourceScoped: true }],
+ revision: 1
+ }
+ },
+ version: 3
+ },
+ {
+ Shared: {
+ log: [],
+ members: [
+ {
+ connectionId: 'mini',
+ connectionLabel: 'Homelab',
+ handle: 'research',
+ name: 'research',
+ sourceScoped: true
+ }
+ ],
+ syncRevision: 1,
+ watermarks: {}
+ }
+ } as unknown as Record<string, GroupChat>
+ )
+
+ // Both copies answer to one groupMemberKey, so a second seat would take a
+ // second turn every round off a single watermark.
+ expect(merged.Shared.members?.map(member => member.name)).toEqual(['research'])
+ })
})
// A room's identity is its roomId. Display names are labels: renaming one is a
diff --git a/apps/desktop/src/plugins/hermes-bots/group-chat.ts b/apps/desktop/src/plugins/hermes-bots/group-chat.ts
index c3eae7a1397..5faa02afcde 100644
--- a/apps/desktop/src/plugins/hermes-bots/group-chat.ts
+++ b/apps/desktop/src/plugins/hermes-bots/group-chat.ts
@@ -11,7 +11,7 @@
import { atom, host } from '@hermes/plugin-sdk'
-import { $botMeta, $lastRoster } from './data'
+import { $botMeta, $lastRoster, botRosterKey } from './data'
import { groupMemberReferencesConnection, markOrphanedGroupMemberDescriptor } from './hygiene'
import { getPluginCtx } from './shared'
import type {
@@ -161,8 +161,7 @@ function normalizeGroupChatSyncSnapshot(snapshot: GroupChatSyncSnapshot | null |
for (const [name, at] of Object.entries(snapshot.deleted || {})) {
// v1 tombstones carried wall-clock ms, not gateway revisions — they must
- // not outrank real revisions (same rule groupChatSyncDeletedRevision
- // applied before v3).
+ // not outrank real revisions.
deleted[`name:${name}`] = Number(snapshot.version || 0) >= 2 ? Math.max(0, Number(at || 0)) : 0
}
@@ -324,22 +323,17 @@ function groupChatSyncEntryKey(entry: GroupMessage) {
])
}
-function groupChatSyncMemberKey(member: GroupMember & { source?: string }) {
- // TODO(bot-mode-types): `member.source` cannot exist. Member descriptors are
- // roster-derived (name/handle/connectionId/connectionLabel); only message
- // AUTHORS carry `source`. This field always stringifies to '' , so it adds
- // nothing to the identity key — it likely meant `connectionLabel`.
- return JSON.stringify([
- String(member?.source || ''),
- String(member?.connectionId || ''),
- String(member?.connectionLabel || ''),
- String(member?.handle || ''),
- String(member?.name || '')
- ])
-}
-
-function groupChatSyncDeletedRevision(source: GroupChatSyncSnapshot | null | undefined, value: unknown) {
- return Number(source?.version || 0) >= 2 ? Math.max(0, Number(value || 0)) : 0
+/** Members dedupe on durable identity — the same (connectionId, name) pair
+ * botRosterKey seats them by everywhere else. `connectionLabel` and `handle`
+ * are display strings each machine re-derives (a connection rename, an older
+ * build with no handle), so keying on them seats one bot twice; both copies
+ * then answer to a single groupMemberKey in watermarks/sessions/stranded and
+ * the round engine gives that bot two turns. Deliberately unconditional,
+ * unlike groupMemberKey: the projection stamps `remoteSource` onto members it
+ * merges in, so a scoped/unscoped branch would fork a member from its own
+ * previously-merged copy. */
+function groupChatSyncMemberKey(member: GroupMember) {
+ return botRosterKey(member)
}
/** Merge two bounded projections without treating an absent room/message as
@@ -764,7 +758,9 @@ export function durableGroupChatRooms(all: Record<string, GroupChat> = $groupCha
export function persistGroupChatRooms(all: Record<string, GroupChat> = $groupChats.get()) {
try {
- return Promise.resolve(getPluginCtx()?.storage?.set?.('group-chats', durableGroupChatRooms(all))).catch(() => undefined)
+ return Promise.resolve(getPluginCtx()?.storage?.set?.('group-chats', durableGroupChatRooms(all))).catch(
+ () => undefined
+ )
} catch {
return Promise.resolve()
}
diff --git a/apps/desktop/src/plugins/hermes-bots/plugin.tsx b/apps/desktop/src/plugins/hermes-bots/plugin.tsx
index 50d2e1b5e18..a132b23cb85 100644
--- a/apps/desktop/src/plugins/hermes-bots/plugin.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/plugin.tsx
@@ -449,7 +449,10 @@ export default {
// Leaving Bot Mode ($botsPaneVisible false) still unregisters.
const $self = host.paneVisibility(`${ID}:routines`)
- if ($botsPaneVisible.get() && $self && typeof $self.get === 'function' && $self.get()) {return}
+ if ($botsPaneVisible.get() && $self && typeof $self.get === 'function' && $self.get()) {
+ return
+ }
+
unregisterRoutines()
unregisterRoutines = null
}
diff --git a/apps/desktop/src/plugins/hermes-bots/profile-ops.ts b/apps/desktop/src/plugins/hermes-bots/profile-ops.ts
index f6391ee3110..033548f6b79 100644
--- a/apps/desktop/src/plugins/hermes-bots/profile-ops.ts
+++ b/apps/desktop/src/plugins/hermes-bots/profile-ops.ts
@@ -37,8 +37,6 @@ import { botConnectionRoute, botRouteKey, requestForBot } from './routing'
import { getPluginCtx } from './shared'
import type { RosterRow } from './types'
-/** Fetch server-side avatars for roster rows flagged has_avatar when the
- * local cache doesn't already have an image for them. Fire-and-forget. */
const avatarFetchInflight = new Set<string>()
const avatarPushInflight = new Set<string>()
@@ -159,6 +157,8 @@ interface ProfilesGetAssetResult {
found?: boolean
}
+/** Fetch server-side avatars for roster rows flagged has_avatar when the
+ * local cache doesn't already have an image for them. Fire-and-forget. */
export function pullServerAvatars(roster: RosterRow[]) {
pushLocalAvatars(roster)
diff --git a/apps/desktop/src/plugins/hermes-bots/routing.test.ts b/apps/desktop/src/plugins/hermes-bots/routing.test.ts
index 8e7cde12ce3..e48851e2532 100644
--- a/apps/desktop/src/plugins/hermes-bots/routing.test.ts
+++ b/apps/desktop/src/plugins/hermes-bots/routing.test.ts
@@ -18,6 +18,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
import { displayName } from './labels'
import {
aliasIdentityFor,
+ beginAliasRouteIndex,
botConnectionRoute,
botRosterMeta,
indexAliasRoutes,
@@ -150,6 +151,59 @@ describe('alias identity survives the hosted handoff (#89131)', () => {
})
})
+describe('overlapping index rebuilds', () => {
+ const deferred = () => {
+ let resolve!: (routes: ProfileRoute[]) => void
+
+ const promise = new Promise<ProfileRoute[]>(settle => {
+ resolve = settle
+ })
+
+ return { promise, resolve }
+ }
+
+ /** The rebuild exactly as useRoster runs it: claim the epoch, read the
+ * route inventory over the wire, then replace the index wholesale. */
+ const rebuild = async (read: Promise<ProfileRoute[]>) => {
+ const epoch = beginAliasRouteIndex()
+
+ indexAliasRoutes(await read, epoch)
+ }
+
+ const STALE_ROUTE: ProfileRoute = {
+ connectionId: 'cloud-abc',
+ mode: 'remote',
+ profile: 'stale',
+ targetProfile: 'default'
+ }
+
+ it('keeps the newer routes when an older read resolves last', async () => {
+ const older = deferred()
+ const newer = deferred()
+
+ const first = rebuild(older.promise)
+ const second = rebuild(newer.promise)
+
+ newer.resolve([MOXIE_ROUTE])
+ await second
+
+ older.resolve([STALE_ROUTE])
+ await first
+
+ expect(aliasIdentityFor(hostedRow)?.name).toBe('moxie')
+ })
+
+ it('still adopts the newest routes once rebuilds stop overlapping', async () => {
+ await rebuild(Promise.resolve([MOXIE_ROUTE]))
+
+ expect(aliasIdentityFor(hostedRow)?.name).toBe('moxie')
+
+ await rebuild(Promise.resolve([STALE_ROUTE]))
+
+ expect(aliasIdentityFor(hostedRow)?.name).toBe('stale')
+ })
+})
+
describe('a row without a reachable owner', () => {
it('reports a typed status instead of throwing, while dispatch still fails closed', () => {
expect(resolveBotConnectionRoute({ name: 'plain' })).toEqual({ route: null, status: 'not_scoped' })
diff --git a/apps/desktop/src/plugins/hermes-bots/routing.ts b/apps/desktop/src/plugins/hermes-bots/routing.ts
index 375915fa590..6631207e40c 100644
--- a/apps/desktop/src/plugins/hermes-bots/routing.ts
+++ b/apps/desktop/src/plugins/hermes-bots/routing.ts
@@ -294,10 +294,26 @@ interface AliasIdentity {
/** Keyed `${connectionId}::${targetProfile}`; null marks an ambiguous claim. */
let aliasRouteIndex = new Map<string, AliasIdentity | null>()
+let aliasRouteEpoch = 0
+
+/** Claim the next rebuild epoch BEFORE reading the route inventory, then hand
+ * the token to indexAliasRoutes. The read is async and the index is replaced
+ * wholesale, so two overlapping roster fetches can resolve out of order and
+ * the slower one's stale routes would win. */
+export function beginAliasRouteIndex(): number {
+ aliasRouteEpoch += 1
+
+ return aliasRouteEpoch
+}
/** Rebuild the alias index from the credential-free route inventory. Only
- * genuine aliases (route.profile !== route.targetProfile) participate. */
-export function indexAliasRoutes(routes: ProfileRoute[]) {
+ * genuine aliases (route.profile !== route.targetProfile) participate. A
+ * rebuild overtaken by a newer one drops its result. */
+export function indexAliasRoutes(routes: ProfileRoute[], epoch = beginAliasRouteIndex()) {
+ if (epoch < aliasRouteEpoch) {
+ return
+ }
+
const next = new Map<string, AliasIdentity | null>()
for (const route of Array.isArray(routes) ? routes : []) {
diff --git a/apps/desktop/src/plugins/hermes-bots/row-helpers.test.ts b/apps/desktop/src/plugins/hermes-bots/row-helpers.test.ts
index 0e48e59e382..9182249e00b 100644
--- a/apps/desktop/src/plugins/hermes-bots/row-helpers.test.ts
+++ b/apps/desktop/src/plugins/hermes-bots/row-helpers.test.ts
@@ -1,7 +1,6 @@
/**
* The row-level reads a roster row is assembled from: who sent the last
- * message, what to call a generically-titled session, and whether a bot counts
- * as live right now.
+ * message, and whether a bot counts as live right now.
*
* Two bug classes are pinned:
* - #89484 — the bot-to-bot badge rendered the raw captured profile name, so
@@ -20,7 +19,6 @@ import {
activeBots,
botCanonicalSessionId,
botRowOwnsWorkspace,
- generatedSessionTitle,
previewKind,
rosterActivityMatches,
workerActiveAt
@@ -79,41 +77,6 @@ describe('previewKind classifies a roster preview', () => {
})
})
-describe('generatedSessionTitle labels a generically-titled chat', () => {
- it('keeps a stored title that means something', () => {
- expect(generatedSessionTitle({ id: 's', last_active: 1, title: 'Weekly review' }, 'some preview')).toBe(
- 'Weekly review'
- )
- })
-
- it('invents a label from the preview for auto-assigned titles', () => {
- for (const title of ['Bot Chat', 'New chat', '']) {
- expect(generatedSessionTitle({ id: 's', last_active: 1, title }, 'The tailnet proxy binds 100.64.0.1')).toBe(
- 'The tailnet proxy binds 100.64.0.1'
- )
- }
- })
-
- it('strips the bot-to-bot delivery prefix before generating', () => {
- const label = generatedSessionTitle(
- { id: 's', last_active: 1, title: '' },
- 'Message from 🤖 manager (@manager): Learn-share: skill installed'
- )
-
- expect(label).toMatch(/Learn-share/)
- expect(label).not.toMatch(/Message from/)
- })
-
- it('caps the generated label so it fits the row', () => {
- const label = generatedSessionTitle(
- { id: 's', last_active: 1, title: '' },
- 'this is a very long preview that goes on and on and on about something or other entirely'
- )
-
- expect(label.length).toBeLessThanOrEqual(34)
- })
-})
-
describe('the canonical session id everything core-keyed reads', () => {
it('prefers the compression-lineage tip over the durable registry id', () => {
expect(botCanonicalSessionId(row({ canonical_session: { id: 'root', last_active: 1, resolved_id: 'tip' } }))).toBe(
diff --git a/apps/desktop/src/plugins/hermes-bots/row-helpers.ts b/apps/desktop/src/plugins/hermes-bots/row-helpers.ts
index b85dd59dfc2..2c92daeafda 100644
--- a/apps/desktop/src/plugins/hermes-bots/row-helpers.ts
+++ b/apps/desktop/src/plugins/hermes-bots/row-helpers.ts
@@ -1,7 +1,7 @@
/**
* The row-level reads a roster row is assembled from: who sent the last
- * message, what to call a generically-titled session, whether a bot counts as
- * live, and whether its row owns the highlight.
+ * message, whether a bot counts as live, and whether its row owns the
+ * highlight.
*
* Pure below the surfaces. Every one of these takes a roster row and returns
* a value, so the bot row, the roster pane and the open path can share one
@@ -9,7 +9,7 @@
*/
import { botActivitySession, botHandle, botRosterKey, isActiveRosterBot } from './data'
-import type { CanonicalSession, RosterActivityFilter, RosterRow } from './types'
+import type { RosterActivityFilter, RosterRow } from './types'
// ── human-readable row helpers ───────────────────────────────────────────────
@@ -51,43 +51,6 @@ export function previewKind(preview: null | string | undefined): { fromBot: null
}
}
-/** Session titles the gateway auto-assigns that carry no information. */
-const GENERIC_TITLES = new Set(['', 'bot chat', 'new chat', 'new conversation', 'conversation', 'chat', 'untitled'])
-
-function isGenericTitle(title: null | string | undefined): boolean {
- return GENERIC_TITLES.has((title || '').trim().toLowerCase())
-}
-
-/** Title for the session chip: the real session title when it means
- * something, otherwise a short label generated from the newest message
- * (delivery prefixes stripped) so "Bot Chat" rows still say what the
- * conversation is actually about. */
-export function generatedSessionTitle(session: CanonicalSession | null | undefined, preview: null | string | undefined) {
- const raw = (session?.title || '').trim()
-
- if (raw && !isGenericTitle(raw)) {
- return raw
- }
-
- const cleaned = (preview || '').trim().replace(A2A_PREFIX_RE, '').trim()
-
- if (!cleaned) {
- return raw || 'Conversation'
- }
-
- const words = cleaned
- .split(/\s+/)
- .slice(0, 5)
- .join(' ')
- .replace(/[,;:.]+$/, '')
-
- if (!words) {
- return raw || 'Conversation'
- }
-
- return words.length > 34 ? `${words.slice(0, 33)}…` : words
-}
-
/** Roster liveness window: a bot whose last message landed within this many
* seconds is treated as "active now" (pulsing dot in its row). */
export const ACTIVE_WINDOW_S = 90
diff --git a/apps/desktop/src/plugins/hermes-bots/soul.ts b/apps/desktop/src/plugins/hermes-bots/soul.ts
index 171c41b4b02..5050a89bbc1 100644
--- a/apps/desktop/src/plugins/hermes-bots/soul.ts
+++ b/apps/desktop/src/plugins/hermes-bots/soul.ts
@@ -83,7 +83,10 @@ export function ensureMessagingProtocol(
) {
const text = (soul || '').trim()
- if (serverInjectsProtocol || hasMessagingProtocol(text)) {return text}
+ if (serverInjectsProtocol || hasMessagingProtocol(text)) {
+ return text
+ }
+
const section = messagingProtocolSection(name, roster)
return text ? text + '\n\n' + section : section