mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 06:42:03 +00:00
- Change ChatMode enum values from numeric (0,1,2) to string literals ("read_only", "edit", "planning")
- Move chat mode state management from ChatWindow to SettingsService with persistence
- Add chat mode awareness to system prompts and tool validation
- Replace Map with WeakMap for settings subscribers to prevent memory leaks
- Add type-safe event handlers to EventService
- Update esbuild and TypeScript targets from ES2018/ES2020 to ES2022
- Add requiresEditModeEnabled() validation to prevent tool hallucination in read-only mode
- Update all test fixtures to include chatMode in mock settings
25 lines
948 B
TypeScript
25 lines
948 B
TypeScript
import { writable } from 'svelte/store';
|
|
import type { Conversation } from 'Conversations/Conversation';
|
|
|
|
interface IConversationStoreState {
|
|
shouldReset: boolean;
|
|
conversationToLoad: { conversation: Conversation; filePath: string } | null;
|
|
}
|
|
|
|
function createConversationStore() {
|
|
const { subscribe, set, update } = writable<IConversationStoreState>({
|
|
shouldReset: false,
|
|
conversationToLoad: null,
|
|
});
|
|
|
|
return {
|
|
subscribe,
|
|
reset: () => set({ shouldReset: true, conversationToLoad: null }),
|
|
clearResetFlag: () => update(state => ({ ...state, shouldReset: false })),
|
|
loadConversation: (conversation: Conversation, filePath: string) =>
|
|
set({ shouldReset: false, conversationToLoad: { conversation, filePath } }),
|
|
clearLoadFlag: () => update(state => ({ ...state, conversationToLoad: null })),
|
|
};
|
|
}
|
|
|
|
export const conversationStore = createConversationStore();
|