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
@@ -1,8 +1,8 @@
|
||||
import { useMutation, useQuery, useQueryClient, type QueryClient } from '@tanstack/react-query'
|
||||
import { discardMultiRunEntry, launchMultiRun, listMultiRuns } from '@/api/multiRuns'
|
||||
import { discardMultiRunEntry, fuseMultiRun, launchMultiRun, listMultiRuns } from '@/api/multiRuns'
|
||||
import { repoSiblingsQueryKey } from '@/hooks/useRepoSiblings'
|
||||
import { showToast } from '@/lib/toast'
|
||||
import type { LaunchMultiRunRequest, MultiRun } from '@opencode-manager/shared/schemas'
|
||||
import type { FuseMultiRunRequest, LaunchMultiRunRequest, MultiRun } from '@opencode-manager/shared/schemas'
|
||||
|
||||
function multiRunQueryKey(repoId: number) {
|
||||
return ['multi-runs', repoId] as const
|
||||
@@ -49,6 +49,27 @@ export function useLaunchMultiRun(repoId: number) {
|
||||
})
|
||||
}
|
||||
|
||||
export function useFuseMultiRun(repoId: number) {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({ runId, request }: { runId: number; request: FuseMultiRunRequest }) =>
|
||||
fuseMultiRun(runId, request),
|
||||
onSuccess: (run, variables) => {
|
||||
invalidateMultiRunCaches(queryClient, repoId)
|
||||
const fusion = run.fusions.find((candidate) => candidate.requestId === variables.request.requestId)
|
||||
if (fusion?.status === 'started') {
|
||||
showToast.success('Fusion started')
|
||||
} else if (fusion?.status === 'failed') {
|
||||
showToast.error(fusion.error || 'Fusion failed')
|
||||
}
|
||||
},
|
||||
onError: () => {
|
||||
invalidateMultiRunCaches(queryClient, repoId)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function useDiscardMultiRunEntry(repoId: number) {
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
|
||||
Reference in new issue
Block a user