diff --git a/.changeset/chat-tab-stale-12h-macros-newtab.md b/.changeset/chat-tab-stale-12h-macros-newtab.md new file mode 100644 index 000000000..373185428 --- /dev/null +++ b/.changeset/chat-tab-stale-12h-macros-newtab.md @@ -0,0 +1,5 @@ +--- +"@agent-native/core": patch +--- + +Auto-hide sidebar tabs after 12 h of inactivity (previously 4 h, empty-only). Any tab inactive for more than 12 hours is now removed from the sidebar on load and the user is dropped into a fresh tab; older threads remain accessible via History. diff --git a/packages/core/src/client/MultiTabAssistantChat.tsx b/packages/core/src/client/MultiTabAssistantChat.tsx index e99e35870..7c7ff6715 100644 --- a/packages/core/src/client/MultiTabAssistantChat.tsx +++ b/packages/core/src/client/MultiTabAssistantChat.tsx @@ -1133,17 +1133,13 @@ export function MultiTabAssistantChat({ const threadIds = new Set(threads.map((t) => t.id)); const threadMap = new Map(threads.map((t) => [t.id, t])); - // Auto-close only empty tabs inactive for more than 4 hours. Non-empty - // conversations should survive refresh even if they are old; otherwise the - // chat appears to disappear even though it still exists in history. - const STALE_THRESHOLD_MS = 4 * 60 * 60 * 1000; + // Hide tabs that have had no activity for more than 12 hours. Stale tabs + // are removed from the sidebar on load but remain accessible via history. + const STALE_THRESHOLD_MS = 12 * 60 * 60 * 1000; const now = Date.now(); const isStale = (id: string) => { const thread = threadMap.get(id); - return thread - ? thread.messageCount === 0 && - now - thread.updatedAt > STALE_THRESHOLD_MS - : false; + return thread ? now - thread.updatedAt > STALE_THRESHOLD_MS : false; }; // If the active thread is a sub-agent, switch to its parent or the most recent main thread @@ -1159,7 +1155,7 @@ export function MultiTabAssistantChat({ } setOpenTabIds((prev) => { - // Filter out tabs that no longer exist, sub-agent tabs, or stale tabs (>4h inactive) + // Filter out tabs that no longer exist, sub-agent tabs, or stale tabs (>12h inactive) const valid = prev.filter( (id) => threadIds.has(id) && !parentMap[id] && !isStale(id), ); diff --git a/templates/macros/app/components/VoiceDictation.tsx b/templates/macros/app/components/VoiceDictation.tsx index e46719ff6..a3d6d86f9 100644 --- a/templates/macros/app/components/VoiceDictation.tsx +++ b/templates/macros/app/components/VoiceDictation.tsx @@ -66,9 +66,10 @@ export function VoiceDictation({ currentDate }: VoiceDictationProps) { (text: string) => { setState("processing"); try { - // Open the agent sidebar now that the voice message is captured + // Open the agent sidebar now that the voice message is captured. + // Always open a fresh chat tab so each voice command gets its own thread. window.dispatchEvent(new Event("agent-panel:open")); - sendToAgent({ message: text, submit: true }); + sendToAgent({ message: text, submit: true, newTab: true }); // Timeout fallback: if sidebar is closed or event never fires, // don't leave the mic stuck in processing forever setTimeout(() => {