feat: handle StopFailure hook event for API error turns (#224)

Parses [StopFailure Hook] from stderr, emits claude:stop-failure, and
transitions the character to error state with a toast notification.
This commit is contained in:
2026-03-20 09:30:17 -07:00
committed by Naomi Carrigan
parent efdc7af58a
commit 6c853ae73d
6 changed files with 256 additions and 3 deletions
+8 -1
View File
@@ -68,6 +68,13 @@ function createToastStore() {
setTimeout(() => remove(id), 4000);
}
function addError(message: string) {
const id = crypto.randomUUID();
const toast: InfoToast = { id, kind: "info", message, icon: "⚠️" };
update((toasts) => [...toasts, toast]);
setTimeout(() => remove(id), 6000);
}
function addAchievement(achievement: AchievementUnlockedEvent["achievement"]) {
const id = crypto.randomUUID();
const toast: AchievementToast = { id, kind: "achievement", achievement };
@@ -82,7 +89,7 @@ function createToastStore() {
// Update toasts are persistent — no auto-dismiss
}
return { subscribe, addInfo, addAchievement, addUpdate, remove };
return { subscribe, addInfo, addError, addAchievement, addUpdate, remove };
}
export const toastStore = createToastStore();