AIX debugger: don't auto-advance frame for support operations

This commit is contained in:
Enrico Ros
2026-01-25 19:24:55 -08:00
parent d1d212b075
commit 458341d79f
@@ -1,5 +1,7 @@
import { create } from 'zustand';
import type { AixAPI_Context_ChatGenerate } from '../../server/api/aix.wiretypes';
//
// NOTE: this file is supposed to be lightweight and to be kept in memory. Particles are used by reference and
// not cloned or modified. Visualization is a Reactive stringification of the referred objects pretty much.
@@ -7,6 +9,19 @@ import { create } from 'zustand';
const DEFAULT_FRAMES_COUNT = 10;
// Context names that should NOT auto-select when created (background operations)
const BACKGROUND_CONTEXT_NAMES = [
'chat-ai-summarize',
'chat-ai-summary',
'chat-ai-title',
'chat-attachment-prompts',
'chat-followup-chartjs',
'chat-followup-diagram',
'chat-followup-htmlui',
'fixup-code',
'aifn-image-caption',
] as const satisfies (AixAPI_Context_ChatGenerate['name'] | string)[];
/// Types ///
@@ -110,9 +125,14 @@ export const useAixClientDebuggerStore = create<AixClientDebuggerStore>((_set) =
createFrame: (transport, initialContext) => {
const newFrame = _createAixClientDebuggerFrame(transport, initialContext);
// Don't auto-select background operations (e.g., title generation) to avoid
// stealing focus from the main conversation request
const isBackgroundOperation = (BACKGROUND_CONTEXT_NAMES as readonly string[]).includes(initialContext.contextName);
_set((state) => ({
frames: [newFrame, ...state.frames].slice(0, state.maxFrames),
activeFrameId: newFrame.id,
// Auto-select if: no active frame yet, OR this is not a background operation
activeFrameId: (!state.activeFrameId || !isBackgroundOperation) ? newFrame.id : state.activeFrameId,
}));
return newFrame.id;