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:
Chris Scott committed 2026-10-06 15:27:14 -04:00
1 parent 90c6ccf236
commit b36d412ca2
66 files changed
+6228 -468

No files matched your search

+13
View File
@@ -63,6 +63,7 @@ import { useTerminalDialogParam } from "@/hooks/useOpenTerminal";
import { SessionMoreButton } from "@/components/navigation/SessionMoreButton";
import { SideQuestionDialog } from "@/components/session/SideQuestionDialog";
import { SessionMessagePickerDialog } from "@/components/session/SessionMessagePickerDialog";
import { ChangesWalkthroughDialog } from "@/components/session/ChangesWalkthroughDialog";
const OLDER_HISTORY_SCROLL_THRESHOLD_PX = 200
@@ -128,6 +129,7 @@ export function SessionDetail() {
const [actionsDialogOpen, setActionsDialogOpen] = useDialogParam('actions');
const [previewOpen, setPreviewOpen] = useDialogParam('preview');
const [resetPermissionsOpen, setResetPermissionsOpen] = useDialogParam('resetPermissions');
const [walkthroughOpen, setWalkthroughOpen] = useDialogParam('walkthrough');
const [selectedFilePath, setSelectedFilePath] = useState<string | undefined>();
const [showScrollButton, setShowScrollButton] = useState(false);
const [hasPromptContent, setHasPromptContent] = useState(false);
@@ -298,6 +300,7 @@ export function SessionDetail() {
const handleShowSessionsDialog = useCallback(() => setSessionsDialogOpen(true), []);
const handleShowMcpDialog = useCallback(() => setMcpDialogOpen(true), [setMcpDialogOpen]);
const handleShowSkillsDialog = useCallback(() => setSkillsDialogOpen(true), [setSkillsDialogOpen]);
const handleShowWalkthrough = useCallback(() => setWalkthroughOpen(true), [setWalkthroughOpen]);
const handleConnectProvider = useCallback(() => setSettingsTab('providers'), [setSettingsTab]);
const handleMinimizeForm = useCallback((form: FormInfo) => {
@@ -580,6 +583,7 @@ export function SessionDetail() {
redo: handleRedo,
showMcp: handleShowMcpDialog,
showSkills: handleShowSkillsDialog,
showWalkthrough: handleShowWalkthrough,
showSettings: openSettings,
connectProvider: handleConnectProvider,
}), [
@@ -598,6 +602,7 @@ export function SessionDetail() {
handleRedo,
handleShowMcpDialog,
handleShowSkillsDialog,
handleShowWalkthrough,
openSettings,
handleConnectProvider,
]);
@@ -874,6 +879,14 @@ export function SessionDetail() {
/>
)}
{sessionId && (
<ChangesWalkthroughDialog
sessionId={sessionId}
open={walkthroughOpen}
onOpenChange={setWalkthroughOpen}
/>
)}
<RepoMcpDialog
open={mcpDialogOpen}
onOpenChange={setMcpDialogOpen}
@@ -202,6 +202,7 @@ vi.mock('@/hooks/useSessionGoals', () => ({
useCancelSessionGoal: vi.fn(() => ({ mutate: vi.fn(), isPending: false })),
}))
vi.mock('@/components/session/SideQuestionDialog', () => ({ SideQuestionDialog: vi.fn(() => null) }))
vi.mock('@/components/session/ChangesWalkthroughDialog', () => ({ ChangesWalkthroughDialog: vi.fn(() => null) }))
vi.mock('@/components/session/SessionList', () => ({ SessionList: vi.fn(() => null) }))
vi.mock('@/components/file-browser/FileBrowserSheet', () => ({ FileBrowserSheet: vi.fn(() => null) }))
vi.mock('@/components/repo/RepoMcpDialog', () => ({ RepoMcpDialog: vi.fn(() => null) }))
@@ -293,6 +294,7 @@ describe('SessionDetail command actions', () => {
skills: vi.fn(),
sourceControl: vi.fn(),
resetPermissions: vi.fn(),
walkthrough: vi.fn(),
}
mocks.useSessionStatusForSession.mockReturnValue({ type: 'idle' })
mocks.compactSession.mockResolvedValue(undefined)
@@ -689,6 +691,17 @@ describe('SessionDetail command actions', () => {
expect(mocks.dialogSetters.skills).toHaveBeenCalledWith(true)
})
it('opens the walkthrough dialog from the showWalkthrough command action', async () => {
renderSessionDetail()
const showWalkthrough = await commandHandler('showWalkthrough')
await act(async () => {
await showWalkthrough()
})
expect(mocks.dialogSetters.walkthrough).toHaveBeenCalledWith(true)
})
it('opens settings from the showSettings command action', async () => {
renderSessionDetail()
const showSettings = await commandHandler('showSettings')