mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 06:42:03 +00:00
- 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
28 lines
1.2 KiB
TypeScript
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();
|