Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions site/src/pages/AgentsPage/AgentChatPage.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const AgentChatPageLayout: FC = () => {
requestUnarchiveAgent: () => {},
requestPinAgent: () => {},
requestUnpinAgent: () => {},
onOpenRenameDialog: () => {},
isArchiving: false,
archivingChatId: undefined,
activeChatChildren: undefined,
Expand Down
70 changes: 0 additions & 70 deletions site/src/pages/AgentsPage/AgentChatPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ import {
} from "./AgentChatPageView";
import type { AgentsPageOutletContext } from "./AgentsPageLayout";
import type { ChatMessageInputRef } from "./components/AgentChatInput";
import { chatFamilyAllowsArchive } from "./components/ChatActionsMenuItems";
import {
type ChatDetailError,
getPersistedDetailError,
Expand Down Expand Up @@ -164,15 +163,6 @@ const AgentChatPage: FC = () => {
chatErrorReasons,
setChatErrorReason,
clearChatErrorReason,
requestArchiveAgent,
requestArchiveAndDeleteWorkspace,
requestUnarchiveAgent,
requestPinAgent,
requestUnpinAgent,
isArchiving,
archivingChatId,
activeChatChildren,
onOpenRenameDialog,
onChatReady,
} = useOutletContext<AgentsPageOutletContext>();
const queryClient = useQueryClient();
Expand Down Expand Up @@ -728,51 +718,6 @@ const AgentChatPage: FC = () => {
? `ssh ${workspaceAgent.name}.${workspace.name}.${workspace.owner_name}.${sshConfigQuery.data.hostname_suffix}`
: undefined;

const handleArchiveAgentAction = () => {
if (!agentId || isArchived) {
return;
}
requestArchiveAgent(agentId);
};

const handleArchiveAndDeleteWorkspaceAction = () => {
if (!agentId || isArchived || !workspaceId) {
return;
}
requestArchiveAndDeleteWorkspace(agentId, workspaceId);
};

const handleUnarchiveAgentAction = () => {
if (!agentId || !isArchived) {
return;
}
requestUnarchiveAgent(agentId);
};

const handlePinAgentAction = () => {
if (!agentId || isArchived) {
return;
}
requestPinAgent(agentId);
};

const handleUnpinAgentAction = () => {
if (!agentId || isArchived) {
return;
}
requestUnpinAgent(agentId);
};

const handleOpenRenameDialogAction =
onOpenRenameDialog && chat
? () => {
if (isArchived) {
return;
}
onOpenRenameDialog(chat);
}
: undefined;

// Signal ready only after the store has synced fetched messages,
// so the DOM actually contains them when the parent scrolls.
const chatReadyFiredRef = useRef<string | null>(null);
Expand Down Expand Up @@ -1263,21 +1208,6 @@ const AgentChatPage: FC = () => {
handlePromoteQueuedMessage={handlePromoteQueuedMessage}
onImplementPlan={handleImplementPlan}
onSendAskUserQuestionResponse={handleSendAskUserQuestionResponse}
handleArchiveAgentAction={handleArchiveAgentAction}
handleUnarchiveAgentAction={handleUnarchiveAgentAction}
handleArchiveAndDeleteWorkspaceAction={
handleArchiveAndDeleteWorkspaceAction
}
handlePinAgentAction={handlePinAgentAction}
handleUnpinAgentAction={handleUnpinAgentAction}
handleOpenRenameDialogAction={handleOpenRenameDialogAction}
isArchivingThisChat={
isArchiving &&
(archivingChatId === undefined || archivingChatId === agentId)
}
isArchiveBlocked={
!chatFamilyAllowsArchive(liveChatStatus, activeChatChildren)
}
urlTransform={urlTransform}
hasMoreMessages={Boolean(chatMessagesQuery.hasNextPage)}
isFetchingMoreMessages={chatMessagesQuery.isFetchingNextPage}
Expand Down
4 changes: 0 additions & 4 deletions site/src/pages/AgentsPage/AgentChatPageErrorView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ export const AgentChatPageErrorView: FC<AgentChatPageErrorViewProps> = ({
showSidebarPanel: false,
onToggleSidebar: () => {},
}}
onArchiveAgent={() => {}}
onUnarchiveAgent={() => {}}
onArchiveAndDeleteWorkspace={() => {}}
hasWorkspace={false}
/>
<div className="flex flex-1 items-center justify-center px-6 text-center">
<div className="flex flex-col items-center">
Expand Down
3 changes: 0 additions & 3 deletions site/src/pages/AgentsPage/AgentChatPageView.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ const StoryAgentChatPageView: FC<StoryProps> = ({
handleInterrupt: fn(),
handleDeleteQueuedMessage: fn(),
handlePromoteQueuedMessage: fn(),
handleArchiveAgentAction: fn(),
handleUnarchiveAgentAction: fn(),
handleArchiveAndDeleteWorkspaceAction: fn(),
hasMoreMessages: false,
isFetchingMoreMessages: false,
isHydratingMessages: false,
Expand Down
47 changes: 9 additions & 38 deletions site/src/pages/AgentsPage/AgentChatPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ import {
RightPanelSkeleton,
} from "./components/AgentsSkeletons";
import type { ChatDetailError } from "./components/ChatConversation/chatError";
import type { useChatStore } from "./components/ChatConversation/chatStore";
import {
selectChatStatus,
useChatSelector,
type useChatStore,
} from "./components/ChatConversation/chatStore";

import { QueuedForCapacityCallout } from "./components/ChatConversation/QueuedForCapacityCallout";
import { DesktopPanelContext } from "./components/ChatElements/tools/DesktopPanelContext";
import type { SkillMetadata } from "./components/ChatMessageInput/SkillsTriggerMenu";
Expand Down Expand Up @@ -172,16 +177,6 @@ interface AgentChatPageViewProps {
onImplementPlan?: () => Promise<void> | void;
onSendAskUserQuestionResponse?: (message: string) => Promise<void> | void;

// Chat actions.
handleArchiveAgentAction: () => void;
handleUnarchiveAgentAction: () => void;
handleArchiveAndDeleteWorkspaceAction: () => void;
handlePinAgentAction?: () => void;
handleUnpinAgentAction?: () => void;
handleOpenRenameDialogAction?: () => void;
isArchivingThisChat?: boolean;
isArchiveBlocked?: boolean;

// Pagination for loading older messages.
hasMoreMessages: boolean;
isFetchingMoreMessages: boolean;
Expand Down Expand Up @@ -334,14 +329,6 @@ export const AgentChatPageView: FC<AgentChatPageViewProps> = ({
handlePromoteQueuedMessage,
onImplementPlan,
onSendAskUserQuestionResponse,
handleArchiveAgentAction,
handleUnarchiveAgentAction,
handleArchiveAndDeleteWorkspaceAction,
handlePinAgentAction,
handleUnpinAgentAction,
handleOpenRenameDialogAction,
isArchivingThisChat,
isArchiveBlocked,
hasMoreMessages,
isFetchingMoreMessages,
isHydratingMessages,
Expand All @@ -363,6 +350,8 @@ export const AgentChatPageView: FC<AgentChatPageViewProps> = ({
const agentId = chat.id;
const organizationId = chat.organization_id;
const isArchived = chat.archived;
const liveChatStatus =
useChatSelector(store, selectChatStatus) ?? chat.status;
const parsedPrNumber = Number(
parsePullRequestUrl(chat.diff_status?.url)?.number,
);
Expand Down Expand Up @@ -839,23 +828,13 @@ export const AgentChatPageView: FC<AgentChatPageViewProps> = ({
{" "}
<ChatTopBar
chat={chat}
liveChatStatus={liveChatStatus}
parentChat={parentChat}
panel={{
showSidebarPanel,
onToggleSidebar: () =>
onSetShowSidebarPanel(!showSidebarPanel),
}}
onArchiveAgent={handleArchiveAgentAction}
onUnarchiveAgent={handleUnarchiveAgentAction}
onArchiveAndDeleteWorkspace={
handleArchiveAndDeleteWorkspaceAction
}
onPinAgent={handlePinAgentAction}
onUnpinAgent={handleUnpinAgentAction}
onOpenRenameDialog={handleOpenRenameDialogAction}
isArchiving={isArchivingThisChat}
isArchiveBlocked={isArchiveBlocked}
hasWorkspace={Boolean(workspace)}
renderChatSharingContent={
canShareChat
? (open) => (
Expand Down Expand Up @@ -1091,10 +1070,6 @@ export const AgentChatPageLoadingView: FC<AgentChatPageLoadingViewProps> = ({
showSidebarPanel: false,
onToggleSidebar: () => {},
}}
onArchiveAgent={() => {}}
onUnarchiveAgent={() => {}}
onArchiveAndDeleteWorkspace={() => {}}
hasWorkspace={false}
/>
<div className="min-h-0 flex-1 overflow-y-auto scrollbar-gutter-stable scrollbar-thin [scrollbar-color:hsl(var(--surface-quaternary))_transparent]">
<div className="px-4">
Expand Down Expand Up @@ -1153,10 +1128,6 @@ export const AgentChatPageNotFoundView: FC = () => {
showSidebarPanel: false,
onToggleSidebar: () => {},
}}
onArchiveAgent={() => {}}
onUnarchiveAgent={() => {}}
onArchiveAndDeleteWorkspace={() => {}}
hasWorkspace={false}
/>
<div className="flex flex-1 items-center justify-center text-content-secondary">
Chat not found
Expand Down
3 changes: 0 additions & 3 deletions site/src/pages/AgentsPage/AgentsPageLayout.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,6 @@ const AgentTopBarRouteElement = () => {
<ChatTopBar
chat={{ ...MockChat, title: "Collapsed sidebar agent" }}
panel={{ showSidebarPanel: false, onToggleSidebar: fn() }}
onArchiveAgent={fn()}
onArchiveAndDeleteWorkspace={fn()}
onUnarchiveAgent={fn()}
/>
);
};
Expand Down
Loading
Loading