feat: handle PostCompact hook event (#225)

Parses [PostCompact Hook] from stderr, emits claude:post-compact, shows
a toast notification, and briefly sets the character to success state.
This commit is contained in:
2026-03-20 09:38:23 -07:00
committed by Naomi Carrigan
parent 6c853ae73d
commit feb500ba2b
4 changed files with 115 additions and 2 deletions
+7
View File
@@ -10,6 +10,7 @@ import type {
ConnectionStatus,
ElicitationEvent,
PermissionPromptEvent,
PostCompactEvent,
StopFailureEvent,
UserQuestionEvent,
} from "$lib/types/messages";
@@ -659,6 +660,12 @@ export async function initializeTauriListeners() {
toastStore.addError(message);
});
unlisteners.push(stopFailureUnlisten);
const postCompactUnlisten = await listen<PostCompactEvent>("claude:post-compact", () => {
toastStore.addInfo("Context compacted", "🗜️");
characterState.setTemporaryState("success", 2000);
});
unlisteners.push(postCompactUnlisten);
}
export function cleanupTauriListeners() {
+5
View File
@@ -182,6 +182,11 @@ export interface StopFailureEvent {
conversation_id?: string;
}
export interface PostCompactEvent {
session_id?: string;
conversation_id?: string;
}
export type ConnectionStatus = "disconnected" | "connecting" | "connected" | "error";
export interface Attachment {