Show the cause of session-list failures and survive code-less IPC errors (0.2.1)

- Detect an older session.list contract also by message when the
  JSON-RPC code was lost across the desktop IPC bridge
- Show a short technical cause under the load error and log it
  with a [hermes-canopy] prefix

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Mikei386andClaude Opus 5.5 committed 2026-11-20 19:37:30 +01:00
1 parent e0a147e2e8
commit 551913254c
3 files changed
+47 -7

No files matched your search

+27 -5
View File
@@ -57,9 +57,25 @@ function normalized(r) {
lastActive:activity(r.last_active_at) || activity(r.last_active) || activity(r.started_at)}
}
function unsupportedList(error) {
return error?.code === -32601 || error?.code === -32602 ||
(error?.code === 4001 && error?.data?.reason === 'invalid_params')
// Errors that cross the desktop IPC bridge can lose their JSON-RPC frame (code/data) and keep only the
// message (see hermes-bots/rpc-errors.ts), so the message is the fallback signal when no numeric code survived.
const UNSUPPORTED_MESSAGE = /method not found|unknown method|no such method|-3260[12]\b|invalid[ _-]?params/i
export function unsupportedList(error) {
if (typeof error?.code === 'number') {
return error.code === -32601 || error.code === -32602 ||
(error.code === 4001 && error?.data?.reason === 'invalid_params')
}
return UNSUPPORTED_MESSAGE.test(typeof error?.message === 'string' ? error.message : String(error ?? ''))
}
/** Short technical cause for the UI, so a failure on one client can be diagnosed without devtools. */
export function errorDetail(error) {
if (error?.name === 'AbortError') return ''
const code = typeof error?.code === 'number' ? ` (${error.code})` : ''
const reason = typeof error?.data?.reason === 'string' ? ` [${error.data.reason}]` : ''
const raw = typeof error?.message === 'string' ? error.message : String(error ?? '')
const msg = raw.replace(/\s+/g,' ').trim()
return (msg.length > 180 ? `${msg.slice(0,177)}…` : msg) + code + reason
}
async function loadPersisted(api, route, signal) {
@@ -244,7 +260,12 @@ function Bot({route, connection, meta, metaRoute, metaReady, online, expanded, t
const focused = useValue(host.state.focusedStoredSessionId)
const owner = useValue(host.state.focusedSessionOwner)
const q = useQuery({queryKey:botKey(route),enabled:expanded && online,
queryFn:({signal})=>loadBot(host,route,signal),staleTime:20000,
queryFn:async ({signal})=>{
try {return await loadBot(host,route,signal)} catch (error) {
if (error?.name !== 'AbortError') console.warn(`[${ID}] session list failed for ${route.connectionId}/${route.profile}:`,errorDetail(error))
throw error
}
},staleTime:20000,
refetchInterval:expanded && online ? 90000 : false,retry:false})
const botName = meta?.name || route.profile
const botChat = meta?.botChat ?? null
@@ -278,6 +299,7 @@ function Bot({route, connection, meta, metaRoute, metaReady, online, expanded, t
q.isPending && online && message('Unterhaltungen werden geladen …'),
q.isError && el('div',null,
message('Unterhaltungen konnten für dieses Profil nicht geladen werden.',true),
errorDetail(q.error) && el('p',{style:{...sr,fontSize:'0.78em',wordBreak:'break-word'}},`Ursache: ${errorDetail(q.error)}`),
el('button',{type:'button',style:control,disabled:!online,onClick:()=>q.refetch()},'Erneut versuchen')),
q.isSuccess && sessions.length === 0 && message('Keine weiteren Unterhaltungen.'),
q.data?.liveAtLimit && message('Das Gateway begrenzt seine Liste laufender Sessions. Weitere aktive Unterhaltungen können fehlen.',true),
@@ -336,7 +358,7 @@ function Overview({ctx}) {
}
export default {
id:ID,name:'Hermes Canopy',version:'0.2.0',defaultEnabled:false,
id:ID,name:'Hermes Canopy',version:'0.2.1',defaultEnabled:false,
description:'Ein Baum für Bots, ihren Bot Chat und ihre bestehenden Unterhaltungen auf einem Gateway.',
register(ctx) {
ctx.register({id:'overview',area:'panes',title:'Übersicht',order:900,