Add force stop feature for running agents on kanban cards

This commit is contained in:
Cody Seibert
2025-12-09 01:22:53 -05:00
parent f4df08f9b4
commit ca646f2acb
4 changed files with 73 additions and 17 deletions

View File

@@ -180,6 +180,35 @@ export function useAutoMode() {
}
}, [setAutoModeRunning, clearRunningTasks]);
// Stop a specific feature
const stopFeature = useCallback(async (featureId: string) => {
try {
const api = getElectronAPI();
if (!api?.autoMode?.stopFeature) {
throw new Error("Stop feature API not available");
}
const result = await api.autoMode.stopFeature(featureId);
if (result.success) {
removeRunningTask(featureId);
console.log("[AutoMode] Feature stopped successfully:", featureId);
addAutoModeActivity({
featureId,
type: "complete",
message: "Feature stopped by user",
passes: false,
});
} else {
console.error("[AutoMode] Failed to stop feature:", result.error);
throw new Error(result.error || "Failed to stop feature");
}
} catch (error) {
console.error("[AutoMode] Error stopping feature:", error);
throw error;
}
}, [removeRunningTask, addAutoModeActivity]);
return {
isRunning: isAutoModeRunning,
runningTasks: runningAutoTasks,
@@ -187,5 +216,6 @@ export function useAutoMode() {
canStartNewTask,
start,
stop,
stopFeature,
};
}