Skip to content
Source
Sign inSign up
pingdotgg/t3code

refactor(web): move worktree setup progress out of ChatView #20316

Mergedjuliusmarmingemerged 1 commit intochatview-split/panel-surfaces fromrefs/pull/20316/headmerged by juliusmarminge View on GitHub

Showing 3 changed files with 191 additions and 0 deletions (loading 2).

x
0 of 3 viewed, 3 left
191 additions and 0 deletionsapps/web/src/components/chat/useWorktreeSetup.tsAdded
View file
@@ -0,0 +1,191 @@
+import type {
+ EnvironmentId,
+ OrchestrationV2ThreadProjection,
+ RunId,
+ ScopedThreadRef,
+ ThreadId,
+ WorktreeSetupSnapshot,
+} from "@t3tools/contracts";
+import { workspacePreparationRetryRunIds } from "@t3tools/client-runtime/state/turn-item-presentation";
+import { useState } from "react";
+import { useStableCallback } from "../../hooks/useStableCallback";
+import { useEnvironmentQuery } from "../../state/query";
+import { threadEnvironment } from "../../state/threads";
+import { useAtomCommand } from "../../state/use-atom-command";
+import { vcsEnvironment } from "../../state/vcs";
+import { useTerminalUiStateStore } from "../../terminalUiStateStore";
+import type { Thread } from "../../types";
+import { resolveVisibleWorktreeSetup, resolveWorktreeSetupProgress } from "../ChatView.logic";
+import { worktreeSetupAgentStarted } from "./MessagesTimeline.logic";
+​
+/** Runs with a workspace preparation retry in flight, across ChatView instances. */
+const retryingWorkspacePreparationRunIds = new Set<RunId>();
+​
+/**
+ * Progress of the worktree a send is preparing for this route: the live setup
+ * snapshot, whether it holds the composer, and the actions on its card.
+ */
+export function useWorktreeSetup(input: {
+ readonly routeThreadRef: ScopedThreadRef;
+ // The draft id for a draft route, else the route's thread key. A bootstrap