From 0a7daa5d103aa0fa7c64236ca77ab362a4dba3fc Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 4 Apr 2026 15:38:46 +0900 Subject: [PATCH] fix(anthropic-recovery): add session timeout cleanup helpers Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- .../session-timeout-map.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/hooks/anthropic-context-window-limit-recovery/session-timeout-map.ts diff --git a/src/hooks/anthropic-context-window-limit-recovery/session-timeout-map.ts b/src/hooks/anthropic-context-window-limit-recovery/session-timeout-map.ts new file mode 100644 index 000000000..80712d03f --- /dev/null +++ b/src/hooks/anthropic-context-window-limit-recovery/session-timeout-map.ts @@ -0,0 +1,20 @@ +export function clearSessionTimeout( + timeoutBySession: Map>, + sessionID: string, +): void { + const timeoutID = timeoutBySession.get(sessionID) + if (timeoutID !== undefined) { + clearTimeout(timeoutID) + timeoutBySession.delete(sessionID) + } +} + +export function clearAllSessionTimeouts( + timeoutBySession: Map>, +): void { + for (const timeoutID of timeoutBySession.values()) { + clearTimeout(timeoutID) + } + + timeoutBySession.clear() +}