diff --git a/apps/desktop/src/plugins/hermes-bots/plugin.js b/apps/desktop/src/plugins/hermes-bots/plugin.js index ce66a17929..df073db64b 100644 --- a/apps/desktop/src/plugins/hermes-bots/plugin.js +++ b/apps/desktop/src/plugins/hermes-bots/plugin.js @@ -6189,7 +6189,10 @@ function CreateAgentDialog({ open, onClose, roster }) { host .connections() - .then(value => setConnections(Array.isArray(value?.connections) ? value.connections : [])) + // host.connections() returns the registry ROWS on current SDKs, but the + // envelope object ({version, primary, connections: [...]}) on desktops + // that predate the SDK-side unwrap — accept both shapes. + .then(value => setConnections(Array.isArray(value) ? value : 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 5092884e08..5c7573d508 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 @@ -163,17 +163,15 @@ test('source contract: group chat turns route through requestForBot on the membe 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. +test('regression: host.connections() result is normalized for BOTH SDK shapes before the picker gate', () => { + // Current SDKs return the registry ROWS from host.connections() (the + // documented contract); desktops that predate the SDK-side unwrap resolve + // the raw IPC payload — the registry OBJECT ({version, primary, + // connections: [...]}). The picker gate (Array.isArray(connections) && + // length > 1) needs rows either way, so the plugin must accept both + // shapes. Pinning one shape only reopens #89823 on the other. assert.match( pluginSource, - /setConnections\(Array\.isArray\(value\?\.connections\) \? value\.connections : \[\]\)/ + /setConnections\(Array\.isArray\(value\) \? value : 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 : \[\]\)/) }) diff --git a/contributors/emails/hukla25@gmail.com b/contributors/emails/hukla25@gmail.com new file mode 100644 index 0000000000..3655bceda9 --- /dev/null +++ b/contributors/emails/hukla25@gmail.com @@ -0,0 +1 @@ +huklaa