mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
feat: add multi-run fusion and session change walkthroughs
Fuse two to five completed multi-run entries into one synthesized session, and explain a session's diff as ordered walkthrough stops cached by diff hash. - Multi-run fusion service, persistence, routes and FuseRunDialog - Change walkthrough service, persistence, routes and ChangesWalkthroughDialog - Shared unified-diff parser plus bounded text generation, json-extract, text-truncate and service-error helpers
This commit is contained in:
1 parent
90c6ccf236
commit
b36d412ca2
66 files changed
+6228
-468
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { generateChangeWalkthrough, getChangeWalkthrough } from '@/api/changeWalkthroughs'
|
||||
import type { GenerateChangeWalkthroughRequest } from '@opencode-manager/shared/schemas'
|
||||
|
||||
export function changeWalkthroughQueryKey(sessionId: string) {
|
||||
return ['change-walkthrough', sessionId] as const
|
||||
}
|
||||
|
||||
export function useChangeWalkthrough(sessionId: string | undefined, enabled: boolean) {
|
||||
return useQuery({
|
||||
queryKey: changeWalkthroughQueryKey(sessionId ?? ''),
|
||||
queryFn: () => getChangeWalkthrough(sessionId!),
|
||||
enabled: enabled && !!sessionId,
|
||||
staleTime: 30_000,
|
||||
})
|
||||
}
|
||||
|
||||
export function useGenerateChangeWalkthrough(sessionId: string | undefined) {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (request: GenerateChangeWalkthroughRequest) =>
|
||||
generateChangeWalkthrough(sessionId!, request),
|
||||
onSuccess: (walkthrough) => {
|
||||
queryClient.setQueryData(changeWalkthroughQueryKey(walkthrough.sessionId), {
|
||||
walkthrough,
|
||||
currentDiffHash: walkthrough.diffHash,
|
||||
stale: false,
|
||||
})
|
||||
queryClient.invalidateQueries({ queryKey: changeWalkthroughQueryKey(walkthrough.sessionId) })
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user