@@ -1273,7 +1273,7 @@ function ChatViewContent(props: ChatViewProps) {
12731273 const threadSyncPhase = routeKind === "server" ? ( props . threadSyncPhase ?? null ) : null ;
12741274 const threadDetailLoading = threadSyncPhase === "loading" ;
12751275 const handleNewThread = useNewThreadHandler ( ) ;
1276- const { settleThread } = useThreadActions ( ) ;
1276+ const { settleThread, pinThread , unpinThread } = useThreadActions ( ) ;
12771277 const routeThreadRef = useMemo (
12781278 ( ) => scopeThreadRef ( environmentId , threadId ) ,
12791279 [ environmentId , threadId ] ,
@@ -4429,6 +4429,8 @@ function ChatViewContent(props: ChatViewProps) {
44294429 ) ;
44304430 const supportsSettlement = serverConfig ?. environment . capabilities . threadSettlement === true ;
44314431 const supportsSnooze = serverConfig ?. environment . capabilities . threadSnooze === true ;
4432+ const supportsPinning = serverConfig ?. environment . capabilities . threadPinning === true ;
4433+ const activeThreadPinned = supportsPinning && activeThreadShell ?. pinnedAt != null ;
44324434 const nowMinute = useNowMinute ( ) ;
44334435 const snoozeNow = new Date ( ) . toISOString ( ) ;
44344436 const activeThreadSnoozed =
@@ -5141,6 +5143,25 @@ function ChatViewContent(props: ChatViewProps) {
51415143 return ;
51425144 }
51435145
5146+ if ( command === "thread.pin" ) {
5147+ event . preventDefault ( ) ;
5148+ event . stopPropagation ( ) ;
5149+ if ( ! isServerThread || ! activeThreadRef || ! supportsPinning ) return ;
5150+ const pinned = activeThreadPinned ;
5151+ void ( pinned ? unpinThread ( activeThreadRef ) : pinThread ( activeThreadRef ) ) . then ( ( result ) => {
5152+ if ( result . _tag !== "Failure" || isAtomCommandInterrupted ( result ) ) return ;
5153+ const error = squashAtomCommandFailure ( result ) ;
5154+ toastManager . add (
5155+ stackedThreadToast ( {
5156+ type : "error" ,
5157+ title : pinned ? "Failed to unpin thread" : "Failed to pin thread" ,
5158+ description : error instanceof Error ? error . message : "An error occurred." ,
5159+ } ) ,
5160+ ) ;
5161+ } ) ;
5162+ return ;
5163+ }
5164+
51445165 if ( command === "terminal.toggle" ) {
51455166 event . preventDefault ( ) ;
51465167 event . stopPropagation ( ) ;
@@ -5245,6 +5266,7 @@ function ChatViewContent(props: ChatViewProps) {
52455266 activeRightPanelSurface ,
52465267 addTerminalSurface ,
52475268 activeThreadRef ,
5269+ activeThreadPinned ,
52485270 activeThreadSettled ,
52495271 terminalUiState . terminalOpen ,
52505272 terminalUiState . activeTerminalId ,
@@ -5260,8 +5282,11 @@ function ChatViewContent(props: ChatViewProps) {
52605282 handleUnsettleActiveThread ,
52615283 isServerThread ,
52625284 onToggleDiff ,
5285+ pinThread ,
52635286 settleThread ,
5287+ supportsPinning ,
52645288 supportsSettlement ,
5289+ unpinThread ,
52655290 toggleRightPanel ,
52665291 toggleRightPanelMaximized ,
52675292 toggleTerminalVisibility ,
0 commit comments