hermes-agent/apps/desktop/src/lib/provider-setup-errors.ts
Brooklyn Nicholson 58ffc10c17 fix(desktop): stop spurious provider onboarding from credential warnings
Narrow the setup-error matcher, match the server's empty-key contract,
and route gateway-event plus create/resume/branch through one
credential-warning policy. Preserve configured=true only for
non-authoritative transport fallback.

Co-authored-by: Yingliang Zhang <zhangyingliang@outlook.com>
Co-authored-by: Brandon R <kingdomwarrior23@gmail.com>
2026-07-23 00:18:21 -05:00

14 lines
502 B
TypeScript

const PROVIDER_SETUP_ERROR_RE =
/No (?:inference|Hermes) provider(?: is)? configured|no_provider_configured|set an API key/i
const SESSION_INFO_CREDENTIAL_WARNING_RE = /^No API key configured for provider '[^']*'\. First message will fail\.$/
export function isProviderSetupErrorMessage(message: null | string | undefined): boolean {
const text = message?.trim()
if (!text) {
return false
}
return PROVIDER_SETUP_ERROR_RE.test(text) || SESSION_INFO_CREDENTIAL_WARNING_RE.test(text)
}