Add "Start Workflow" button to trigger CEO agent from web UI
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 49s

New endpoint POST /api/cases/{case_number}/start-workflow creates a
Paperclip issue, wakes the CEO agent via wakeup API, and transitions
case status to "processing". Button appears on case page only when
status is "new" or "documents_ready".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 15:51:23 +00:00
parent 82ba4663ba
commit 6228846223
4 changed files with 200 additions and 3 deletions

View File

@@ -167,6 +167,32 @@ export function useGitStatus(caseNumber: string | undefined) {
});
}
export type StartWorkflowResult = {
case_number: string;
status: string;
issue_id: string;
issue_identifier: string;
project_url: string;
wakeup: Record<string, unknown>;
};
export function useStartWorkflow(caseNumber: string | undefined) {
const qc = useQueryClient();
return useMutation({
mutationFn: () =>
apiRequest<StartWorkflowResult>(
`/api/cases/${caseNumber}/start-workflow`,
{ method: "POST" },
),
onSuccess: () => {
qc.invalidateQueries({ queryKey: casesKeys.all });
if (caseNumber) {
qc.invalidateQueries({ queryKey: casesKeys.detail(caseNumber) });
}
},
});
}
export function useWorkflowStatus(caseNumber: string | undefined) {
return useQuery({
queryKey: [...casesKeys.all, "workflow", caseNumber ?? ""] as const,