fix(desktop): read bot-mode state through the plugin SDK

Plugins cannot import the contrib store. host.pluginDecisions is the
read-only door, and absence still means the plugin default.
This commit is contained in:
brooklyn!
2026-09-24 12:17:43 -05:00
parent ea3478d520
commit 7bde1dfe20
2 changed files with 13 additions and 3 deletions

View File

@@ -30,6 +30,16 @@ const { clearBotAttentionMock, hostMock, noteBotAttentionMock, UnboundedCache }
clearBotAttentionMock: vi.fn(),
hostMock: {
onEvent: vi.fn(),
pluginDecisions: {
get: () => {
try {
const raw = window.localStorage.getItem('hermes.desktop.pluginDecisions.v2')
return raw ? (JSON.parse(raw) as Record<string, boolean>) : {}
} catch {
return {}
}
}
},
profileRoutes: vi.fn(),
requestProfile: vi.fn(),
retainProfileSocket: vi.fn()

View File

@@ -9,8 +9,6 @@
import { host, LruCache } from '@hermes/plugin-sdk'
import { pluginActive } from '@/contrib/plugins-store'
import { botHandle, clearBotAttention, noteBotAttention } from './data'
import { ID } from './shared'
import type { ProfileRoute, RosterRow } from './types'
@@ -120,7 +118,9 @@ const RELAY_OUTBOX_ANY = '*'
const routesWithOutboxWork = new Set<string>()
function relayBotModeOn(): boolean {
return pluginActive(ID)
const decisions = host.pluginDecisions.get()
return ID in decisions ? Boolean(decisions[ID]) : true
}
function noteRelayOutboxWork(event?: { connectionId?: string }) {