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
24 lines
No EOL
1 KiB
TypeScript
24 lines
No EOL
1 KiB
TypeScript
import type { Event } from "Enums/Event";
|
|
import { Events, type EventRef } from "obsidian";
|
|
|
|
export class EventService extends Events {
|
|
|
|
public on(name: Event.DiffOpened, callback: () => void): EventRef;
|
|
public on(name: Event.DiffClosed, callback: () => void): EventRef;
|
|
public on(name: Event.RateLimitCountdown, callback: (delayMs: number) => void): EventRef;
|
|
public on(name: Event.QuickActionsSettingsChanged, callback: (data?: unknown) => void): EventRef;
|
|
|
|
public on<T extends unknown[]>(name: string, callback: (...data: T) => unknown): EventRef {
|
|
return super.on(name, callback as (...data: unknown[]) => unknown);
|
|
}
|
|
|
|
public trigger(name: Event.DiffOpened, data?: unknown): void;
|
|
public trigger(name: Event.DiffClosed, data?: unknown): void;
|
|
public trigger(name: Event.RateLimitCountdown, delayMs: number): void;
|
|
public trigger(name: Event.QuickActionsSettingsChanged, data?: unknown): void;
|
|
|
|
public trigger(name: string, ...data: unknown[]): void {
|
|
super.trigger(name, ...data);
|
|
}
|
|
|
|
} |