andy-stack_vaultkeeper-ai/Stores/ConversationStore.ts
Andrew Beal 817ab3d332 fix: improve planning mode error handling and UI state management
- Add MAX_AGENT_DEPTH check to prevent infinite planning recursion
- Prompt user to submit plan if not provided instead of silent failure
- Clear planning mode when deactivating edit mode
- Remove inline overflow-y style in favor of CSS declaration
- Update error copy for clarity
- Remove unused deactivateEditMode method
2026-01-04 23:40:31 +00:00

28 lines
1.2 KiB
TypeScript

import { writable } from 'svelte/store';
import type { Conversation } from 'Conversations/Conversation';
interface IConversationStoreState {
shouldReset: boolean;
conversationToLoad: { conversation: Conversation; filePath: string } | null;
shouldDeactivateEditMode: boolean;
}
function createConversationStore() {
const { subscribe, set, update } = writable<IConversationStoreState>({
shouldReset: false,
conversationToLoad: null,
shouldDeactivateEditMode: false
});
return {
subscribe,
reset: () => set({ shouldReset: true, conversationToLoad: null, shouldDeactivateEditMode: true }),
clearResetFlag: () => update(state => ({ ...state, shouldReset: false })),
loadConversation: (conversation: Conversation, filePath: string) =>
set({ shouldReset: false, conversationToLoad: { conversation, filePath }, shouldDeactivateEditMode: true }),
clearLoadFlag: () => update(state => ({ ...state, conversationToLoad: null })),
clearEditModeFlag: () => update(state => ({ ...state, shouldDeactivateEditMode: false }))
};
}
export const conversationStore = createConversationStore();