mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-17 04:11:35 +00:00
* fix(desktop): keep portal sign-in alive across redirect aborts (cherry picked from commit 3de10973b8e234853ddd0a8ed15bdb66722f5728) * refactor(desktop): share the ERR_ABORTED predicate between both cookie windows The remote OAuth window (main.ts, #110308) and the portal window (portal-session.ts) each carried the same inline `code === -3 || /ERR_ABORTED/` test. One resolver per policy: extract it to oauth-navigation.ts so the two windows cannot drift on what counts as a superseded navigation. Helper and its unit test come from #89377. Co-authored-by: Matt Earls <[email protected]> --------- Co-authored-by: Austin Pickett <[email protected]> Co-authored-by: Matt Earls <[email protected]>
10 lines
369 B
TypeScript
10 lines
369 B
TypeScript
export function isExpectedOauthNavigationAbort(error: unknown): boolean {
|
|
if (!error || typeof error !== 'object') {
|
|
return false
|
|
}
|
|
|
|
const code = 'code' in error ? Number((error as { code?: unknown }).code) : Number.NaN
|
|
const message = error instanceof Error ? error.message : String(error)
|
|
|
|
return code === -3 || /\bERR_ABORTED\b|\(-3\)/.test(message)
|
|
}
|