The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fmt(js): `npm run fix` on merge (#120392)
hermes-seaeye[bot]8191aa0660ae
diff --git a/apps/desktop/src/app/chat/close-tab.test.ts b/apps/desktop/src/app/chat/close-tab.test.tsindex aae744ac7b6..215f3b013f5 100644--- a/apps/desktop/src/app/chat/close-tab.test.ts+++ b/apps/desktop/src/app/chat/close-tab.test.ts@@ -138,7 +138,9 @@ describe('closeWorkspaceTab', () => {it('a focused remote bot screen swallows ⌘W: no terminal tab, no session tab closes', async () => {loadedMainOnly()const combo = await import('@/lib/keybinds/combo')- const spy = vi.spyOn(combo, 'isFocusWithin').mockImplementation(selector => selector === '[data-remote-screen]' || selector === '[data-terminal]')+ const spy = vi+ .spyOn(combo, 'isFocusWithin')+ .mockImplementation(selector => selector === '[data-remote-screen]' || selector === '[data-terminal]')try {expect(closeActiveTab(vi.fn())).toBe(true)diff --git a/apps/desktop/src/app/chat/sidebar/gateway-groups.tsx b/apps/desktop/src/app/chat/sidebar/gateway-groups.tsxindex 41bd96bf4a9..17c47a5233c 100644--- a/apps/desktop/src/app/chat/sidebar/gateway-groups.tsx+++ b/apps/desktop/src/app/chat/sidebar/gateway-groups.tsx@@ -298,7 +298,9 @@ function GatewayProfileGroup({{open && (<>{children}- {group.profile ? <ProfileGroupHeaderSlot connectionId={group.connectionId ?? null} profile={group.profile} /> : null}+ {group.profile ? (+ <ProfileGroupHeaderSlot connectionId={group.connectionId ?? null} profile={group.profile} />+ ) : null}{renderRows(sessions.slice(0, visibleCount))}{hiddenCount > 0 && (<WorkspaceShowMoreButtondiff --git a/apps/desktop/src/app/chat/transcript-backfill.test.ts b/apps/desktop/src/app/chat/transcript-backfill.test.tsindex 9d19c711c80..b717104cd34 100644--- a/apps/desktop/src/app/chat/transcript-backfill.test.ts+++ b/apps/desktop/src/app/chat/transcript-backfill.test.ts@@ -125,8 +125,21 @@ describe('mergeOlderTranscriptPage', () => {it('keeps newer rows after an old tail when a drifting offset returns both overlap and subsequent turns', () => {// A page initially ending at row 6 was cached. New turns persisted before// the older-page request, so its offset now lands across rows 4–8.- const existing = [chat('one', 1), chat('two', 2), chat('three', 3), chat('four', 4), chat('five', 5), chat('six', 6)]- const fetched = [chat('four-refetched', 4), chat('five-refetched', 5), chat('six-refetched', 6), chat('seven', 7), chat('eight', 8)]+ const existing = [+ chat('one', 1),+ chat('two', 2),+ chat('three', 3),+ chat('four', 4),+ chat('five', 5),+ chat('six', 6)+ ]+ const fetched = [+ chat('four-refetched', 4),+ chat('five-refetched', 5),+ chat('six-refetched', 6),+ chat('seven', 7),+ chat('eight', 8)+ ]const merged = mergeOlderTranscriptPage(existing, fetched)diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/input-requests.test.ts b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/input-requests.test.tsindex ef719a49b0c..3f220add08b 100644--- a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/input-requests.test.ts+++ b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/input-requests.test.ts@@ -15,6 +15,7 @@ const deps = { updateSessionState: vi.fn(), upsertToolCall: vi.fn() } as unknownfunction cancel(requestId: string, routedSession: string | null): GatewayEventContext {const payload = { id: requestId, method: 'display.install.sudo', reason: 'timeout' }+return {deps: deps as unknown as GatewayEventContext['deps'],event: { payload, type: 'request.cancel' },@@ -42,7 +43,14 @@ describe('Bot Screen install password card', () => {const respond = vi.fn()expect(handleServerRequest(- { fail: vi.fn(), id: 'srq-1', method: 'display.install.sudo', params: { profile_key: '/home/h/.hermes', session_id: '' }, profile: 'default', respond },+ {+ fail: vi.fn(),+ id: 'srq-1',+ method: 'display.install.sudo',+ params: { profile_key: '/home/h/.hermes', session_id: '' },+ profile: 'default',+ respond+ },deps,'chat-a')diff --git a/apps/desktop/src/app/session/hooks/use-session-actions/transcript-provenance.ts b/apps/desktop/src/app/session/hooks/use-session-actions/transcript-provenance.tsindex 0252a978806..1257d7e5009 100644--- a/apps/desktop/src/app/session/hooks/use-session-actions/transcript-provenance.ts+++ b/apps/desktop/src/app/session/hooks/use-session-actions/transcript-provenance.ts@@ -79,13 +79,9 @@ export interface TranscriptViewCutoff {// row whose content is byte-identical to an arm-time row stays hidden until// the hold releases (bounded by the REST window).export function transcriptRowContentKey(message: ChatMessage): string {- return `${message.role}:${- (message.parts ?? [])- .map(part =>- 'text' in part && typeof part.text === 'string' ? `${part.type}:${part.text}` : JSON.stringify(part)- )- .join('|')- }`+ return `${message.role}:${(message.parts ?? [])+ .map(part => ('text' in part && typeof part.text === 'string' ? `${part.type}:${part.text}` : JSON.stringify(part)))+ .join('|')}`}export function suppressTranscriptForView(@@ -104,9 +100,7 @@ export function suppressTranscriptForView(}const messages = state.messages.filter(- message =>- !cutoff.cutoffIds.has(message.id) &&- !(cutoff.cutoffKeys?.has(transcriptRowContentKey(message)) ?? false)+ message => !cutoff.cutoffIds.has(message.id) && !(cutoff.cutoffKeys?.has(transcriptRowContentKey(message)) ?? false))if (messages.length === state.messages.length) {diff --git a/apps/desktop/src/app/session/hooks/use-session-state-cache.test.tsx b/apps/desktop/src/app/session/hooks/use-session-state-cache.test.tsxindex bb403b34144..7ba2d6ad1af 100644--- a/apps/desktop/src/app/session/hooks/use-session-state-cache.test.tsx+++ b/apps/desktop/src/app/session/hooks/use-session-state-cache.test.tsx@@ -813,11 +813,7 @@ describe('useSessionStateCache — held transcript gate keeps live rows (#117867// Releasing restores the full transcript.act(() => release?.())act(() => {- cache.updateSessionState(- runtime,- state => ({ ...state, messages: state.messages }),- stored- )+ cache.updateSessionState(runtime, state => ({ ...state, messages: state.messages }), stored)})expect($messages.get().map(message => message.id)).toEqual(['cached-1', 'cached-2', 'live-1'])diff --git a/apps/desktop/src/app/settings/billing/index.test.tsx b/apps/desktop/src/app/settings/billing/index.test.tsxindex 70535e38d8d..3283c5e429b 100644--- a/apps/desktop/src/app/settings/billing/index.test.tsx+++ b/apps/desktop/src/app/settings/billing/index.test.tsx@@ -542,7 +542,9 @@ describe('BillingSettings', () => {})await waitFor(() =>- expect(screen.getByText(`${formatMoney(25)} added. Balance is refreshing.`, { collapseWhitespace: false })).toBeTruthy()+ expect(+ screen.getByText(`${formatMoney(25)} added. Balance is refreshing.`, { collapseWhitespace: false })+ ).toBeTruthy())})diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.tsindex 24941aaedf6..d6637f314f6 100644--- a/apps/desktop/src/i18n/ar.ts+++ b/apps/desktop/src/i18n/ar.ts@@ -3229,7 +3229,8 @@ export const ar = defineLocale({sudoDesc:'راجع الأمر قبل إدخال كلمة مرور sudo. تُرسل كلمة المرور إلى الوكيل الذي ينفّذه وتُحفظ مؤقتًا لهذه الجلسة.',sudoCommandUnavailable: 'لم يقدّم هذا الوكيل الأمر. ألغِ الطلب إذا لم تتمكن من التحقق منه في المحادثة.',- sudoInstallDesc: 'يحتاج Hermes إلى كلمة مرور sudo لتثبيت حزم Bot Screen (TigerVNC + Xfce) على مضيف البوابة. تُرسل إلى ذلك المضيف فقط.',+ sudoInstallDesc:+ 'يحتاج Hermes إلى كلمة مرور sudo لتثبيت حزم Bot Screen (TigerVNC + Xfce) على مضيف البوابة. تُرسل إلى ذلك المضيف فقط.',sudoPlaceholder: 'كلمة المرور',secretTitle: 'مطلوب سر',secretDesc: 'أدخل القيمة المطلوبة لمتابعة المهمة.',diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 2f2993d5c31..a267726b384 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -4753,7 +4753,8 @@ export const en: Translations = {'Review the command before entering your sudo password. Your password is sent to the agent running it and cached for this session.',sudoCommandUnavailable:'This agent did not provide the command. Cancel if you cannot verify it in the conversation.',- sudoInstallDesc: 'Hermes needs your sudo password to install the Bot Screen packages (TigerVNC + Xfce) on the gateway host. It is sent only to that host.',+ sudoInstallDesc:+ 'Hermes needs your sudo password to install the Bot Screen packages (TigerVNC + Xfce) on the gateway host. It is sent only to that host.',sudoPlaceholder: 'sudo password',secretTitle: 'Secret required',secretDesc: 'Hermes needs a credential to continue.',diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex 9da64f72cdf..b2413a198c7 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -3644,7 +3644,8 @@ export const ja = defineLocale({'sudo パスワードを入力する前にコマンドを確認してください。パスワードは実行するエージェントに送信され、このセッション中キャッシュされます。',sudoCommandUnavailable:'エージェントからコマンドが提供されていません。会話で確認できない場合はキャンセルしてください。',- sudoInstallDesc: 'Bot Screen のパッケージ(TigerVNC + Xfce)をゲートウェイホストにインストールするため、sudo パスワードが必要です。そのホストにのみ送信されます。',+ sudoInstallDesc:+ 'Bot Screen のパッケージ(TigerVNC + Xfce)をゲートウェイホストにインストールするため、sudo パスワードが必要です。そのホストにのみ送信されます。',sudoPlaceholder: 'sudo パスワード',secretTitle: 'シークレットが必要です',secretDesc: 'Hermes は続行するための認証情報が必要です。',diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.tsindex 359645b325e..9da696819cc 100644--- a/apps/desktop/src/i18n/ru.ts+++ b/apps/desktop/src/i18n/ru.ts@@ -3912,7 +3912,8 @@ export const ru = defineLocale({sudoDesc:'Проверьте команду перед вводом пароля sudo. Пароль отправляется агенту, который её выполняет, и кэшируется на время сеанса.',sudoCommandUnavailable: 'Агент не предоставил команду. Отмените запрос, если не можете проверить её в разговоре.',- sudoInstallDesc: 'Hermes нужен ваш пароль sudo, чтобы установить пакеты Bot Screen (TigerVNC + Xfce) на хосте шлюза. Он отправляется только на этот хост.',+ sudoInstallDesc:+ 'Hermes нужен ваш пароль sudo, чтобы установить пакеты Bot Screen (TigerVNC + Xfce) на хосте шлюза. Он отправляется только на этот хост.',sudoPlaceholder: 'пароль sudo',secretTitle: 'Требуется секрет',secretDesc: 'Hermes нужны учётные данные, чтобы продолжить.',diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex e68dcb9e4c8..12c8fa7349a 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -3562,7 +3562,8 @@ export const zhHant = defineLocale({sudoTitle: '管理員密碼',sudoDesc: '輸入 sudo 密碼前,請先確認指令。密碼會傳送給執行指令的代理,並在本次工作階段中快取。',sudoCommandUnavailable: '此代理未提供指令。如果無法在對話中確認,請取消。',- sudoInstallDesc: 'Hermes 需要您的 sudo 密碼,以在閘道主機上安裝 Bot Screen 套件(TigerVNC + Xfce)。它只會傳送到該主機。',+ sudoInstallDesc:+ 'Hermes 需要您的 sudo 密碼,以在閘道主機上安裝 Bot Screen 套件(TigerVNC + Xfce)。它只會傳送到該主機。',sudoPlaceholder: 'sudo 密碼',secretTitle: '需要密鑰',secretDesc: 'Hermes 需要一個憑證才能繼續。',diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex f67614f1a13..3fc9df56224 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -4363,7 +4363,8 @@ export const zh = defineLocale({sudoTitle: '管理员密码',sudoDesc: '输入 sudo 密码前,请先检查命令。密码会发送给执行命令的 agent,并在本次会话中缓存。',sudoCommandUnavailable: '此 agent 未提供命令。如果无法在对话中确认,请取消。',- sudoInstallDesc: 'Hermes 需要你的 sudo 密码,以在网关主机上安装 Bot Screen 软件包(TigerVNC + Xfce)。它只会发送到该主机。',+ sudoInstallDesc:+ 'Hermes 需要你的 sudo 密码,以在网关主机上安装 Bot Screen 软件包(TigerVNC + Xfce)。它只会发送到该主机。',sudoPlaceholder: 'sudo 密码',secretTitle: '需要密钥',secretDesc: 'Hermes 需要一个凭据才能继续。',diff --git a/apps/desktop/src/lib/sibling-ws-url.test.ts b/apps/desktop/src/lib/sibling-ws-url.test.tsindex 06ac27e43ed..00b6acb2226 100644--- a/apps/desktop/src/lib/sibling-ws-url.test.ts+++ b/apps/desktop/src/lib/sibling-ws-url.test.ts@@ -17,7 +17,11 @@ describe('resolveSiblingWsUrl', () => {beforeEach(() => {getConnection = vi.fn(async () => ({ authMode: 'token', baseUrl: 'http://127.0.0.1:5151', wsUrl: localWsUrl }))- getConnectionFor = vi.fn(async () => ({ authMode: 'token', baseUrl: 'https://gateway.example', wsUrl: remoteWsUrl }))+ getConnectionFor = vi.fn(async () => ({+ authMode: 'token',+ baseUrl: 'https://gateway.example',+ wsUrl: remoteWsUrl+ }))getGatewayWsUrl = vi.fn(async () => ({ ok: true, wsUrl: localWsUrl }))getGatewayWsUrlFor = vi.fn(async () => ({ ok: true, wsUrl: remoteWsUrl }))Object.defineProperty(window, 'hermesDesktop', {@@ -40,7 +44,9 @@ describe('resolveSiblingWsUrl', () => {})it('strips the spent gateway credential when the sibling route authenticates itself', async () => {- const url = new URL(await resolveSiblingWsUrl({ profile: null }, 'api/display/ws', { stripGatewayCredential: true }))+ const url = new URL(+ await resolveSiblingWsUrl({ profile: null }, 'api/display/ws', { stripGatewayCredential: true })+ )expect(url.origin + url.pathname).toBe('ws://127.0.0.1:5151/api/display/ws')expect(url.searchParams.has('token')).toBe(false)diff --git a/apps/desktop/src/lib/sibling-ws-url.ts b/apps/desktop/src/lib/sibling-ws-url.tsindex 7ba0be8045b..a6d83cc7b19 100644--- a/apps/desktop/src/lib/sibling-ws-url.ts+++ b/apps/desktop/src/lib/sibling-ws-url.ts@@ -58,8 +58,16 @@ export async function resolveSiblingWsUrl(const conn =connectionId && desktop.getConnectionFor- ? await withTimeout(desktop.getConnectionFor({ connectionId, profile }), RESOLVE_TIMEOUT_MS, `Timed out connecting to profile "${profile}"`)- : await withTimeout(desktop.getConnection(profile), RESOLVE_TIMEOUT_MS, `Timed out connecting to profile "${profile}"`)+ ? await withTimeout(+ desktop.getConnectionFor({ connectionId, profile }),+ RESOLVE_TIMEOUT_MS,+ `Timed out connecting to profile "${profile}"`+ )+ : await withTimeout(+ desktop.getConnection(profile),+ RESOLVE_TIMEOUT_MS,+ `Timed out connecting to profile "${profile}"`+ )const wsDeps =connectionId && desktop.getGatewayWsUrlFor@@ -68,7 +76,11 @@ export async function resolveSiblingWsUrl(? {}: desktop- const wsUrl = await withTimeout(resolveGatewayWsUrl(wsDeps, conn), RESOLVE_TIMEOUT_MS, 'Timed out minting the gateway WebSocket URL')+ const wsUrl = await withTimeout(+ resolveGatewayWsUrl(wsDeps, conn),+ RESOLVE_TIMEOUT_MS,+ 'Timed out minting the gateway WebSocket URL'+ )const url = new URL(wsUrl)if (!url.pathname.endsWith('/api/ws')) {diff --git a/apps/desktop/src/plugins/hermes-bots/bot-row.tsx b/apps/desktop/src/plugins/hermes-bots/bot-row.tsxindex b19c0e84942..2c528b898f7 100644--- a/apps/desktop/src/plugins/hermes-bots/bot-row.tsx+++ b/apps/desktop/src/plugins/hermes-bots/bot-row.tsx@@ -333,7 +333,9 @@ export function BotRow({ bot, onDelete, onEdit, onGroup, onNewSection, showHandlvoid saveBotMeta(bot, { screenAutoOpen: next })host.notify({kind: 'info',- message: next ? b.screen.autoOpenOnToast(displayName(bot, current)) : b.screen.autoOpenOffToast(displayName(bot, current))+ message: next+ ? b.screen.autoOpenOnToast(displayName(bot, current))+ : b.screen.autoOpenOffToast(displayName(bot, current))})}).catch(error => host.notifyError?.(error, b.bot.metadataLoadFailed))diff --git a/apps/desktop/src/plugins/hermes-bots/i18n.ts b/apps/desktop/src/plugins/hermes-bots/i18n.tsindex 895728a1db4..7845752dedc 100644--- a/apps/desktop/src/plugins/hermes-bots/i18n.ts+++ b/apps/desktop/src/plugins/hermes-bots/i18n.ts@@ -629,7 +629,7 @@ const en: BotsMessages = {youControl: 'You are in control',otherControls: 'Another viewer is in control',agentControls: 'Bot is in control',- controlTaken: 'Another viewer took control. Watching only.',+ controlTaken: 'Another viewer took control. Watching only.'},cron: {filterHint:@@ -894,10 +894,13 @@ const ja: BotsMessages = {title: '画面',menu: '画面を開く',unsupportedTitle: 'このホストにはボット画面がありません',- unsupportedBody: 'ボット画面は Linux のゲートウェイホストで動作します。このボットはホスト自身のディスプレイを使います。',+ unsupportedBody:+ 'ボット画面は Linux のゲートウェイホストで動作します。このボットはホスト自身のディスプレイを使います。',notInstalledTitle: '画面パッケージが不足しています',- notInstalledBody: 'このボットに画面を与えるには、ゲートウェイホストに TigerVNC と Xfce コアが必要です。ホストで実行:',- installHint: 'Hermes を実行しているユーザーとしてゲートウェイホスト上で実行されます。sudo は Hermes 経由で一度だけ求められます。',+ notInstalledBody:+ 'このボットに画面を与えるには、ゲートウェイホストに TigerVNC と Xfce コアが必要です。ホストで実行:',+ installHint:+ 'Hermes を実行しているユーザーとしてゲートウェイホスト上で実行されます。sudo は Hermes 経由で一度だけ求められます。',install: 'ホストにインストール',installing: 'インストール中…',installCancelled: 'インストールを中止しました: sudo パスワードが入力されませんでした。',@@ -938,7 +941,7 @@ const ja: BotsMessages = {youControl: 'あなたが操作中',otherControls: '別のビューアが操作中',agentControls: 'ボットが操作中',- controlTaken: '別のビューアが操作を引き継ぎました。閲覧のみ。',+ controlTaken: '別のビューアが操作を引き継ぎました。閲覧のみ。'},cron: {filterHint:@@ -1240,7 +1243,7 @@ const zh: BotsMessages = {youControl: '你正在控制',otherControls: '另一位查看者正在控制',agentControls: '机器人正在控制',- controlTaken: '另一位查看者已接管控制。仅可观看。',+ controlTaken: '另一位查看者已接管控制。仅可观看。'},cron: {filterHint:@@ -1542,7 +1545,7 @@ const zhHant: BotsMessages = {youControl: '你正在控制',otherControls: '另一位檢視者正在控制',agentControls: '機器人正在控制',- controlTaken: '另一位檢視者已接手控制。僅可觀看。',+ controlTaken: '另一位檢視者已接手控制。僅可觀看。'},cron: {filterHint:diff --git a/apps/desktop/src/plugins/hermes-bots/screen-autoraise.test.ts b/apps/desktop/src/plugins/hermes-bots/screen-autoraise.test.tsindex d761a70ddb0..025e1c21ca0 100644--- a/apps/desktop/src/plugins/hermes-bots/screen-autoraise.test.ts+++ b/apps/desktop/src/plugins/hermes-bots/screen-autoraise.test.ts@@ -30,7 +30,10 @@ vi.mock('./screen-open', () => ({screenPaneId: (bot: RosterRow) => `screen:${bot.name}`}))-const roster = [{ name: 'parker', sourceScoped: true }, { name: 'alfred', sourceScoped: true }] as RosterRow[]+const roster = [+ { name: 'parker', sourceScoped: true },+ { name: 'alfred', sourceScoped: true }+] as RosterRow[]const toolStart = (profile: string, name: string, connectionId?: string) =>({ type: 'tool.start', profile, connectionId, session_id: 's1', payload: { tool_id: 't', name } }) as never@@ -48,9 +51,8 @@ describe('screen auto-raise', () => {})it('raises once per burst for an opted-in bot, and a Close holds until the burst is over', async () => {- const { AUTO_RAISE_COOLDOWN_MS, handleScreenToolStart, noteScreenTabClosed, noteScreenTabOpened } = await import(- './screen-autoraise'- )+ const { AUTO_RAISE_COOLDOWN_MS, handleScreenToolStart, noteScreenTabClosed, noteScreenTabOpened } =+ await import('./screen-autoraise')const t0 = 1_000_000diff --git a/apps/desktop/src/plugins/hermes-bots/screen-autoraise.ts b/apps/desktop/src/plugins/hermes-bots/screen-autoraise.tsindex a5c85adcdc1..42ff289f66e 100644--- a/apps/desktop/src/plugins/hermes-bots/screen-autoraise.ts+++ b/apps/desktop/src/plugins/hermes-bots/screen-autoraise.ts@@ -70,7 +70,8 @@ export function botForEvent(roster: RosterRow[], event: Pick<RpcEvent, 'connecticonst botProfile = route ? route.targetProfile || route.profile : bot.nameconst expected = route?.connectionId ?? nullconst actual = event.connectionId ?? null- const sameSource = expected === actual || (expected === 'local' && actual === null) || (expected === null && actual === 'local')+ const sameSource =+ expected === actual || (expected === 'local' && actual === null) || (expected === null && actual === 'local')if (sameSource && botProfile === profile) {return botdiff --git a/apps/desktop/src/plugins/hermes-bots/screen-connection.test.ts b/apps/desktop/src/plugins/hermes-bots/screen-connection.test.tsindex 8a6875d35bd..4bb922779b2 100644--- a/apps/desktop/src/plugins/hermes-bots/screen-connection.test.ts+++ b/apps/desktop/src/plugins/hermes-bots/screen-connection.test.ts@@ -24,7 +24,9 @@ vi.mock('./routing', async importOriginal => {const resolveBotConnectionRoute = (bot: RosterRow): ReturnType<typeof actual.resolveBotConnectionRoute> => {const route = routeMock()- return route ? { status: 'resolved', route: { ...route, mode: 'remote', targetProfile: route.profile } } : actual.resolveBotConnectionRoute(bot)+ return route+ ? { status: 'resolved', route: { ...route, mode: 'remote', targetProfile: route.profile } }+ : actual.resolveBotConnectionRoute(bot)}return {diff --git a/apps/desktop/src/plugins/hermes-bots/screen-connection.ts b/apps/desktop/src/plugins/hermes-bots/screen-connection.tsindex 6256c2f904d..48c773d1dbb 100644--- a/apps/desktop/src/plugins/hermes-bots/screen-connection.ts+++ b/apps/desktop/src/plugins/hermes-bots/screen-connection.ts@@ -17,7 +17,12 @@ import { resolveBotConnectionRoute } from './routing'import type { RosterRow } from './types'// Wire shapes come from the generated contract (Python is the source: `tui_gateway/contracts/display.py`).-export type { DisplayLease, DisplayObserveResult, DisplayStatus, DisplayThumbnailResult as DisplayThumbnail } from '@hermes/plugin-sdk'+export type {+ DisplayLease,+ DisplayObserveResult,+ DisplayStatus,+ DisplayThumbnailResult as DisplayThumbnail+} from '@hermes/plugin-sdk'/** This window's identity for one attach: the minted id plus its lease-payload hash. */export interface ScreenViewer {@@ -154,9 +159,13 @@ export async function resolveScreenWsUrl(bot: RosterRow, ticket: string): Promis// the bridge authenticates on the ticket alone, so the gateway credential is// dropped rather than spending a second one-shot ticket.const url = new URL(- await resolveSiblingWsUrl({ connectionId: route?.connectionId ?? null, profile: route?.profile ?? bot.name }, '/api/display/ws', {- stripGatewayCredential: true- })+ await resolveSiblingWsUrl(+ { connectionId: route?.connectionId ?? null, profile: route?.profile ?? bot.name },+ '/api/display/ws',+ {+ stripGatewayCredential: true+ }+ ))url.searchParams.set('display_ticket', ticket)diff --git a/apps/desktop/src/plugins/hermes-bots/screen-hero.tsx b/apps/desktop/src/plugins/hermes-bots/screen-hero.tsxindex c9029aebda3..aaded3c42e4 100644--- a/apps/desktop/src/plugins/hermes-bots/screen-hero.tsx+++ b/apps/desktop/src/plugins/hermes-bots/screen-hero.tsx@@ -120,18 +120,28 @@ function ScreenHeroContent({ bot, meta }: { bot: RosterRow; meta?: BotMeta | nulreturn null}- const caption = suppressed ? t.screen.heroSuppressed : stale ? t.screen.heroStale : {- live: t.screen.portalWatching,- human: t.screen.portalYouControl,- other: t.screen.portalOtherControls,- off: t.screen.heroStopped,- missing: t.screen.heroNotInstalled,- unsupported: t.screen.portalUnsupported,- unavailable: t.screen.portalUnavailable,- unknown: t.screen.heroConnecting- }[tone]-- const cta = running ? t.screen.heroOpenLive : tone === 'missing' ? t.screen.heroInstall : tone === 'off' ? t.screen.heroStart : ''+ const caption = suppressed+ ? t.screen.heroSuppressed+ : stale+ ? t.screen.heroStale+ : {+ live: t.screen.portalWatching,+ human: t.screen.portalYouControl,+ other: t.screen.portalOtherControls,+ off: t.screen.heroStopped,+ missing: t.screen.heroNotInstalled,+ unsupported: t.screen.portalUnsupported,+ unavailable: t.screen.portalUnavailable,+ unknown: t.screen.heroConnecting+ }[tone]++ const cta = running+ ? t.screen.heroOpenLive+ : tone === 'missing'+ ? t.screen.heroInstall+ : tone === 'off'+ ? t.screen.heroStart+ : ''return (<button@@ -143,15 +153,29 @@ function ScreenHeroContent({ bot, meta }: { bot: RosterRow; meta?: BotMeta | nultype="button">{dataUrl ? (- <img alt="" className={stale ? 'absolute inset-0 size-full object-cover opacity-40 grayscale' : 'absolute inset-0 size-full object-cover'} draggable={false} src={dataUrl} />+ <img+ alt=""+ className={+ stale+ ? 'absolute inset-0 size-full object-cover opacity-40 grayscale'+ : 'absolute inset-0 size-full object-cover'+ }+ draggable={false}+ src={dataUrl}+ />) : (<span className="absolute inset-0 grid place-items-center bg-[radial-gradient(ellipse_at_center,rgba(255,255,255,0.08),transparent_70%)]">- <Codicon className="text-[2.25rem] text-white/30" name={running ? 'loading' : tone === 'missing' ? 'cloud-download' : 'vm'} />+ <Codicon+ className="text-[2.25rem] text-white/30"+ name={running ? 'loading' : tone === 'missing' ? 'cloud-download' : 'vm'}+ /></span>)}<span className="absolute inset-x-0 bottom-0 flex items-center gap-2 bg-gradient-to-t from-black/85 to-black/0 px-2.5 pb-2 pt-6 text-white">- <span className={`size-2 shrink-0 rounded-full ${running && !stale ? (tone === 'live' ? 'bg-emerald-400' : tone === 'human' ? 'bg-red-400' : 'bg-amber-400') : 'bg-white/40'}`} />+ <span+ className={`size-2 shrink-0 rounded-full ${running && !stale ? (tone === 'live' ? 'bg-emerald-400' : tone === 'human' ? 'bg-red-400' : 'bg-amber-400') : 'bg-white/40'}`}+ /><span className="min-w-0 flex-1"><span className="block truncate text-xs font-medium">{t.screen.portalTitle}</span><span className="block truncate text-[0.65rem] text-white/70">{caption}</span>diff --git a/apps/desktop/src/plugins/hermes-bots/screen-install-retention.test.tsx b/apps/desktop/src/plugins/hermes-bots/screen-install-retention.test.tsxindex 250b3fb77e6..9da7e3e1bfb 100644--- a/apps/desktop/src/plugins/hermes-bots/screen-install-retention.test.tsx+++ b/apps/desktop/src/plugins/hermes-bots/screen-install-retention.test.tsx@@ -17,7 +17,9 @@ vi.mock('@hermes/plugin-sdk', async () => {const { onGatewayEvent } = await import('../../contrib/events')return {- Button: ({ children, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>) => <button {...props}>{children}</button>,+ Button: ({ children, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>) => (+ <button {...props}>{children}</button>+ ),Codicon: () => null,GlyphSpinner: () => null,resolveSiblingWsUrl: vi.fn(),diff --git a/apps/desktop/src/plugins/hermes-bots/screen-install.tsx b/apps/desktop/src/plugins/hermes-bots/screen-install.tsxindex 38fddd44e26..41ebfefd74f 100644--- a/apps/desktop/src/plugins/hermes-bots/screen-install.tsx+++ b/apps/desktop/src/plugins/hermes-bots/screen-install.tsx@@ -118,7 +118,9 @@ export function ScreenInstallCard({ bot, status, onInstalled }: ScreenInstallCar<div className="text-sm font-medium">{t.screen.notInstalledTitle}</div><div className="text-xs text-muted-foreground">{t.screen.notInstalledBody}</div>{status.install_command ? (- <code className="select-text break-all rounded bg-muted px-2 py-1 text-left text-xs">{status.install_command}</code>+ <code className="select-text break-all rounded bg-muted px-2 py-1 text-left text-xs">+ {status.install_command}+ </code>) : (<div className="text-xs text-muted-foreground">{t.screen.noPackageManager}</div>)}diff --git a/apps/desktop/src/plugins/hermes-bots/screen-isolation.test.tsx b/apps/desktop/src/plugins/hermes-bots/screen-isolation.test.tsxindex e661d116a0c..c0e5ffd1d18 100644--- a/apps/desktop/src/plugins/hermes-bots/screen-isolation.test.tsx+++ b/apps/desktop/src/plugins/hermes-bots/screen-isolation.test.tsx@@ -87,7 +87,12 @@ afterEach(() => {it('applies lease events only from the owning host even when profile paths match', () => {setScreenStatus(botA, status)const view = renderHook(() => useScreenPortalState(botA))- const human = { ...status.lease, holder: 'human' as const, viewer_hash: 'e0f9a555d558', epoch: status.lease.epoch + 1 }+ const human = {+ ...status.lease,+ holder: 'human' as const,+ viewer_hash: 'e0f9a555d558',+ epoch: status.lease.epoch + 1+ }const emit = (connectionId: string, profileKey = status.profile_key) =>act(() =>@@ -185,7 +190,9 @@ it('captions a suppressed thumbnail as hidden-while-controlled and never ages it})it('settles on an older backend without display.*: portal tone is unavailable and the hero renders nothing', async () => {- vi.mocked(host.requestProfile).mockRejectedValue(Object.assign(new Error('Method not found: display.status'), { code: -32601 }))+ vi.mocked(host.requestProfile).mockRejectedValue(+ Object.assign(new Error('Method not found: display.status'), { code: -32601 })+ )const hook = renderHook(() => useScreenPortalState(botA))await act(async () => {})expect(hook.result.current.tone).toBe('unavailable')diff --git a/apps/desktop/src/plugins/hermes-bots/screen-pane-lifecycle.test.tsx b/apps/desktop/src/plugins/hermes-bots/screen-pane-lifecycle.test.tsxindex 194c4447a6f..76606665476 100644--- a/apps/desktop/src/plugins/hermes-bots/screen-pane-lifecycle.test.tsx+++ b/apps/desktop/src/plugins/hermes-bots/screen-pane-lifecycle.test.tsx@@ -7,7 +7,13 @@ import type * as ScreenConnection from './screen-connection'import type { RosterRow } from './types'const sockets = vi.hoisted(- () => [] as Array<{ closeCodes: number[]; closed: boolean; close: (code?: number) => void; serverClose: (code: number) => void }>+ () =>+ [] as Array<{+ closeCodes: number[]+ closed: boolean+ close: (code?: number) => void+ serverClose: (code: number) => void+ }>)const rfbs = vi.hoisted(() => [] as Array<{ emit: (type: string, detail?: unknown) => void; viewOnly?: boolean }>)@@ -191,7 +197,8 @@ it('does not hand back while replacing a stream to reconnect the same viewer', a}const presented = (params as { viewer_id?: string } | undefined)?.viewer_id- const viewer_id = presented === 'this-viewer' ? 'this-viewer' : minted++ === 0 ? 'this-viewer' : 'replacement-viewer'+ const viewer_id =+ presented === 'this-viewer' ? 'this-viewer' : minted++ === 0 ? 'this-viewer' : 'replacement-viewer'return { ...status, ticket: 'test-ticket', viewer_id }})@@ -211,7 +218,8 @@ it('re-attaches in watch mode after the bridge evicts us with 4000, with a boundconst view = render(<BotScreenPane bot={bot} />)await waitFor(() => expect(sockets).toHaveLength(1))await act(async () => {})- const observes = () => vi.mocked(displayRequest).mock.calls.filter(([, method]) => method === 'display.observe').length+ const observes = () =>+ vi.mocked(displayRequest).mock.calls.filter(([, method]) => method === 'display.observe').lengthexpect(observes()).toBe(1)act(() => {diff --git a/apps/desktop/src/plugins/hermes-bots/screen-pane-status-events.test.tsx b/apps/desktop/src/plugins/hermes-bots/screen-pane-status-events.test.tsxindex 1f318f3a182..18f7f85acc7 100644--- a/apps/desktop/src/plugins/hermes-bots/screen-pane-status-events.test.tsx+++ b/apps/desktop/src/plugins/hermes-bots/screen-pane-status-events.test.tsx@@ -18,7 +18,9 @@ vi.mock('@hermes/plugin-sdk', async () => {const { onGatewayEvent } = await import('../../contrib/events')return {- Button: ({ children, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>) => <button {...props}>{children}</button>,+ Button: ({ children, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>) => (+ <button {...props}>{children}</button>+ ),Codicon: () => null,GlyphSpinner: () => null,Tip: ({ children }: { children: ReactNode }) => <>{children}</>,@@ -91,7 +93,9 @@ beforeEach(() => {$screenState.set({})vi.mocked(displayRequest).mockReset()- .mockImplementation(async (_bot, method) => (method === 'display.observe' ? { ...running, ticket: 't', viewer_id: 'v1' } : stopped))+ .mockImplementation(async (_bot, method) =>+ method === 'display.observe' ? { ...running, ticket: 't', viewer_id: 'v1' } : stopped+ )vi.stubGlobal('WebSocket',class {diff --git a/apps/desktop/src/plugins/hermes-bots/screen-pane.tsx b/apps/desktop/src/plugins/hermes-bots/screen-pane.tsxindex af0e4714976..864db982bd6 100644--- a/apps/desktop/src/plugins/hermes-bots/screen-pane.tsx+++ b/apps/desktop/src/plugins/hermes-bots/screen-pane.tsx@@ -17,9 +17,28 @@ import type { RpcEvent } from '@hermes/plugin-sdk'import { useCallback, useEffect, useRef, useState } from 'react'import { useBots } from './i18n'-import { type DisplayLease, type DisplayObserveResult, displayRequest, type DisplayStatus, isDisplayUnavailable, isEventForBotScreen, leaseHeldBy, resolveScreenWsUrl, retainBotScreen, viewerHash } from './screen-connection'+import {+ type DisplayLease,+ type DisplayObserveResult,+ displayRequest,+ type DisplayStatus,+ isDisplayUnavailable,+ isEventForBotScreen,+ leaseHeldBy,+ resolveScreenWsUrl,+ retainBotScreen,+ viewerHash+} from './screen-connection'import { ScreenInstallCard } from './screen-install'-import { $screenState, beginScreenStatusRequest, screenStateFor, setScreenLease, setScreenStatus, setScreenUnavailable, setScreenViewer } from './screen-state'+import {+ $screenState,+ beginScreenStatusRequest,+ screenStateFor,+ setScreenLease,+ setScreenStatus,+ setScreenUnavailable,+ setScreenViewer+} from './screen-state'import type { RosterRow } from './types'type RfbLike = {@@ -42,10 +61,16 @@ const CLOSE_CONTROL_TAKEN = 4000const EVICTION_LOOP_WINDOW_MS = 10_000const MAX_RAPID_EVICTIONS = 3-async function loadRfb(): Promise<new (target: HTMLElement, socket: WebSocket, options?: Record<string, unknown>) => RfbLike> {+async function loadRfb(): Promise<+ new (target: HTMLElement, socket: WebSocket, options?: Record<string, unknown>) => RfbLike+> {const mod = (await import('@novnc/novnc')) as unknown as { default: new (...args: never[]) => RfbLike }- return mod.default as unknown as new (target: HTMLElement, socket: WebSocket, options?: Record<string, unknown>) => RfbLike+ return mod.default as unknown as new (+ target: HTMLElement,+ socket: WebSocket,+ options?: Record<string, unknown>+ ) => RfbLike}export function BotScreenPane({ bot }: { bot: RosterRow }) {@@ -137,118 +162,126 @@ export function BotScreenPane({ bot }: { bot: RosterRow }) {retention.current = null}, [])- const attach = useCallback(async (auto = false) => {- if (!canvasHost.current) {- return- }-- if (!auto) {- rapidEvictions.current = 0- }-- detach()- const generation = attachGeneration.current- setConn('attaching')- setError(null)-- try {- // Load the client BEFORE dialing: noVNC's Websock installs its own `onopen`, so a socket that- // opened while the dynamic import was still in flight never hands it the open event.- const Rfb = await loadRfb()- const retain = await retainBotScreen(bot)-- if (generation !== attachGeneration.current) {- retain()-+ const attach = useCallback(+ async (auto = false) => {+ if (!canvasHost.current) {return}- retention.current = retain- // Re-present the id this window already minted: a reconnect (network blip, 4000 eviction, Reconnect- // button) must keep the human's lease bound to THIS pane, or the new stream is watch-only and the- // old lease can only be cleared by force. The server honours a minted id only on the connection- // that minted it; a foreign or stale id is silently replaced.- const priorViewer = screenStateFor($screenState.get(), bot)?.viewer?.id- const observe = await displayRequest<DisplayObserveResult>(- bot, 'display.observe', priorViewer ? { viewer_id: priorViewer } : {},- )- const minted = { id: observe.viewer_id, hash: await viewerHash(observe.viewer_id) }- setScreenStatus(bot, observe)- const url = await resolveScreenWsUrl(bot, observe.ticket)-- if (generation !== attachGeneration.current || !canvasHost.current) {- return+ if (!auto) {+ rapidEvictions.current = 0}- setScreenViewer(bot, minted)- dialedAt.current = Date.now()- const ws = new WebSocket(url)- ws.binaryType = 'arraybuffer'- socket.current = ws- // noVNC 1.7's `disconnect` detail carries only {clean}; the bridge's verdict lives in- // the raw close frame (4000 = control-taken). Listen here, before RFB installs its- // own `onclose`, so the code is known by the time the disconnect event fires.- let closeCode = 0- ws.addEventListener('close', event => {- closeCode = event.code- })- const client = new Rfb(canvasHost.current, ws, { shared: true })- client.scaleViewport = true- client.resizeSession = false- client.focusOnClick = true- client.background = 'transparent'- client.qualityLevel = 7- client.viewOnly = !leaseHeldBy(observe.lease, minted)- client.addEventListener('connect', () => {- if (generation === attachGeneration.current) {- setConn('live')- setEvicted(false)- }- })- client.addEventListener('disconnect', event => {- // noVNC logs "Tried changing state of a disconnected RFB object" if we later call- // disconnect() on a client that already closed itself (eviction, stream loss).- if (rfb.current === client) {- rfb.current = null- }+ detach()+ const generation = attachGeneration.current+ setConn('attaching')+ setError(null)++ try {+ // Load the client BEFORE dialing: noVNC's Websock installs its own `onopen`, so a socket that+ // opened while the dynamic import was still in flight never hands it the open event.+ const Rfb = await loadRfb()+ const retain = await retainBotScreen(bot)if (generation !== attachGeneration.current) {+ retain()+return}- const reason = event.detail?.reason ?? ''+ retention.current = retain+ // Re-present the id this window already minted: a reconnect (network blip, 4000 eviction, Reconnect+ // button) must keep the human's lease bound to THIS pane, or the new stream is watch-only and the+ // old lease can only be cleared by force. The server honours a minted id only on the connection+ // that minted it; a foreign or stale id is silently replaced.+ const priorViewer = screenStateFor($screenState.get(), bot)?.viewer?.id++ const observe = await displayRequest<DisplayObserveResult>(+ bot,+ 'display.observe',+ priorViewer ? { viewer_id: priorViewer } : {}+ )++ const minted = { id: observe.viewer_id, hash: await viewerHash(observe.viewer_id) }+ setScreenStatus(bot, observe)+ const url = await resolveScreenWsUrl(bot, observe.ticket)- if (closeCode === CLOSE_CONTROL_TAKEN || reason.includes('control-taken')) {- // Evicted: the socket is dead, so the frozen frame must not stay up. Going idle- // re-attaches in watch mode on a fresh ticket; a bridge that evicts every fresh- // attach within the window is bounded, then lands in the error state + Reconnect.- rapidEvictions.current = Date.now() - dialedAt.current < EVICTION_LOOP_WINDOW_MS ? rapidEvictions.current + 1 : 1+ if (generation !== attachGeneration.current || !canvasHost.current) {+ return+ }- if (rapidEvictions.current > MAX_RAPID_EVICTIONS) {+ setScreenViewer(bot, minted)+ dialedAt.current = Date.now()+ const ws = new WebSocket(url)+ ws.binaryType = 'arraybuffer'+ socket.current = ws+ // noVNC 1.7's `disconnect` detail carries only {clean}; the bridge's verdict lives in+ // the raw close frame (4000 = control-taken). Listen here, before RFB installs its+ // own `onclose`, so the code is known by the time the disconnect event fires.+ let closeCode = 0+ ws.addEventListener('close', event => {+ closeCode = event.code+ })+ const client = new Rfb(canvasHost.current, ws, { shared: true })+ client.scaleViewport = true+ client.resizeSession = false+ client.focusOnClick = true+ client.background = 'transparent'+ client.qualityLevel = 7+ client.viewOnly = !leaseHeldBy(observe.lease, minted)+ client.addEventListener('connect', () => {+ if (generation === attachGeneration.current) {+ setConn('live')setEvicted(false)- setConn('error')- setError(t.screen.controlTaken)- } else {- setEvicted(true)+ }+ })+ client.addEventListener('disconnect', event => {+ // noVNC logs "Tried changing state of a disconnected RFB object" if we later call+ // disconnect() on a client that already closed itself (eviction, stream loss).+ if (rfb.current === client) {+ rfb.current = null+ }++ if (generation !== attachGeneration.current) {+ return+ }++ const reason = event.detail?.reason ?? ''++ if (closeCode === CLOSE_CONTROL_TAKEN || reason.includes('control-taken')) {+ // Evicted: the socket is dead, so the frozen frame must not stay up. Going idle+ // re-attaches in watch mode on a fresh ticket; a bridge that evicts every fresh+ // attach within the window is bounded, then lands in the error state + Reconnect.+ rapidEvictions.current =+ Date.now() - dialedAt.current < EVICTION_LOOP_WINDOW_MS ? rapidEvictions.current + 1 : 1++ if (rapidEvictions.current > MAX_RAPID_EVICTIONS) {+ setEvicted(false)+ setConn('error')+ setError(t.screen.controlTaken)+ } else {+ setEvicted(true)+ setConn('idle')+ }+ } else if (event.detail?.clean) {setConn('idle')+ } else {+ setConn('error')+ setError(reason || t.screen.streamLost)}- } else if (event.detail?.clean) {- setConn('idle')- } else {++ void refresh()+ })+ rfb.current = client+ } catch (err) {+ if (generation === attachGeneration.current) {setConn('error')- setError(reason || t.screen.streamLost)+ setError(err instanceof Error ? err.message : String(err))}-- void refresh()- })- rfb.current = client- } catch (err) {- if (generation === attachGeneration.current) {- setConn('error')- setError(err instanceof Error ? err.message : String(err))}- }- }, [bot, detach, refresh, t.screen.controlTaken, t.screen.streamLost])+ },+ [bot, detach, refresh, t.screen.controlTaken, t.screen.streamLost]+ )// Visibility is not lifecycle: the stream stays attached while the pane is// hidden; only unmount tears it down (and hands control back server-side).@@ -294,7 +327,9 @@ export function BotScreenPane({ bot }: { bot: RosterRow }) {setBusy(true)try {- const result = await displayRequest<{ lease: DisplayLease }>(bot, 'display.lease.acquire', { viewer_id: viewer.id })+ const result = await displayRequest<{ lease: DisplayLease }>(bot, 'display.lease.acquire', {+ viewer_id: viewer.id+ })setScreenLease(bot, result.lease)if (conn !== 'live') {@@ -362,16 +397,25 @@ export function BotScreenPane({ bot }: { bot: RosterRow }) {<div className="flex items-center gap-2 border-b px-3 py-1.5 text-xs"><Codicon name="device-desktop" /><span className="font-medium">{t.screen.title}</span>- {status?.display ? <span className="text-muted-foreground">{status.display} · {status.geometry}</span> : null}+ {status?.display ? (+ <span className="text-muted-foreground">+ {status.display} · {status.geometry}+ </span>+ ) : null}<span className="grow" />{lease?.holder === 'human' && lease.reason ? (// Why control was taken stays readable while the human acts.- <span className="max-w-[40%] truncate rounded bg-amber-500/15 px-2 py-0.5 text-amber-600 dark:text-amber-400" title={lease.reason}>+ <span+ className="max-w-[40%] truncate rounded bg-amber-500/15 px-2 py-0.5 text-amber-600 dark:text-amber-400"+ title={lease.reason}+ ><Codicon name="bell" /> {lease.reason}</span>) : null}{iHold ? (- <span className="rounded bg-red-500/15 px-2 py-0.5 font-medium text-red-600 dark:text-red-400">{t.screen.youControl}</span>+ <span className="rounded bg-red-500/15 px-2 py-0.5 font-medium text-red-600 dark:text-red-400">+ {t.screen.youControl}+ </span>) : humanOther ? (<span className="rounded bg-muted px-2 py-0.5 text-muted-foreground">{t.screen.otherControls}</span>) : (@@ -399,12 +443,22 @@ export function BotScreenPane({ bot }: { bot: RosterRow }) {</>)}<Tip label={t.screen.reconnect}>- <Button aria-label={t.screen.reconnect} disabled={conn === 'attaching'} onClick={() => void attach()} size="sm" variant="ghost">+ <Button+ aria-label={t.screen.reconnect}+ disabled={conn === 'attaching'}+ onClick={() => void attach()}+ size="sm"+ variant="ghost"+ ><Codicon name="refresh" /></Button></Tip></div>- <div className={iHold ? 'relative min-h-0 grow bg-black ring-2 ring-inset ring-red-500/70' : 'relative min-h-0 grow bg-black'}>+ <div+ className={+ iHold ? 'relative min-h-0 grow bg-black ring-2 ring-inset ring-red-500/70' : 'relative min-h-0 grow bg-black'+ }+ >{/* data-terminal: the same keyboard-ownership marker the terminal pane uses, so the app'stype-to-focus / bare-key shortcuts never steal keystrokes meant for the remote screen.data-remote-screen: tells the ⌘W close-tab router this is NOT a local terminal tab —@@ -416,7 +470,9 @@ export function BotScreenPane({ bot }: { bot: RosterRow }) {</div>) : null}{evicted ? (- <div className="pointer-events-none absolute inset-x-0 top-0 bg-amber-950/80 px-3 py-1.5 text-center text-xs text-amber-100">{t.screen.controlTaken}</div>+ <div className="pointer-events-none absolute inset-x-0 top-0 bg-amber-950/80 px-3 py-1.5 text-center text-xs text-amber-100">+ {t.screen.controlTaken}+ </div>) : null}{conn === 'error' && error ? (<div className="absolute inset-x-0 bottom-0 bg-red-950/80 px-3 py-1.5 text-xs text-red-200">{error}</div>diff --git a/apps/desktop/src/plugins/hermes-bots/screen-portal-status-request.test.tsx b/apps/desktop/src/plugins/hermes-bots/screen-portal-status-request.test.tsxindex 586337f487d..b519f1ef86c 100644--- a/apps/desktop/src/plugins/hermes-bots/screen-portal-status-request.test.tsx+++ b/apps/desktop/src/plugins/hermes-bots/screen-portal-status-request.test.tsx@@ -65,7 +65,10 @@ afterEach(() => vi.restoreAllMocks())it('a portal status reply superseded by a newer status request does not move running/display backwards', async () => {let reply: (status: DisplayStatus) => void = () => undefinedvi.mocked(host.requestProfile).mockImplementation(- () => new Promise<DisplayStatus>(resolve => { reply = resolve }) as Promise<never>+ () =>+ new Promise<DisplayStatus>(resolve => {+ reply = resolve+ }) as Promise<never>)const view = renderHook(() => useScreenPortalState(bot))diff --git a/apps/desktop/src/plugins/hermes-bots/screen-portal.tsx b/apps/desktop/src/plugins/hermes-bots/screen-portal.tsxindex d61e73ce99b..a5708ddecf4 100644--- a/apps/desktop/src/plugins/hermes-bots/screen-portal.tsx+++ b/apps/desktop/src/plugins/hermes-bots/screen-portal.tsx@@ -17,15 +17,35 @@ import { useEffect, useMemo } from 'react'import { $lastRoster } from './data'import { useBots } from './i18n'import { resolveBotConnectionRoute } from './routing'-import { type DisplayLease, displayRequest, type DisplayStatus, isDisplayUnavailable, isEventForBotScreen, leaseHeldBy, type ScreenViewer } from './screen-connection'+import {+ type DisplayLease,+ displayRequest,+ type DisplayStatus,+ isDisplayUnavailable,+ isEventForBotScreen,+ leaseHeldBy,+ type ScreenViewer+} from './screen-connection'import { openBotScreen } from './screen-open'-import { $screenState, beginScreenStatusRequest, screenStateFor, setScreenLease, setScreenStatus, setScreenUnavailable } from './screen-state'+import {+ $screenState,+ beginScreenStatusRequest,+ screenStateFor,+ setScreenLease,+ setScreenStatus,+ setScreenUnavailable+} from './screen-state'import type { RosterRow } from './types'export type PortalTone = 'live' | 'human' | 'other' | 'off' | 'missing' | 'unsupported' | 'unavailable' | 'unknown'/** Pure: map cached status + lease (+ this window's minted viewer, if attached) to what the portal says. */-export function portalTone(status: DisplayStatus | null, lease: DisplayLease | null, viewer: ScreenViewer | null = null, unavailable = false): PortalTone {+export function portalTone(+ status: DisplayStatus | null,+ lease: DisplayLease | null,+ viewer: ScreenViewer | null = null,+ unavailable = false+): PortalTone {if (unavailable) {return 'unavailable'}@@ -136,7 +156,11 @@ export function useScreenPortalState(bot: RosterRow) {[bot, profileKey])- return { status, lease: state?.lease ?? null, tone: portalTone(status, state?.lease ?? null, state?.viewer ?? null, state?.unavailable) }+ return {+ status,+ lease: state?.lease ?? null,+ tone: portalTone(status, state?.lease ?? null, state?.viewer ?? null, state?.unavailable)+ }}export function ScreenPortal({ bot }: { bot: RosterRow }) {@@ -168,7 +192,9 @@ export function ScreenPortal({ bot }: { bot: RosterRow }) {><span className="relative grid size-7 shrink-0 place-items-center rounded bg-black/70 text-white/90"><Codicon name={TONE_ICON[tone]} />- <span className={`absolute -right-0.5 -top-0.5 size-2 rounded-full ring-2 ring-(--ui-bg-primary) ${TONE_DOT[tone]}`} />+ <span+ className={`absolute -right-0.5 -top-0.5 size-2 rounded-full ring-2 ring-(--ui-bg-primary) ${TONE_DOT[tone]}`}+ /></span><span className="min-w-0 flex-1"><span className="block truncate text-xs font-medium">{t.screen.portalTitle}</span>@@ -200,7 +226,12 @@ export function ProfileGroupScreenPortal({ route }: { route: ProfileGroupRoute }: row.name === profile && connectionId === null}) ??(connectionId- ? ({ name: profile, sourceScoped: true, connectionId, connectionKind: connectionId === 'local' ? 'local' : 'remote' } as RosterRow)+ ? ({+ name: profile,+ sourceScoped: true,+ connectionId,+ connectionKind: connectionId === 'local' ? 'local' : 'remote'+ } as RosterRow): ({ name: profile } as RosterRow)),[connectionId, profile, roster])diff --git a/apps/desktop/src/plugins/hermes-bots/screen-viewer-identity.test.tsx b/apps/desktop/src/plugins/hermes-bots/screen-viewer-identity.test.tsxindex 788a591fc81..61787b59374 100644--- a/apps/desktop/src/plugins/hermes-bots/screen-viewer-identity.test.tsx+++ b/apps/desktop/src/plugins/hermes-bots/screen-viewer-identity.test.tsx@@ -19,7 +19,9 @@ vi.mock('@hermes/plugin-sdk', async () => {const { onGatewayEvent } = await import('../../contrib/events')return {- Button: ({ children, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>) => <button {...props}>{children}</button>,+ Button: ({ children, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>) => (+ <button {...props}>{children}</button>+ ),Codicon: () => null,GlyphSpinner: () => null,Tip: ({ children }: { children: ReactNode }) => <>{children}</>,diff --git a/apps/desktop/src/store/prompts.ts b/apps/desktop/src/store/prompts.tsindex 30cf1351716..aaccaec25da 100644--- a/apps/desktop/src/store/prompts.ts+++ b/apps/desktop/src/store/prompts.ts@@ -377,7 +377,7 @@ export const sessionApprovalRequest = (sessionId: string | null) =>/** A session's sudo card, else the app-level one (a Bot Screen package install is raised with no* session: it belongs to the connection, not to a turn, so whichever chat is focused shows it). */export const sessionSudoRequest = (sessionId: string | null) =>- computed(sudo.$all, all => all[keyFor(sessionId)] ?? (sessionId ? all[keyFor(null)] ?? null : null))+ computed(sudo.$all, all => all[keyFor(sessionId)] ?? (sessionId ? (all[keyFor(null)] ?? null) : null))export const sessionSecretRequest = (sessionId: string | null) =>computed(secret.$all, all => all[keyFor(sessionId)] ?? null)diff --git a/apps/desktop/src/vite-env.d.ts b/apps/desktop/src/vite-env.d.tsindex ad5fecb7701..a93ec0db632 100644--- a/apps/desktop/src/vite-env.d.ts+++ b/apps/desktop/src/vite-env.d.ts@@ -5,7 +5,11 @@// and an ambient `declare module` only works in a script-scoped (import-free) declaration file.declare module '@novnc/novnc' {export default class RFB {- constructor(target: HTMLElement, urlOrChannel: string | WebSocket | RTCDataChannel, options?: Record<string, unknown>)+ constructor(+ target: HTMLElement,+ urlOrChannel: string | WebSocket | RTCDataChannel,+ options?: Record<string, unknown>+ )viewOnly: booleanscaleViewport: booleanresizeSession: boolean