refactor(session): centralize thread reset detection

Co-authored-by: Austin Mudd <austinm911@gmail.com>
This commit is contained in:
Peter SteinbergerandAustin Mudd committed 2026-01-18 06:55:04 +00:00
1 parent b5ddf08763
commit f86b24c511
6 files changed
+201 -41

No files matched your search

+14
View File
@@ -40,6 +40,20 @@ export function resolveSessionResetType(params: {
return "dm";
}
export function resolveThreadFlag(params: {
sessionKey?: string | null;
messageThreadId?: string | number | null;
threadLabel?: string | null;
threadStarterBody?: string | null;
parentSessionKey?: string | null;
}): boolean {
if (params.messageThreadId != null) return true;
if (params.threadLabel?.trim()) return true;
if (params.threadStarterBody?.trim()) return true;
if (params.parentSessionKey?.trim()) return true;
return isThreadSessionKey(params.sessionKey);
}
export function resolveDailyResetAtMs(now: number, atHour: number): number {
const normalizedAtHour = normalizeResetAtHour(atHour);
const resetAt = new Date(now);