@devries-cameron20 / t3code-1 / commits / 9f087f782c
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

refactor(web): ChatView's revert, rollback, and fork live in useTimelineRewind (#23066)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 21, 2026 at 13:40 UTC 9f087f782c2357f3c08b79266e23e3b2299626c1
2 files changed +316 -195
apps/web/src/components/ChatView.tsx
+29 -195
@@ -1,3 +1,4 @@
1 +import { useTimelineRewind } from "./chat/useTimelineRewind";
2 import { useThreadLifecycle } from "./chat/useThreadLifecycle";
3 import { useRightPanelActions } from "./chat/useRightPanelActions";
4 import { type TerminalLaunchContext, useChatTerminalActions } from "./chat/useChatTerminalActions";
@@ -119,7 +120,6 @@ import {
120 } from "@t3tools/client-runtime/state/runtime";
121 import { AsyncResult } from "effect/reactivity";
122 import { isElectron } from "../env";
122 -import { readLocalApi } from "../localApi";
123 import { useDiffPanelStore } from "../diffPanelStore";
124 import { useActiveThreadRef } from "../hooks/useActiveThreadRef";
125 import { composerRequiresModifier } from "../composer-logic";
@@ -208,7 +208,7 @@ import {
208 deriveLogicalProjectKeyFromSettings,
209 selectProjectGroupingSettings,
210 } from "../logicalProject";
211 -import { buildDraftThreadRouteParams, buildThreadRouteParams } from "../threadRoutes";
211 +import { buildDraftThreadRouteParams } from "../threadRoutes";
212 import {
213 isSameSidebarThreadRef,
214 useSidebarPendingFileDropStore,
@@ -255,7 +255,6 @@ import {
255 useQuietThreadShell,
256 useThreadVisibleTurnItems,
257 useThreadCheckpointSummaries,
258 - waitForThreadShell,
258 } from "../state/entities";
259 import { useEnvironmentShellHasSnapshot } from "../state/shell";
260 import { ChatComposer, type ChatComposerHandle } from "./chat/ChatComposer";
@@ -266,7 +265,6 @@ import {
265 DeviceSetupDialogHost,
266 openBranchRestoreConfirm,
267 openPullRequestThreadDialog,
269 - openRevertConfirm,
268 PullRequestThreadDialogHost,
269 RevertConfirmHost,
270 } from "./chat/ChatOverlayHosts";
@@ -375,7 +373,7 @@ import {
373 } from "./chat/useSystemComposerBanners";
374 import { useDraftHeroLayoutTransition } from "./chat/useDraftHeroLayoutTransition";
375 import { useLocalDispatchState } from "./chat/useLocalDispatchState";
378 -import { draftFanoutSelectionsAtom, draftSendState, rewindToMessage } from "./chat/chatViewSend";
376 +import { draftFanoutSelectionsAtom, draftSendState } from "./chat/chatViewSend";
377 import {
378 isCompactCommandMessage,
379 type LocalThreadErrorEntry,
@@ -467,12 +465,6 @@ export default function ChatView(props: ChatViewProps) {
465 label: "load earlier thread history",
466 reportFailure: false,
467 });
470 - const revertThreadCheckpoint = useOrchestrationCommand(threadEnvironment.revertCheckpoint, {
471 - reportFailure: false,
472 - });
473 - const forkThreadFromRun = useAtomCommand(threadEnvironment.forkFromRun, {
474 - reportFailure: false,
475 - });
468 const { environments } = useEnvironments();
469 const providersByEnvironment = useEnvironmentProviders();
470 const primaryEnvironment = usePrimaryEnvironment();
@@ -3455,179 +3447,32 @@ export default function ChatView(props: ChatViewProps) {
3447 window.removeEventListener("paste", handler, true);
3448 };
3449 }, [activeThreadId, composerRef]);
3458 -
3459 - const onRevertToTurnCount = async (
3460 - turnCount: number,
3461 - messageId: MessageId,
3462 - restoreFiles?: boolean,
3463 - ) => {
3464 - const localApi = readLocalApi();
3465 - if (
3466 - !localApi ||
3467 - !activeThread ||
3468 - isRevertingCheckpoint ||
3469 - !readEnvironmentScope(environmentId, AuthOrchestrationOperateScope)
3470 - )
3471 - return;
3472 - const message = timelineMessages.find((message) => message.id === messageId);
3473 - if (!message || message.role !== "user") return;
3474 -
3475 - if (!supportsConversationRollback) {
3476 - setThreadError(
3477 - activeThread.id,
3478 - "This provider does not support reverting conversation history. Start a new thread instead.",
3479 - );
3480 - return;
3481 - }
3482 - if (activeEnvironmentUnavailable && activeEnvironmentUnavailableLabel) {
3483 - setThreadError(
3484 - activeThread.id,
3485 - `Reconnect ${activeEnvironmentUnavailableLabel} before reverting checkpoints.`,
3486 - );
3487 - return;
3488 - }
3489 - if (phase === "running" || isSendBusy || isConnecting) {
3490 - setThreadError(activeThread.id, "Interrupt the current turn before reverting checkpoints.");
3491 - return;
3492 - }
3493 - if (restoreFiles === undefined) {
3494 - openRevertConfirm(routeThreadKey, { turnCount, messageId });
3495 - return;
3496 - }
3497 -
3498 - useComposerDraftStore.setState((store) => ({
3499 - rewindingThreadKeys: new Set(store.rewindingThreadKeys).add(routeThreadKey),
3500 - }));
3501 - setThreadError(activeThread.id, null);
3502 - const rewind = await rewindToMessage({
3503 - message,
3504 - environmentId,
3505 - routeThreadRef,
3506 - threadId: activeThread.id,
3507 - turnCount,
3508 - restoreFiles,
3509 - // Keep the live checkpoint identity when command context refetches a bounded window.
3510 - checkpoint: findRevertCheckpoint(serverProjection?.checkpoints ?? [], turnCount),
3511 - draftTarget: composerDraftTarget,
3512 - composerHasPendingAttachments: composerRef.current?.hasPendingAttachments() === true,
3513 - createAssetUrl: createAttachmentAssetUrl,
3514 - revertThreadCheckpoint,
3515 - });
3516 - useComposerDraftStore.setState((store) => {
3517 - const remaining = new Set(store.rewindingThreadKeys);
3518 - remaining.delete(routeThreadKey);
3519 - return { rewindingThreadKeys: remaining };
3520 - });
3521 - if (rewind.error !== null) {
3522 - setThreadError(activeThread.id, rewind.error);
3523 - return;
3524 - }
3525 - if (currentRouteThreadKeyRef.current === routeThreadKey) {
3526 - const nextPrompt = rewind.prompt;
3527 - promptRef.current = nextPrompt;
3528 - composerRef.current?.resetCursorState({ prompt: nextPrompt, cursor: nextPrompt.length });
3529 - requestAnimationFrame(() => {
3530 - if (currentRouteThreadKeyRef.current === routeThreadKey) composerRef.current?.focusAtEnd();
3531 - });
3532 - }
3533 - };
3534 - const onRevertToTurnCountStable = useStableCallback(onRevertToTurnCount);
3535 - const onConfirmRevert = (turnCount: number, messageId: MessageId, restoreFiles: boolean) => {
3536 - void onRevertToTurnCount(turnCount, messageId, restoreFiles);
3537 - };
3538 - const onConfirmRevertStable = useStableCallback(onConfirmRevert);
3539 -
3540 - const onRollbackCheckpoint = async (input: {
3541 - readonly checkpointId: string;
3542 - readonly scopeId: string;
3543 - }) => {
3544 - if (!activeThread || isRevertingCheckpoint) return;
3545 - if (activeEnvironmentUnavailable && activeEnvironmentUnavailableLabel) {
3546 - setThreadError(
3547 - activeThread.id,
3548 - `Reconnect ${activeEnvironmentUnavailableLabel} before reverting checkpoints.`,
3549 - );
3550 - return;
3551 - }
3552 - if (phase === "running" || isSendBusy || isConnecting) {
3553 - setThreadError(activeThread.id, "Interrupt the current turn before reverting checkpoints.");
3554 - return;
3555 - }
3556 - const localApi = readLocalApi();
3557 - const confirmed =
3558 - localApi == null
3559 - ? window.confirm("Roll back this thread to the selected checkpoint?")
3560 - : await localApi.dialogs.confirm(
3561 - "Roll back this thread to the selected checkpoint?\nThis action cannot be undone.",
3562 - );
3563 - if (!confirmed) return;
3564 -
3565 - useComposerDraftStore.setState((store) => ({
3566 - rewindingThreadKeys: new Set(store.rewindingThreadKeys).add(routeThreadKey),
3567 - }));
3568 - setThreadError(activeThread.id, null);
3569 - const result = await revertThreadCheckpoint({
3570 - environmentId,
3571 - input: {
3572 - threadId: activeThread.id,
3573 - checkpointId: input.checkpointId,
3574 - scopeId: input.scopeId,
3575 - },
3576 - });
3577 - if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
3578 - const error = squashAtomCommandFailure(result);
3579 - setThreadError(
3580 - activeThread.id,
3581 - error instanceof Error ? error.message : "Failed to revert thread state.",
3582 - );
3583 - }
3584 - useComposerDraftStore.setState((store) => {
3585 - const remaining = new Set(store.rewindingThreadKeys);
3586 - remaining.delete(routeThreadKey);
3587 - return { rewindingThreadKeys: remaining };
3588 - });
3589 - };
3590 -
3591 - const onForkFromRun = async (input: {
3592 - readonly sourceThreadId: ThreadId;
3593 - readonly runId: RunId;
3594 - }) => {
3595 - if (!activeThread || activeEnvironmentUnavailable) return;
3596 - const targetThreadId = newThreadId();
3597 - const targetThreadRef = scopeThreadRef(environmentId, targetThreadId);
3598 - const result = await forkThreadFromRun({
3599 - environmentId,
3600 - input: {
3601 - sourceThreadId: input.sourceThreadId,
3602 - targetThreadId,
3603 - runId: input.runId,
3604 - title: `${activeThread.title} fork`,
3605 - },
3606 - });
3607 - if (result._tag === "Failure") {
3608 - if (!isAtomCommandInterrupted(result)) {
3609 - const error = squashAtomCommandFailure(result);
3610 - setThreadError(
3611 - activeThread.id,
3612 - error instanceof Error ? error.message : "Failed to fork this response.",
3613 - );
3614 - }
3615 - return;
3616 - }
3617 - const targetThreadReady = await waitForThreadShell(targetThreadRef);
3618 - if (!targetThreadReady) {
3619 - setThreadError(
3620 - activeThread.id,
3621 - "The fork was created, but its thread data did not reach this client. Reconnect and try opening it from the sidebar.",
3622 - );
3623 - return;
3624 - }
3625 - await navigate({
3626 - to: "/$environmentId/$threadId",
3627 - params: buildThreadRouteParams(targetThreadRef),
3628 - });
3629 - };
3630 - const onForkFromRunStable = useStableCallback(onForkFromRun);
3450 + const {
3451 + onConfirmRevertStable,
3452 + onForkFromRunStable,
3453 + onRevertTimelineTurnStable,
3454 + onTimelineRollbackCheckpointStable,
3455 + } = useTimelineRewind({
3456 + environmentId,
3457 + routeThreadRef,
3458 + routeThreadKey,
3459 + currentRouteThreadKeyRef,
3460 + serverProjection,
3461 + activeThread,
3462 + timelineMessages,
3463 + paintOnlyDisplayedTimeline,
3464 + phase,
3465 + isConnecting,
3466 + isSendBusy,
3467 + isRevertingCheckpoint,
3468 + supportsConversationRollback,
3469 + activeEnvironmentUnavailable,
3470 + activeEnvironmentUnavailableLabel,
3471 + promptRef,
3472 + composerRef,
3473 + composerDraftTarget,
3474 + setThreadError,
3475 + });
3476 const onCompactContext = () => {
3477 if (compactDisabled) return;
3478 void sendStandaloneCommand("/compact", "Failed to compact context.");
@@ -3933,17 +3778,6 @@ export default function ChatView(props: ChatViewProps) {
3778 openExpandedImagePreview(routeThreadKey, preview);
3779 };
3780 const onExpandTimelineImageStable = useStableCallback(onExpandTimelineImage);
3936 - const onTimelineRollbackCheckpoint = (input: {
3937 - readonly checkpointId: string;
3938 - readonly scopeId: string;
3939 - }) => {
3940 - if (!paintOnlyDisplayedTimeline) void onRollbackCheckpoint(input);
3941 - };
3942 - const onTimelineRollbackCheckpointStable = useStableCallback(onTimelineRollbackCheckpoint);
3943 - const onRevertTimelineTurn = (targetTurnCount: number, messageId: MessageId) => {
3944 - void onRevertToTurnCountStable(targetTurnCount, messageId);
3945 - };
3946 - const onRevertTimelineTurnStable = useStableCallback(onRevertTimelineTurn);
3781
3782 const pendingSidebarFileDrops = useSidebarPendingFileDropStore((state) => state.pending);
3783 const consumePendingFileDrop = useSidebarPendingFileDropStore(
apps/web/src/components/chat/useTimelineRewind.ts new
+287
@@ -0,0 +1,287 @@
1 +import type { EnvironmentThread } from "@t3tools/client-runtime/state/shell";
2 +import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
3 +import type { ComposerThreadTarget } from "../../composerDraftStore";
4 +import type { ComposerHandleRef } from "../../composerHandleContext";
5 +import type { SessionPhase } from "../../types";
6 +import { useStableCallback } from "../../hooks/useStableCallback";
7 +import {
8 + AuthOrchestrationOperateScope,
9 + type EnvironmentId,
10 + type MessageId,
11 + type ScopedThreadRef,
12 + type ThreadId,
13 + type RunId,
14 +} from "@t3tools/contracts";
15 +import { scopeThreadRef } from "@t3tools/client-runtime/environment";
16 +import { useNavigate } from "@tanstack/react-router";
17 +import {
18 + isAtomCommandInterrupted,
19 + squashAtomCommandFailure,
20 +} from "@t3tools/client-runtime/state/runtime";
21 +import { readLocalApi } from "../../localApi";
22 +import { findRevertCheckpoint } from "../../session-logic";
23 +import { type ChatMessage } from "../../types";
24 +import { newThreadId } from "~/lib/utils";
25 +import { buildThreadRouteParams } from "../../threadRoutes";
26 +import { useComposerDraftStore } from "../../composerDraftStore";
27 +import { threadEnvironment } from "../../state/threads";
28 +import { waitForThreadShell } from "../../state/entities";
29 +import { openRevertConfirm } from "./ChatOverlayHosts";
30 +import { assetEnvironment } from "../../state/assets";
31 +import { readEnvironmentScope } from "../../state/session";
32 +import { useAtomCommand } from "../../state/use-atom-command";
33 +import { useOrchestrationCommand } from "../../state/use-orchestration-command";
34 +import { useAtomQueryRunner } from "../../state/use-atom-query-runner";
35 +import { rewindToMessage } from "./chatViewSend";
36 +import { makeThreadErrorSetter } from "../ChatView.logic";
37 +interface TimelineRewindInput {
38 + readonly environmentId: EnvironmentId;
39 + readonly routeThreadRef: ScopedThreadRef;
40 + readonly routeThreadKey: string;
41 + readonly currentRouteThreadKeyRef: { readonly current: string | null };
42 + readonly serverProjection: EnvironmentThread["projection"] | null;
43 + readonly activeThread: EnvironmentThreadShell | undefined;
44 + readonly timelineMessages: ReadonlyArray<ChatMessage>;
45 + readonly paintOnlyDisplayedTimeline: boolean;
46 + readonly phase: SessionPhase;
47 + readonly isConnecting: boolean;
48 + readonly isSendBusy: boolean;
49 + readonly isRevertingCheckpoint: boolean;
50 + readonly supportsConversationRollback: boolean;
51 + readonly activeEnvironmentUnavailable: boolean;
52 + readonly activeEnvironmentUnavailableLabel: string | null;
53 + readonly promptRef: { current: string };
54 + readonly composerRef: ComposerHandleRef;
55 + readonly composerDraftTarget: ComposerThreadTarget;
56 + readonly setThreadError: ReturnType<typeof makeThreadErrorSetter>;
57 +}
58 +
59 +/**
60 + * Going back in a thread's timeline: reverting to an earlier turn (restoring that message into
61 + * the composer), rolling back a provider checkpoint, and forking a new thread from a run.
62 + */
63 +export function useTimelineRewind(input: TimelineRewindInput) {
64 + const {
65 + environmentId,
66 + routeThreadRef,
67 + routeThreadKey,
68 + currentRouteThreadKeyRef,
69 + serverProjection,
70 + activeThread,
71 + timelineMessages,
72 + paintOnlyDisplayedTimeline,
73 + phase,
74 + isConnecting,
75 + isSendBusy,
76 + isRevertingCheckpoint,
77 + supportsConversationRollback,
78 + activeEnvironmentUnavailable,
79 + activeEnvironmentUnavailableLabel,
80 + promptRef,
81 + composerRef,
82 + composerDraftTarget,
83 + setThreadError,
84 + } = input;
85 + const navigate = useNavigate();
86 + const createAttachmentAssetUrl = useAtomQueryRunner(assetEnvironment.createUrl, {
87 + reportFailure: false,
88 + refresh: true,
89 + });
90 +
91 + const revertThreadCheckpoint = useOrchestrationCommand(threadEnvironment.revertCheckpoint, {
92 + reportFailure: false,
93 + });
94 + const forkThreadFromRun = useAtomCommand(threadEnvironment.forkFromRun, {
95 + reportFailure: false,
96 + });
97 +
98 + const onRevertToTurnCount = async (
99 + turnCount: number,
100 + messageId: MessageId,
101 + restoreFiles?: boolean,
102 + ) => {
103 + const localApi = readLocalApi();
104 + if (
105 + !localApi ||
106 + !activeThread ||
107 + isRevertingCheckpoint ||
108 + !readEnvironmentScope(environmentId, AuthOrchestrationOperateScope)
109 + )
110 + return;
111 + const message = timelineMessages.find((message) => message.id === messageId);
112 + if (!message || message.role !== "user") return;
113 +
114 + if (!supportsConversationRollback) {
115 + setThreadError(
116 + activeThread.id,
117 + "This provider does not support reverting conversation history. Start a new thread instead.",
118 + );
119 + return;
120 + }
121 + if (activeEnvironmentUnavailable && activeEnvironmentUnavailableLabel) {
122 + setThreadError(
123 + activeThread.id,
124 + `Reconnect ${activeEnvironmentUnavailableLabel} before reverting checkpoints.`,
125 + );
126 + return;
127 + }
128 + if (phase === "running" || isSendBusy || isConnecting) {
129 + setThreadError(activeThread.id, "Interrupt the current turn before reverting checkpoints.");
130 + return;
131 + }
132 + if (restoreFiles === undefined) {
133 + openRevertConfirm(routeThreadKey, { turnCount, messageId });
134 + return;
135 + }
136 +
137 + useComposerDraftStore.setState((store) => ({
138 + rewindingThreadKeys: new Set(store.rewindingThreadKeys).add(routeThreadKey),
139 + }));
140 + setThreadError(activeThread.id, null);
141 + const rewind = await rewindToMessage({
142 + message,
143 + environmentId,
144 + routeThreadRef,
145 + threadId: activeThread.id,
146 + turnCount,
147 + restoreFiles,
148 + // Keep the live checkpoint identity when command context refetches a bounded window.
149 + checkpoint: findRevertCheckpoint(serverProjection?.checkpoints ?? [], turnCount),
150 + draftTarget: composerDraftTarget,
151 + composerHasPendingAttachments: composerRef.current?.hasPendingAttachments() === true,
152 + createAssetUrl: createAttachmentAssetUrl,
153 + revertThreadCheckpoint,
154 + });
155 + useComposerDraftStore.setState((store) => {
156 + const remaining = new Set(store.rewindingThreadKeys);
157 + remaining.delete(routeThreadKey);
158 + return { rewindingThreadKeys: remaining };
159 + });
160 + if (rewind.error !== null) {
161 + setThreadError(activeThread.id, rewind.error);
162 + return;
163 + }
164 + if (currentRouteThreadKeyRef.current === routeThreadKey) {
165 + const nextPrompt = rewind.prompt;
166 + promptRef.current = nextPrompt;
167 + composerRef.current?.resetCursorState({ prompt: nextPrompt, cursor: nextPrompt.length });
168 + requestAnimationFrame(() => {
169 + if (currentRouteThreadKeyRef.current === routeThreadKey) composerRef.current?.focusAtEnd();
170 + });
171 + }
172 + };
173 + const onRevertToTurnCountStable = useStableCallback(onRevertToTurnCount);
174 + const onConfirmRevert = (turnCount: number, messageId: MessageId, restoreFiles: boolean) => {
175 + void onRevertToTurnCount(turnCount, messageId, restoreFiles);
176 + };
177 + const onConfirmRevertStable = useStableCallback(onConfirmRevert);
178 +
179 + const onRollbackCheckpoint = async (input: {
180 + readonly checkpointId: string;
181 + readonly scopeId: string;
182 + }) => {
183 + if (!activeThread || isRevertingCheckpoint) return;
184 + if (activeEnvironmentUnavailable && activeEnvironmentUnavailableLabel) {
185 + setThreadError(
186 + activeThread.id,
187 + `Reconnect ${activeEnvironmentUnavailableLabel} before reverting checkpoints.`,
188 + );
189 + return;
190 + }
191 + if (phase === "running" || isSendBusy || isConnecting) {
192 + setThreadError(activeThread.id, "Interrupt the current turn before reverting checkpoints.");
193 + return;
194 + }
195 + const localApi = readLocalApi();
196 + const confirmed =
197 + localApi == null
198 + ? window.confirm("Roll back this thread to the selected checkpoint?")
199 + : await localApi.dialogs.confirm(
200 + "Roll back this thread to the selected checkpoint?\nThis action cannot be undone.",
201 + );
202 + if (!confirmed) return;
203 +
204 + useComposerDraftStore.setState((store) => ({
205 + rewindingThreadKeys: new Set(store.rewindingThreadKeys).add(routeThreadKey),
206 + }));
207 + setThreadError(activeThread.id, null);
208 + const result = await revertThreadCheckpoint({
209 + environmentId,
210 + input: {
211 + threadId: activeThread.id,
212 + checkpointId: input.checkpointId,
213 + scopeId: input.scopeId,
214 + },
215 + });
216 + if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
217 + const error = squashAtomCommandFailure(result);
218 + setThreadError(
219 + activeThread.id,
220 + error instanceof Error ? error.message : "Failed to revert thread state.",
221 + );
222 + }
223 + useComposerDraftStore.setState((store) => {
224 + const remaining = new Set(store.rewindingThreadKeys);
225 + remaining.delete(routeThreadKey);
226 + return { rewindingThreadKeys: remaining };
227 + });
228 + };
229 +
230 + const onForkFromRun = async (input: {
231 + readonly sourceThreadId: ThreadId;
232 + readonly runId: RunId;
233 + }) => {
234 + if (!activeThread || activeEnvironmentUnavailable) return;
235 + const targetThreadId = newThreadId();
236 + const targetThreadRef = scopeThreadRef(environmentId, targetThreadId);
237 + const result = await forkThreadFromRun({
238 + environmentId,
239 + input: {
240 + sourceThreadId: input.sourceThreadId,
241 + targetThreadId,
242 + runId: input.runId,
243 + title: `${activeThread.title} fork`,
244 + },
245 + });
246 + if (result._tag === "Failure") {
247 + if (!isAtomCommandInterrupted(result)) {
248 + const error = squashAtomCommandFailure(result);
249 + setThreadError(
250 + activeThread.id,
251 + error instanceof Error ? error.message : "Failed to fork this response.",
252 + );
253 + }
254 + return;
255 + }
256 + const targetThreadReady = await waitForThreadShell(targetThreadRef);
257 + if (!targetThreadReady) {
258 + setThreadError(
259 + activeThread.id,
260 + "The fork was created, but its thread data did not reach this client. Reconnect and try opening it from the sidebar.",
261 + );
262 + return;
263 + }
264 + await navigate({
265 + to: "/$environmentId/$threadId",
266 + params: buildThreadRouteParams(targetThreadRef),
267 + });
268 + };
269 + const onForkFromRunStable = useStableCallback(onForkFromRun);
270 + const onTimelineRollbackCheckpoint = (input: {
271 + readonly checkpointId: string;
272 + readonly scopeId: string;
273 + }) => {
274 + if (!paintOnlyDisplayedTimeline) void onRollbackCheckpoint(input);
275 + };
276 + const onTimelineRollbackCheckpointStable = useStableCallback(onTimelineRollbackCheckpoint);
277 + const onRevertTimelineTurn = (targetTurnCount: number, messageId: MessageId) => {
278 + void onRevertToTurnCountStable(targetTurnCount, messageId);
279 + };
280 + const onRevertTimelineTurnStable = useStableCallback(onRevertTimelineTurn);
281 + return {
282 + onConfirmRevertStable,
283 + onForkFromRunStable,
284 + onRevertTimelineTurnStable,
285 + onTimelineRollbackCheckpointStable,
286 + };
287 +}