From daa1c77498cbda00b49863b60bc27d0c20219cad Mon Sep 17 00:00:00 2001 From: janpeter visser Date: Fri, 1 May 2026 12:18:29 +0200 Subject: [PATCH] feat: add verify_result+pushed_at to JobState, VerifyResultApi type, SSE payload Co-Authored-By: Claude Sonnet 4.6 --- app/api/realtime/solo/route.ts | 4 +++- stores/solo-store.ts | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/api/realtime/solo/route.ts b/app/api/realtime/solo/route.ts index 98643bf..575ea6c 100644 --- a/app/api/realtime/solo/route.ts +++ b/app/api/realtime/solo/route.ts @@ -46,6 +46,7 @@ type JobPayload = { status: string branch?: string pushed_at?: string + verify_result?: string summary?: string error?: string } @@ -259,7 +260,7 @@ async function prisma_jobs_findActive(userId: string, productId: string) { ], }, select: { - id: true, task_id: true, status: true, branch: true, pushed_at: true, summary: true, error: true, + id: true, task_id: true, status: true, branch: true, pushed_at: true, verify_result: true, summary: true, error: true, }, orderBy: { created_at: 'asc' }, }) @@ -269,6 +270,7 @@ async function prisma_jobs_findActive(userId: string, productId: string) { status: jobStatusToApi(j.status), branch: j.branch ?? undefined, pushed_at: j.pushed_at?.toISOString() ?? undefined, + verify_result: j.verify_result?.toLowerCase() as import('@/stores/solo-store').VerifyResultApi | undefined, summary: j.summary ?? undefined, error: j.error ?? undefined, })) diff --git a/stores/solo-store.ts b/stores/solo-store.ts index 75db95d..a89be3e 100644 --- a/stores/solo-store.ts +++ b/stores/solo-store.ts @@ -4,19 +4,22 @@ import type { ClaudeJobStatusApi } from '@/lib/job-status' type TaskStatus = SoloTask['status'] +export type VerifyResultApi = 'aligned' | 'partial' | 'empty' | 'divergent' + export interface JobState { job_id: string task_id: string status: ClaudeJobStatusApi branch?: string pushed_at?: string | null + verify_result?: VerifyResultApi | null summary?: string error?: string } export type ClaudeJobEvent = | { type: 'claude_job_enqueued'; job_id: string; task_id: string; user_id: string; product_id: string; status: 'queued' } - | { type: 'claude_job_status'; job_id: string; task_id: string; user_id: string; product_id: string; status: ClaudeJobStatusApi; branch?: string; pushed_at?: string; summary?: string; error?: string } + | { type: 'claude_job_status'; job_id: string; task_id: string; user_id: string; product_id: string; status: ClaudeJobStatusApi; branch?: string; pushed_at?: string; verify_result?: VerifyResultApi; summary?: string; error?: string } // Payload-shape gepubliceerd door de Postgres-trigger via pg_notify (ST-801 // + ST-804 prereq). Komt het Solo Paneel binnen via de SSE-stream uit @@ -64,6 +67,7 @@ interface SoloStore { optimisticMove: (taskId: string, toStatus: TaskStatus) => TaskStatus | null rollback: (taskId: string, prevStatus: TaskStatus) => void updatePlan: (taskId: string, plan: string | null) => void + updateVerifyOnly: (taskId: string, value: boolean) => void markPending: (taskId: string) => void clearPending: (taskId: string) => void @@ -104,6 +108,9 @@ export const useSoloStore = create((set, get) => ({ updatePlan: (taskId, plan) => set((s) => ({ tasks: { ...s.tasks, [taskId]: { ...s.tasks[taskId], implementation_plan: plan } } })), + updateVerifyOnly: (taskId, value) => + set((s) => ({ tasks: { ...s.tasks, [taskId]: { ...s.tasks[taskId], verify_only: value } } })), + markPending: (taskId) => set((s) => { if (s.pendingOps.has(taskId)) return s @@ -147,7 +154,7 @@ export const useSoloStore = create((set, get) => ({ return } if (event.type === 'claude_job_status') { - const { status, branch, pushed_at, summary, error } = event + const { status, branch, pushed_at, verify_result, summary, error } = event if (status === 'cancelled') { set((s) => { const next = { ...s.claudeJobsByTaskId } @@ -159,7 +166,7 @@ export const useSoloStore = create((set, get) => ({ set((s) => ({ claudeJobsByTaskId: { ...s.claudeJobsByTaskId, - [task_id]: { job_id, task_id, status, branch, pushed_at, summary, error }, + [task_id]: { job_id, task_id, status, branch, pushed_at, verify_result, summary, error }, }, })) }