Skip to content

The agent that grows with you

fix(desktop): hide unknown cloud agent status

tank3211fac4e4d6378
diff --git a/apps/desktop/src/app/settings/gateway-settings.test.tsx b/apps/desktop/src/app/settings/gateway-settings.test.tsx
index ed659cd31f9..3cb519ca0a1 100644
--- a/apps/desktop/src/app/settings/gateway-settings.test.tsx
+++ b/apps/desktop/src/app/settings/gateway-settings.test.tsx
@@ -34,6 +34,8 @@ beforeAll(() => {
Element.prototype.releasePointerCapture = vi.fn()
})
+const cloudDiscover = vi.fn()
+const cloudStatus = vi.fn()
const getConnectionConfig = vi.fn()
const saveConnectionConfig = vi.fn()
@@ -57,9 +59,18 @@ const localConnection = {
beforeEach(() => {
getConnectionConfig.mockResolvedValue(localConnection)
saveConnectionConfig.mockResolvedValue(localConnection)
+ cloudStatus.mockResolvedValue({ portalBaseUrl: 'https://portal.nousresearch.com', signedIn: true })
+ cloudDiscover.mockResolvedValue({ agents: [], org: null })
Object.defineProperty(window, 'hermesDesktop', {
configurable: true,
- value: { getConnectionConfig, saveConnectionConfig }
+ value: {
+ cloud: {
+ discover: cloudDiscover,
+ status: cloudStatus
+ },
+ getConnectionConfig,
+ saveConnectionConfig
+ }
})
})
@@ -607,4 +618,46 @@ describe('GatewaySettings', () => {
expect(await within(hostRow).findByRole('combobox')).toBeTruthy()
expect(within(hostRow).queryByRole('textbox')).toBeNull()
})
+
+ it('hides an unknown cloud agent gateway status', async () => {
+ cloudDiscover.mockResolvedValue({
+ agents: [
+ {
+ dashboardGatewayState: 'unknown',
+ dashboardUrl: 'https://agent.example.com',
+ id: 'agent-1',
+ name: 'Cloud Agent',
+ status: 'active'
+ }
+ ],
+ org: null
+ })
+ getConnectionConfig.mockResolvedValue({ ...localConnection, mode: 'cloud', remoteUrl: 'https://portal.nousresearch.com' })
+
+ render(<GatewaySettings />)
+
+ expect(await screen.findByText('Cloud Agent')).toBeTruthy()
+ expect(screen.queryByText('Status: unknown')).toBeNull()
+ })
+
+ it('shows a known cloud agent gateway status', async () => {
+ cloudDiscover.mockResolvedValue({
+ agents: [
+ {
+ dashboardGatewayState: 'active',
+ dashboardUrl: 'https://agent.example.com',
+ id: 'agent-1',
+ name: 'Cloud Agent',
+ status: 'active'
+ }
+ ],
+ org: null
+ })
+ getConnectionConfig.mockResolvedValue({ ...localConnection, mode: 'cloud', remoteUrl: 'https://portal.nousresearch.com' })
+
+ render(<GatewaySettings />)
+
+ expect(await screen.findByText('Status: active')).toBeTruthy()
+ })
+ })
})
diff --git a/apps/desktop/src/app/settings/gateway-settings.tsx b/apps/desktop/src/app/settings/gateway-settings.tsx
index 9f94ebede04..a09309e554d 100644
--- a/apps/desktop/src/app/settings/gateway-settings.tsx
+++ b/apps/desktop/src/app/settings/gateway-settings.tsx
@@ -1258,6 +1258,8 @@ function GatewayConnectionSettings({ embedded, standalone }: { embedded: boolean
<div className="grid gap-1">
{cloudAgents.map(agent => {
const connected = isConnectedAgent(agent)
+ const gatewayState = agent.dashboardGatewayState.trim()
+ const hasKnownGatewayState = gatewayState.length > 0 && gatewayState.toLowerCase() !== 'unknown'
return (
<div
@@ -1288,7 +1290,7 @@ function GatewayConnectionSettings({ embedded, standalone }: { embedded: boolean
</Button>
)
}
- description={g.cloudStatusLabel(agent.dashboardGatewayState)}
+ description={hasKnownGatewayState ? g.cloudStatusLabel(gatewayState) : undefined}
title={savedAgent(agent)?.label || agent.name}
/>
</div>