Fall back to the SDK session list when an older gateway rejects scope with 4000 (0.2.2)
The Docker gateway answers session.list with code 4000 and "scope: Extra inputs are not permitted" (no data.reason), which the fallback check did not recognise, so every bot showed a load error in the Mac app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
551913254c
commit
ef185c0903
4 files changed
+22
-5
No files matched your search
@@ -60,12 +60,18 @@ function normalized(r) {
|
||||
// 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
|
||||
// Older gateways reject the unknown `scope` argument with 4000 and a message only, e.g.
|
||||
// "invalid params for session.list: scope: Extra inputs are not permitted — … out of sync …".
|
||||
const INVALID_PARAMS_CODES = new Set([4000,4001])
|
||||
export function unsupportedList(error) {
|
||||
const message = typeof error?.message === 'string' ? error.message : String(error ?? '')
|
||||
if (typeof error?.code === 'number') {
|
||||
return error.code === -32601 || error.code === -32602 ||
|
||||
(error.code === 4001 && error?.data?.reason === 'invalid_params')
|
||||
if (error.code === -32601 || error.code === -32602) return true
|
||||
if (!INVALID_PARAMS_CODES.has(error.code)) return false
|
||||
const reason = error?.data?.reason
|
||||
return reason === 'invalid_params' || (reason === undefined && /invalid[ _-]?params/i.test(message))
|
||||
}
|
||||
return UNSUPPORTED_MESSAGE.test(typeof error?.message === 'string' ? error.message : String(error ?? ''))
|
||||
return UNSUPPORTED_MESSAGE.test(message)
|
||||
}
|
||||
|
||||
/** Short technical cause for the UI, so a failure on one client can be diagnosed without devtools. */
|
||||
@@ -358,7 +364,7 @@ function Overview({ctx}) {
|
||||
}
|
||||
|
||||
export default {
|
||||
id:ID,name:'Hermes Canopy',version:'0.2.1',defaultEnabled:false,
|
||||
id:ID,name:'Hermes Canopy',version:'0.2.2',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,
|
||||
|
||||
Reference in new issue
Block a user