generated from nhcarrigan/template
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user