mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-28 18:19:28 +00:00
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>
14 lines
502 B
TypeScript
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)
|
|
}
|