The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): resolve the Bot Screen RFB URL against the route target profile
Brooklyn Nicholson9e631991f530
diff --git a/apps/desktop/src/plugins/hermes-bots/screen-connection.test.ts b/apps/desktop/src/plugins/hermes-bots/screen-connection.test.tsindex 057205b20aa..ccf63cb534e 100644--- a/apps/desktop/src/plugins/hermes-bots/screen-connection.test.ts+++ b/apps/desktop/src/plugins/hermes-bots/screen-connection.test.ts@@ -9,7 +9,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'import type * as routing from './routing'import type { RosterRow } from './types'-const routeMock = vi.fn<() => { connectionId: string; profile: string } | null>(() => null)+const routeMock = vi.fn<() => { connectionId: string; profile: string; targetProfile?: string } | null>(() => null)vi.mock('@hermes/plugin-sdk', () => ({host: { requestProfile: vi.fn() },@@ -25,7 +25,7 @@ vi.mock('./routing', async importOriginal => {const route = routeMock()return route- ? { status: 'resolved', route: { ...route, mode: 'remote', targetProfile: route.profile } }+ ? { status: 'resolved', route: { ...route, mode: 'remote', targetProfile: route.targetProfile ?? route.profile } }: actual.resolveBotConnectionRoute(bot)}@@ -44,9 +44,9 @@ vi.mock('./routing', async importOriginal => {}})-import { host } from '@hermes/plugin-sdk'+import { host, resolveSiblingWsUrl } from '@hermes/plugin-sdk'-import { displayRequest, isEventForBotScreen } from './screen-connection'+import { displayRequest, isEventForBotScreen, resolveScreenWsUrl } from './screen-connection'const bot = { name: 'ops' } as RosterRowconst orphan = { name: 'ops', remoteSource: true } as RosterRow@@ -117,3 +117,19 @@ describe('displayRequest', () => {)})})++describe('resolveScreenWsUrl', () => {+ it('uses the route target profile for an aliased bot screen', async () => {+ routeMock.mockReturnValue({ connectionId: 'conn-a', profile: 'launch', targetProfile: 'home-ops' })+ vi.mocked(resolveSiblingWsUrl).mockResolvedValue('wss://gateway.example/api/display/ws')++ await expect(resolveScreenWsUrl(bot, 'ticket-123')).resolves.toBe(+ 'wss://gateway.example/api/display/ws?display_ticket=ticket-123'+ )+ expect(resolveSiblingWsUrl).toHaveBeenCalledWith(+ { connectionId: 'conn-a', profile: 'home-ops' },+ '/api/display/ws',+ { stripGatewayCredential: true }+ )+ })+})diff --git a/apps/desktop/src/plugins/hermes-bots/screen-connection.ts b/apps/desktop/src/plugins/hermes-bots/screen-connection.tsindex ea647fc13cb..f3eceb5cb6c 100644--- a/apps/desktop/src/plugins/hermes-bots/screen-connection.ts+++ b/apps/desktop/src/plugins/hermes-bots/screen-connection.ts@@ -177,7 +177,7 @@ export async function resolveScreenWsUrl(bot: RosterRow, ticket: string): Promis// dropped rather than spending a second one-shot ticket.const url = new URL(await resolveSiblingWsUrl(- { connectionId: route?.connectionId ?? null, profile: route?.profile ?? bot.name },+ { connectionId: route?.connectionId ?? null, profile: route?.targetProfile ?? route?.profile ?? bot.name },'/api/display/ws',{stripGatewayCredential: true