diff --git a/apps/desktop/src/plugins/hermes-bots/plugin.js b/apps/desktop/src/plugins/hermes-bots/plugin.js index cf7b36a5cd..712042ef53 100644 --- a/apps/desktop/src/plugins/hermes-bots/plugin.js +++ b/apps/desktop/src/plugins/hermes-bots/plugin.js @@ -6158,7 +6158,7 @@ function CreateAgentDialog({ open, onClose, roster }) { host .connections() - .then(value => setConnections(Array.isArray(value) ? value : [])) + .then(value => setConnections(Array.isArray(value?.connections) ? value.connections : [])) .catch(() => setConnections([])) }, [open, connections]) diff --git a/apps/desktop/src/plugins/hermes-bots/tests/cross-connection-bots.test.mjs b/apps/desktop/src/plugins/hermes-bots/tests/cross-connection-bots.test.mjs index 876e0a1966..5092884e08 100644 --- a/apps/desktop/src/plugins/hermes-bots/tests/cross-connection-bots.test.mjs +++ b/apps/desktop/src/plugins/hermes-bots/tests/cross-connection-bots.test.mjs @@ -162,3 +162,18 @@ test('source contract: group chat turns route through requestForBot on the membe // Room records persist remote member descriptors. assert.match(pluginSource, /members: Array\.isArray\(room\.members\) \? room\.members : \[\]/) }) + +test('regression: host.connections() registry object is unwrapped before the picker gate', () => { + // host.connections() resolves the IPC handler hermes:connections:list, which + // returns the registry OBJECT ({version, primary, connections: [...]}) — not + // a bare array. The picker gate (Array.isArray(connections) && length > 1) + // never fired, so the "Create on" picker stayed hidden on multi-connection + // desktops. The plugin must unwrap .connections before storing. + assert.match( + pluginSource, + /setConnections\(Array\.isArray\(value\?\.connections\) \? value\.connections : \[\]\)/ + ) + // The built-in Connections UI consumes the registry object, so the IPC + // handler contract must NOT change to a bare array. + assert.doesNotMatch(pluginSource, /setConnections\(Array\.isArray\(value\) \? value : \[\]\)/) +})