Skip to content

The agent that grows with you

fix(desktop): annotate the resolvable target for aliased LOCAL rows too

Tekniumbd6cc48b94f7
diff --git a/apps/desktop/src/plugins/hermes-bots/plugin.mentions.test.ts b/apps/desktop/src/plugins/hermes-bots/plugin.mentions.test.ts
index 5ec79763918..de02c500251 100644
--- a/apps/desktop/src/plugins/hermes-bots/plugin.mentions.test.ts
+++ b/apps/desktop/src/plugins/hermes-bots/plugin.mentions.test.ts
@@ -265,6 +265,25 @@ describe('the mention middleware', () => {
expect(result.text).toMatch(/on Vera/)
})
+ it('annotates the resolvable handle for a local row whose UI alias differs', async () => {
+ // The reporter's shape (#97678 / Discord video): the LOCAL twin carries
+ // the 'default-this-device' alias when the remote gateway is active.
+ // The local resolver only knows bare profile names / 'hermes'.
+ const { handler } = await contributions({
+ focused: 'ops',
+ profiles: [
+ { connectionId: 'local', connectionKind: 'local', handle: 'default-this-device', name: 'default' },
+ { name: 'ops' }
+ ]
+ })
+
+ const result = await handler({ text: 'ping @default-this-device' })
+
+ expect(result.text).toMatch(/@default-this-device = agent profile "default"/)
+ expect(result.text).toMatch(/message_agent target: "hermes"/)
+ expect(result.text).not.toMatch(/message_agent target: "default-this-device/)
+ })
+
it('passes a draft with no mention straight through', async () => {
const { handler } = await contributions()
const draft = { text: 'no tags here' }
diff --git a/apps/desktop/src/plugins/hermes-bots/plugin.tsx b/apps/desktop/src/plugins/hermes-bots/plugin.tsx
index 2b599d5b542..ffdcaeb8faa 100644
--- a/apps/desktop/src/plugins/hermes-bots/plugin.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/plugin.tsx
@@ -742,9 +742,15 @@ export default {
const target =
bot.remoteSource && bot.connectionId ? `${bot.name}@${bot.connectionId}` : botHandle(bot.name)
+ // Local rows get the same annotation whenever their UI alias
+ // ('default-this-device') differs from the resolvable handle —
+ // otherwise the agent has only the alias to go on and the local
+ // path rejects it the same way (#97678).
const where = bot.remoteSource
? ` — on ${bot.connectionLabel || bot.connectionId} (message_agent target: "${target}")`
- : ''
+ : handle !== target
+ ? ` (message_agent target: "${target}")`
+ : ''
return `@${handle} = agent profile "${bot.name}"${title ? ` ("${title}")` : ''}${where}`
})