Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Remove microagent functionality from frontend code (#13820)

Tim O'Farrell06c3d9c17bbd
diff --git a/frontend/__tests__/components/features/chat/launch-microagent-modal.test.tsx b/frontend/__tests__/components/features/chat/launch-microagent-modal.test.tsx
deleted file mode 100644
index 6593475987..0000000000
--- a/frontend/__tests__/components/features/chat/launch-microagent-modal.test.tsx
+++ /dev/null
@@ -1,165 +0,0 @@
-import { render, screen, waitFor } from "@testing-library/react";
-import { afterEach, describe, expect, it, vi } from "vitest";
-import userEvent from "@testing-library/user-event";
-import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import { LaunchMicroagentModal } from "#/components/features/chat/microagent/launch-microagent-modal";
-import { I18nKey } from "#/i18n/declaration";
-
-vi.mock("react-router", async () => ({
- useParams: vi.fn().mockReturnValue({
- conversationId: "123",
- }),
-}));
-
-// Mock the useHandleRuntimeActive hook
-vi.mock("#/hooks/use-handle-runtime-active", () => ({
- useHandleRuntimeActive: vi.fn().mockReturnValue({ runtimeActive: true }),
-}));
-
-// Mock the useMicroagentPrompt hook
-vi.mock("#/hooks/query/use-microagent-prompt", () => ({
- useMicroagentPrompt: vi.fn().mockReturnValue({
- data: "Generated prompt",
- isLoading: false
- }),
-}));
-
-// Mock the useGetMicroagents hook
-vi.mock("#/hooks/query/use-get-microagents", () => ({
- useGetMicroagents: vi.fn().mockReturnValue({
- data: ["file1", "file2"]
- }),
-}));
-
-// Mock the useTranslation hook
-vi.mock("react-i18next", () => ({
- useTranslation: () => ({
- t: (key: string) => {
- const translations: Record<string, string> = {
- [I18nKey.MICROAGENT$ADD_TO_MICROAGENT]: "Add to Microagent",
- [I18nKey.MICROAGENT$WHAT_TO_REMEMBER]: "What would you like your microagent to remember?",
- [I18nKey.MICROAGENT$WHERE_TO_PUT]: "Where should we put it?",
- [I18nKey.MICROAGENT$ADD_TRIGGERS]: "Add triggers for the microagent",
- [I18nKey.MICROAGENT$DESCRIBE_WHAT_TO_ADD]: "Describe what you want to add to the Microagent...",
- [I18nKey.MICROAGENT$SELECT_FILE_OR_CUSTOM]: "Select a microagent file or enter a custom value",
- [I18nKey.MICROAGENT$TYPE_TRIGGER_SPACE]: "Type a trigger and press Space to add it",
- [I18nKey.MICROAGENT$LOADING_PROMPT]: "Loading prompt...",
- [I18nKey.MICROAGENT$CANCEL]: "Cancel",
- [I18nKey.MICROAGENT$LAUNCH]: "Launch"
- };
- return translations[key] || key;
- },
- i18n: {
- changeLanguage: vi.fn(),
- },
- }),
- Trans: ({ i18nKey }: { i18nKey: string }) => i18nKey,
-}));
-
-describe("LaunchMicroagentModal", () => {
- const onCloseMock = vi.fn();
- const onLaunchMock = vi.fn();
- const eventId = 12;
- const conversationId = "123";
-
- const renderMicroagentModal = (
- { isLoading }: { isLoading: boolean } = { isLoading: false },
- ) =>
- render(
- <LaunchMicroagentModal
- onClose={onCloseMock}
- onLaunch={onLaunchMock}
- eventId={eventId}
- selectedRepo="some-repo"
- isLoading={isLoading}
- />,
- {
- wrapper: ({ children }) => (
- <QueryClientProvider client={new QueryClient()}>
- {children}
- </QueryClientProvider>
- ),
- },
- );
-
- afterEach(() => {
- vi.clearAllMocks();
- });
-
- it("should render the launch microagent modal", () => {
- renderMicroagentModal();
- expect(screen.getByTestId("launch-microagent-modal")).toBeInTheDocument();
- });
-
- it("should render the form fields", () => {
- renderMicroagentModal();
-
- // inputs
- screen.getByTestId("query-input");
- screen.getByTestId("target-input");
- screen.getByTestId("trigger-input");
-
- // action buttons
- screen.getByRole("button", { name: "Launch" });
- screen.getByRole("button", { name: "Cancel" });
- });
-
- it("should call onClose when pressing the cancel button", async () => {
- renderMicroagentModal();
-
- const cancelButton = screen.getByRole("button", { name: "Cancel" });
- await userEvent.click(cancelButton);
- expect(onCloseMock).toHaveBeenCalled();
- });
-
- it("should display the prompt from the hook", async () => {
- renderMicroagentModal();
-
- // Since we're mocking the hook, we just need to verify the UI shows the data
- const descriptionInput = screen.getByTestId("query-input");
- expect(descriptionInput).toHaveValue("Generated prompt");
- });
-
- it("should display the list of microagent files from the hook", async () => {
- renderMicroagentModal();
-
- // Since we're mocking the hook, we just need to verify the UI shows the data
- const targetInput = screen.getByTestId("target-input");
- expect(targetInput).toHaveValue("");
-
- await userEvent.click(targetInput);
-
- expect(screen.getByText("file1")).toBeInTheDocument();
- expect(screen.getByText("file2")).toBeInTheDocument();
-
- await userEvent.click(screen.getByText("file1"));
- expect(targetInput).toHaveValue("file1");
- });
-
- it("should call onLaunch with the form data", async () => {
- renderMicroagentModal();
-
- const triggerInput = screen.getByTestId("trigger-input");
- await userEvent.type(triggerInput, "trigger1 ");
- await userEvent.type(triggerInput, "trigger2 ");
-
- const targetInput = screen.getByTestId("target-input");
- await userEvent.click(targetInput);
- await userEvent.click(screen.getByText("file1"));
-
- const launchButton = await screen.findByRole("button", { name: "Launch" });
- await userEvent.click(launchButton);
-
- expect(onLaunchMock).toHaveBeenCalledWith("Generated prompt", "file1", [
- "trigger1",
- "trigger2",
- ]);
- });
-
- it("should disable the launch button if isLoading is true", async () => {
- renderMicroagentModal({ isLoading: true });
-
- const launchButton = screen.getByRole("button", { name: "Launch" });
- expect(launchButton).toBeDisabled();
- });
-});
diff --git a/frontend/__tests__/microagent-status-indicator.test.tsx b/frontend/__tests__/microagent-status-indicator.test.tsx
deleted file mode 100644
index 3e4f9cb3b4..0000000000
--- a/frontend/__tests__/microagent-status-indicator.test.tsx
+++ /dev/null
@@ -1,105 +0,0 @@
-import { describe, it, expect, vi } from "vitest";
-import { render, screen } from "@testing-library/react";
-import { MicroagentStatusIndicator } from "#/components/features/chat/microagent/microagent-status-indicator";
-import { MicroagentStatus } from "#/types/microagent-status";
-
-// Mock the translation hook
-vi.mock("react-i18next", () => ({
- useTranslation: () => ({
- t: (key: string) => key,
- }),
-}));
-
-describe("MicroagentStatusIndicator", () => {
- it("should show 'View your PR' when status is completed and PR URL is provided", () => {
- render(
- <MicroagentStatusIndicator
- status={MicroagentStatus.COMPLETED}
- conversationId="test-conversation"
- prUrl="https://github.com/owner/repo/pull/123"
- />,
- );
-
- const link = screen.getByRole("link", { name: "MICROAGENT$VIEW_YOUR_PR" });
- expect(link).toBeInTheDocument();
- expect(link).toHaveAttribute(
- "href",
- "https://github.com/owner/repo/pull/123",
- );
- expect(link).toHaveAttribute("target", "_blank");
- expect(link).toHaveAttribute("rel", "noopener noreferrer");
- });
-
- it("should show default completed message when status is completed but no PR URL", () => {
- render(
- <MicroagentStatusIndicator
- status={MicroagentStatus.COMPLETED}
- conversationId="test-conversation"
- />,
- );
-
- const link = screen.getByRole("link", {
- name: "MICROAGENT$STATUS_COMPLETED",
- });
- expect(link).toBeInTheDocument();
- expect(link).toHaveAttribute("href", "/conversations/test-conversation");
- });
-
- it("should show creating status without PR URL", () => {
- render(
- <MicroagentStatusIndicator
- status={MicroagentStatus.CREATING}
- conversationId="test-conversation"
- />,
- );
-
- expect(screen.getByText("MICROAGENT$STATUS_CREATING")).toBeInTheDocument();
- });
-
- it("should show error status", () => {
- render(
- <MicroagentStatusIndicator
- status={MicroagentStatus.ERROR}
- conversationId="test-conversation"
- />,
- );
-
- expect(screen.getByText("MICROAGENT$STATUS_ERROR")).toBeInTheDocument();
- });
-
- it("should prioritize PR URL over conversation link when both are provided", () => {
- render(
- <MicroagentStatusIndicator
- status={MicroagentStatus.COMPLETED}
- conversationId="test-conversation"
- prUrl="https://github.com/owner/repo/pull/123"
- />,
- );
-
- const link = screen.getByRole("link", { name: "MICROAGENT$VIEW_YOUR_PR" });
- expect(link).toHaveAttribute(
- "href",
- "https://github.com/owner/repo/pull/123",
- );
- // Should not link to conversation when PR URL is available
- expect(link).not.toHaveAttribute(
- "href",
- "/conversations/test-conversation",
- );
- });
-
- it("should work with GitLab MR URLs", () => {
- render(
- <MicroagentStatusIndicator
- status={MicroagentStatus.COMPLETED}
- prUrl="https://gitlab.com/owner/repo/-/merge_requests/456"
- />,
- );
-
- const link = screen.getByRole("link", { name: "MICROAGENT$VIEW_YOUR_PR" });
- expect(link).toHaveAttribute(
- "href",
- "https://gitlab.com/owner/repo/-/merge_requests/456",
- );
- });
-});
diff --git a/frontend/src/components/features/chat/event-message-components/error-event-message.tsx b/frontend/src/components/features/chat/event-message-components/error-event-message.tsx
index 0cf9688249..3cea5f2127 100644
--- a/frontend/src/components/features/chat/event-message-components/error-event-message.tsx
+++ b/frontend/src/components/features/chat/event-message-components/error-event-message.tsx
@@ -2,20 +2,10 @@ import React from "react";
import { OpenHandsObservation } from "#/types/core/observations";
import { isErrorObservation } from "#/types/core/guards";
import { ErrorMessage } from "../error-message";
-import { MicroagentStatusWrapper } from "./microagent-status-wrapper";
import { LikertScaleWrapper } from "./likert-scale-wrapper";
-import { MicroagentStatus } from "#/types/microagent-status";
interface ErrorEventMessageProps {
event: OpenHandsObservation;
- microagentStatus?: MicroagentStatus | null;
- microagentConversationId?: string;
- microagentPRUrl?: string;
- actions?: Array<{
- icon: React.ReactNode;
- onClick: () => void;
- tooltip?: string;
- }>;
isLastMessage: boolean;
isInLast10Actions: boolean;
config?: { app_mode?: string } | null;
@@ -29,10 +19,6 @@ interface ErrorEventMessageProps {
export function ErrorEventMessage({
event,
- microagentStatus,
- microagentConversationId,
- microagentPRUrl,
- actions,
isLastMessage,
isInLast10Actions,
config,
@@ -49,12 +35,6 @@ export function ErrorEventMessage({
errorId={event.extras.error_id}
defaultMessage={event.message}
/>
- <MicroagentStatusWrapper
- microagentStatus={microagentStatus}
- microagentConversationId={microagentConversationId}
- microagentPRUrl={microagentPRUrl}
- actions={actions}
- />
<LikertScaleWrapper
event={event}
isLastMessage={isLastMessage}
diff --git a/frontend/src/components/features/chat/event-message-components/finish-event-message.tsx b/frontend/src/components/features/chat/event-message-components/finish-event-message.tsx
index 9268bbaa71..b4480e36e0 100644
--- a/frontend/src/components/features/chat/event-message-components/finish-event-message.tsx
+++ b/frontend/src/components/features/chat/event-message-components/finish-event-message.tsx
@@ -2,21 +2,11 @@ import React from "react";
import { OpenHandsAction } from "#/types/core/actions";
import { isFinishAction } from "#/types/core/guards";
import { ChatMessage } from "../chat-message";
-import { MicroagentStatusWrapper } from "./microagent-status-wrapper";
import { LikertScaleWrapper } from "./likert-scale-wrapper";
import { getEventContent } from "../event-content-helpers/get-event-content";
-import { MicroagentStatus } from "#/types/microagent-status";
interface FinishEventMessageProps {
event: OpenHandsAction;
- microagentStatus?: MicroagentStatus | null;
- microagentConversationId?: string;
- microagentPRUrl?: string;
- actions?: Array<{
- icon: React.ReactNode;
- onClick: () => void;
- tooltip?: string;
- }>;
isLastMessage: boolean;
isInLast10Actions: boolean;
config?: { app_mode?: string } | null;
@@ -30,10 +20,6 @@ interface FinishEventMessageProps {
export function FinishEventMessage({
event,
- microagentStatus,
- microagentConversationId,
- microagentPRUrl,
- actions,
isLastMessage,
isInLast10Actions,
config,
@@ -46,17 +32,7 @@ export function FinishEventMessage({
return (
<>
- <ChatMessage
- type="agent"
- message={getEventContent(event).details}
- actions={actions}
- />
- <MicroagentStatusWrapper
- microagentStatus={microagentStatus}
- microagentConversationId={microagentConversationId}
- microagentPRUrl={microagentPRUrl}
- actions={actions}
- />
+ <ChatMessage type="agent" message={getEventContent(event).details} />
<LikertScaleWrapper
event={event}
isLastMessage={isLastMessage}
diff --git a/frontend/src/components/features/chat/event-message-components/index.ts b/frontend/src/components/features/chat/event-message-components/index.ts
index d439405e5d..0cfe67f000 100644
--- a/frontend/src/components/features/chat/event-message-components/index.ts
+++ b/frontend/src/components/features/chat/event-message-components/index.ts
@@ -6,6 +6,5 @@ export { McpEventMessage } from "./mcp-event-message";
export { TaskTrackingEventMessage } from "./task-tracking-event-message";
export { ObservationPairEventMessage } from "./observation-pair-event-message";
export { GenericEventMessageWrapper } from "./generic-event-message-wrapper";
-export { MicroagentStatusWrapper } from "./microagent-status-wrapper";
export { LikertScaleWrapper } from "./likert-scale-wrapper";
export { HookExecutionEventMessage } from "./hook-execution-event-message";
diff --git a/frontend/src/components/features/chat/event-message-components/microagent-status-wrapper.tsx b/frontend/src/components/features/chat/event-message-components/microagent-status-wrapper.tsx
deleted file mode 100644
index b58f8f5db0..0000000000
--- a/frontend/src/components/features/chat/event-message-components/microagent-status-wrapper.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import React from "react";
-import { MicroagentStatus } from "#/types/microagent-status";
-import { MicroagentStatusIndicator } from "../microagent/microagent-status-indicator";
-
-interface MicroagentStatusWrapperProps {
- microagentStatus?: MicroagentStatus | null;
- microagentConversationId?: string;
- microagentPRUrl?: string;
- actions?: Array<{
- icon: React.ReactNode;
- onClick: () => void;
- tooltip?: string;
- }>;
-}
-
-export function MicroagentStatusWrapper({
- microagentStatus,
- microagentConversationId,
- microagentPRUrl,
- actions,
-}: MicroagentStatusWrapperProps) {
- if (!microagentStatus || !actions) {
- return null;
- }
-
- return (
- <MicroagentStatusIndicator
- status={microagentStatus}
- conversationId={microagentConversationId}
- prUrl={microagentPRUrl}
- />
- );
-}
diff --git a/frontend/src/components/features/chat/event-message-components/observation-pair-event-message.tsx b/frontend/src/components/features/chat/event-message-components/observation-pair-event-message.tsx
index 0c0110b6a8..709a7d0169 100644
--- a/frontend/src/components/features/chat/event-message-components/observation-pair-event-message.tsx
+++ b/frontend/src/components/features/chat/event-message-components/observation-pair-event-message.tsx
@@ -2,8 +2,6 @@ import React from "react";
import { OpenHandsAction } from "#/types/core/actions";
import { isOpenHandsAction } from "#/types/core/guards";
import { ChatMessage } from "../chat-message";
-import { MicroagentStatusWrapper } from "./microagent-status-wrapper";
-import { MicroagentStatus } from "#/types/microagent-status";
const hasThoughtProperty = (
obj: Record<string, unknown>,
@@ -11,22 +9,10 @@ const hasThoughtProperty = (
interface ObservationPairEventMessageProps {
event: OpenHandsAction;
- microagentStatus?: MicroagentStatus | null;
- microagentConversationId?: string;
- microagentPRUrl?: string;
- actions?: Array<{
- icon: React.ReactNode;
- onClick: () => void;
- tooltip?: string;
- }>;
}
export function ObservationPairEventMessage({
event,
- microagentStatus,
- microagentConversationId,
- microagentPRUrl,
- actions,
}: ObservationPairEventMessageProps) {
if (!isOpenHandsAction(event)) {
return null;
@@ -35,27 +21,10 @@ export function ObservationPairEventMessage({
if (hasThoughtProperty(event.args) && event.action !== "think") {
return (
<div>
- <ChatMessage
- type="agent"
- message={event.args.thought}
- actions={actions}
- />
- <MicroagentStatusWrapper
- microagentStatus={microagentStatus}
- microagentConversationId={microagentConversationId}
- microagentPRUrl={microagentPRUrl}
- actions={actions}
- />
+ <ChatMessage type="agent" message={event.args.thought} />
</div>
);
}
- return (
- <MicroagentStatusWrapper
- microagentStatus={microagentStatus}
- microagentConversationId={microagentConversationId}
- microagentPRUrl={microagentPRUrl}
- actions={actions}
- />
- );
+ return null;
}
diff --git a/frontend/src/components/features/chat/event-message-components/user-assistant-event-message.tsx b/frontend/src/components/features/chat/event-message-components/user-assistant-event-message.tsx
index 6b7e527af1..d8b3ffa400 100644
--- a/frontend/src/components/features/chat/event-message-components/user-assistant-event-message.tsx
+++ b/frontend/src/components/features/chat/event-message-components/user-assistant-event-message.tsx
@@ -5,22 +5,12 @@ import { ChatMessage } from "../chat-message";
import { ImageCarousel } from "../../images/image-carousel";
import { FileList } from "../../files/file-list";
import { ConfirmationButtons } from "#/components/shared/buttons/confirmation-buttons";
-import { MicroagentStatusWrapper } from "./microagent-status-wrapper";
import { LikertScaleWrapper } from "./likert-scale-wrapper";
import { parseMessageFromEvent } from "../event-content-helpers/parse-message-from-event";
-import { MicroagentStatus } from "#/types/microagent-status";
interface UserAssistantEventMessageProps {
event: OpenHandsAction;
shouldShowConfirmationButtons: boolean;
- microagentStatus?: MicroagentStatus | null;
- microagentConversationId?: string;
- microagentPRUrl?: string;
- actions?: Array<{
- icon: React.ReactNode;
- onClick: () => void;
- tooltip?: string;
- }>;
isLastMessage: boolean;
isInLast10Actions: boolean;
config?: { app_mode?: string } | null;
@@ -35,10 +25,6 @@ interface UserAssistantEventMessageProps {
export function UserAssistantEventMessage({
event,
shouldShowConfirmationButtons,
- microagentStatus,
- microagentConversationId,
- microagentPRUrl,
- actions,
isLastMessage,
isInLast10Actions,
config,
@@ -53,7 +39,7 @@ export function UserAssistantEventMessage({
return (
<>
- <ChatMessage type={event.source} message={message} actions={actions}>
+ <ChatMessage type={event.source} message={message}>
{event.args.image_urls && event.args.image_urls.length > 0 && (
<ImageCarousel size="small" images={event.args.image_urls} />
)}
@@ -62,12 +48,6 @@ export function UserAssistantEventMessage({
)}
{shouldShowConfirmationButtons && <ConfirmationButtons />}
</ChatMessage>
- <MicroagentStatusWrapper
- microagentStatus={microagentStatus}
- microagentConversationId={microagentConversationId}
- microagentPRUrl={microagentPRUrl}
- actions={actions}
- />
{isAssistantMessage(event) && event.action === "message" && (
<LikertScaleWrapper
event={event}
diff --git a/frontend/src/components/features/chat/event-message.tsx b/frontend/src/components/features/chat/event-message.tsx
index db5121c24e..36d4cce4f9 100644
--- a/frontend/src/components/features/chat/event-message.tsx
+++ b/frontend/src/components/features/chat/event-message.tsx
@@ -11,7 +11,6 @@ import {
isTaskTrackingObservation,
} from "#/types/core/guards";
import { OpenHandsObservation } from "#/types/core/observations";
-import { MicroagentStatus } from "#/types/microagent-status";
import { useConfig } from "#/hooks/query/use-config";
import { useFeedbackExists } from "#/hooks/query/use-feedback-exists";
import {
@@ -30,14 +29,6 @@ interface EventMessageProps {
hasObservationPair: boolean;
isAwaitingUserConfirmation: boolean;
isLastMessage: boolean;
- microagentStatus?: MicroagentStatus | null;
- microagentConversationId?: string;
- microagentPRUrl?: string;
- actions?: Array<{
- icon: React.ReactNode;
- onClick: () => void;
- tooltip?: string;
- }>;
isInLast10Actions: boolean;
}
@@ -47,10 +38,6 @@ export function EventMessage({
hasObservationPair,
isAwaitingUserConfirmation,
isLastMessage,
- microagentStatus,
- microagentConversationId,
- microagentPRUrl,
- actions,
isInLast10Actions,
}: EventMessageProps) {
const shouldShowConfirmationButtons =
@@ -65,10 +52,6 @@ export function EventMessage({
// Common props for components that need them
const commonProps = {
- microagentStatus,
- microagentConversationId,
- microagentPRUrl,
- actions,
isLastMessage,
isInLast10Actions,
config,
@@ -83,15 +66,7 @@ export function EventMessage({
// Observation pairs with OpenHands actions
if (hasObservationPair && isOpenHandsAction(event)) {
- return (
- <ObservationPairEventMessage
- event={event}
- microagentStatus={microagentStatus}
- microagentConversationId={microagentConversationId}
- microagentPRUrl={microagentPRUrl}
- actions={actions}
- />
- );
+ return <ObservationPairEventMessage event={event} />;
}
// Finish actions
diff --git a/frontend/src/components/features/chat/messages.tsx b/frontend/src/components/features/chat/messages.tsx
index 6e68089b13..ab45d6ca0d 100644
--- a/frontend/src/components/features/chat/messages.tsx
+++ b/frontend/src/components/features/chat/messages.tsx
@@ -1,41 +1,10 @@
import React from "react";
-import { useTranslation } from "react-i18next";
-import { createPortal } from "react-dom";
import { OpenHandsAction } from "#/types/core/actions";
import { OpenHandsObservation } from "#/types/core/observations";
-import {
- isOpenHandsAction,
- isOpenHandsObservation,
- isOpenHandsEvent,
- isAgentStateChangeObservation,
- isFinishAction,
-} from "#/types/core/guards";
+import { isOpenHandsAction, isOpenHandsObservation } from "#/types/core/guards";
import { EventMessage } from "./event-message";
import { ChatMessage } from "./chat-message";
import { useOptimisticUserMessageStore } from "#/stores/optimistic-user-message-store";
-import { LaunchMicroagentModal } from "./microagent/launch-microagent-modal";
-import { useUserConversation } from "#/hooks/query/use-user-conversation";
-import { useConversationId } from "#/hooks/use-conversation-id";
-import { useCreateConversationAndSubscribeMultiple } from "#/hooks/use-create-conversation-and-subscribe-multiple";
-import {
- MicroagentStatus,
- EventMicroagentStatus,
-} from "#/types/microagent-status";
-import { AgentState } from "#/types/agent-state";
-import { getFirstPRUrl } from "#/utils/parse-pr-url";
-import MemoryIcon from "#/icons/memory_icon.svg?react";
-import { useActiveConversation } from "#/hooks/query/use-active-conversation";
-
-const isErrorEvent = (evt: unknown): evt is { error: true; message: string } =>
- typeof evt === "object" &&
- evt !== null &&
- "error" in evt &&
- evt.error === true;
-
-const isAgentStatusError = (evt: unknown): boolean =>
- isOpenHandsEvent(evt) &&
- isAgentStateChangeObservation(evt) &&
- evt.extras.agent_state === AgentState.ERROR;
interface MessagesProps {
messages: (OpenHandsAction | OpenHandsObservation)[];
@@ -44,33 +13,9 @@ interface MessagesProps {
export const Messages: React.FC<MessagesProps> = React.memo(
({ messages, isAwaitingUserConfirmation }) => {
- const {
- createConversationAndSubscribe,
- isPending,
- unsubscribeFromConversation,
- } = useCreateConversationAndSubscribeMultiple();
const { getOptimisticUserMessage } = useOptimisticUserMessageStore();
- const { conversationId } = useConversationId();
- const { data: conversation } = useUserConversation(conversationId);
- const { data: activeConversation } = useActiveConversation();
-
- // TODO: Hide microagent actions for V1 conversations
- // This is a temporary measure and may be re-enabled in the future
- const isV1Conversation = activeConversation?.conversation_version === "V1";
-
const optimisticUserMessage = getOptimisticUserMessage();
- const [selectedEventId, setSelectedEventId] = React.useState<number | null>(
- null,
- );
- const [showLaunchMicroagentModal, setShowLaunchMicroagentModal] =
- React.useState(false);
- const [microagentStatuses, setMicroagentStatuses] = React.useState<
- EventMicroagentStatus[]
- >([]);
-
- const { t } = useTranslation();
-
const actionHasObservationPair = React.useCallback(
(event: OpenHandsAction | OpenHandsObservation): boolean => {
if (isOpenHandsAction(event)) {
@@ -84,148 +29,6 @@ export const Messages: React.FC<MessagesProps> = React.memo(
[messages],
);
- const getMicroagentStatusForEvent = React.useCallback(
- (eventId: number): MicroagentStatus | null => {
- const statusEntry = microagentStatuses.find(
- (entry) => entry.eventId === eventId,
- );
- return statusEntry?.status || null;
- },
- [microagentStatuses],
- );
-
- const getMicroagentConversationIdForEvent = React.useCallback(
- (eventId: number): string | undefined => {
- const statusEntry = microagentStatuses.find(
- (entry) => entry.eventId === eventId,
- );
- return statusEntry?.conversationId || undefined;
- },
- [microagentStatuses],
- );
-
- const getMicroagentPRUrlForEvent = React.useCallback(
- (eventId: number): string | undefined => {
- const statusEntry = microagentStatuses.find(
- (entry) => entry.eventId === eventId,
- );
- return statusEntry?.prUrl || undefined;
- },
- [microagentStatuses],
- );
-
- const handleMicroagentEvent = React.useCallback(
- (socketEvent: unknown, microagentConversationId: string) => {
- if (isErrorEvent(socketEvent) || isAgentStatusError(socketEvent)) {
- setMicroagentStatuses((prev) =>
- prev.map((statusEntry) =>
- statusEntry.conversationId === microagentConversationId
- ? { ...statusEntry, status: MicroagentStatus.ERROR }
- : statusEntry,
- ),
- );
- } else if (
- isOpenHandsEvent(socketEvent) &&
- isAgentStateChangeObservation(socketEvent)
- ) {
- // Handle completion states
- if (
- socketEvent.extras.agent_state === AgentState.FINISHED ||
- socketEvent.extras.agent_state === AgentState.AWAITING_USER_INPUT
- ) {
- setMicroagentStatuses((prev) =>
- prev.map((statusEntry) =>
- statusEntry.conversationId === microagentConversationId
- ? { ...statusEntry, status: MicroagentStatus.COMPLETED }
- : statusEntry,
- ),
- );
-
- unsubscribeFromConversation(microagentConversationId);
- }
- } else if (
- isOpenHandsEvent(socketEvent) &&
- isFinishAction(socketEvent)
- ) {
- // Check if the finish action contains a PR URL
- const prUrl = getFirstPRUrl(socketEvent.args.final_thought || "");
- if (prUrl) {
- setMicroagentStatuses((prev) =>
- prev.map((statusEntry) =>
- statusEntry.conversationId === microagentConversationId
- ? {
- ...statusEntry,
- status: MicroagentStatus.COMPLETED,
- prUrl,
- }
- : statusEntry,
- ),
- );
- }
-
- unsubscribeFromConversation(microagentConversationId);
- } else {
- // For any other event, transition from WAITING to CREATING if still waiting
- setMicroagentStatuses((prev) => {
- const currentStatus = prev.find(
- (entry) => entry.conversationId === microagentConversationId,
- )?.status;
-
- if (currentStatus === MicroagentStatus.WAITING) {
- return prev.map((statusEntry) =>
- statusEntry.conversationId === microagentConversationId
- ? { ...statusEntry, status: MicroagentStatus.CREATING }
- : statusEntry,
- );
- }
- return prev; // No change needed
- });
- }
- },
- [setMicroagentStatuses, unsubscribeFromConversation],
- );
-
- const handleLaunchMicroagent = (
- query: string,
- target: string,
- triggers: string[],
- ) => {
- const conversationInstructions = `Target file: ${target}\n\nDescription: ${query}\n\nTriggers: ${triggers.join(", ")}`;
- if (
- !conversation?.selected_repository ||
- !conversation.selected_branch ||
- !conversation.git_provider ||
- !selectedEventId
- ) {
- return;
- }
-
- createConversationAndSubscribe({
- query,
- conversationInstructions,
- repository: {
- name: conversation.selected_repository,
- branch: conversation.selected_branch,
- gitProvider: conversation.git_provider,
- },
- onSuccessCallback: (newConversationId: string) => {
- setShowLaunchMicroagentModal(false);
- // Update status with conversation ID - start with WAITING
- setMicroagentStatuses((prev) => [
- ...prev.filter((status) => status.eventId !== selectedEventId),
- {
- eventId: selectedEventId,
- conversationId: newConversationId,
- status: MicroagentStatus.WAITING,
- },
- ]);
- },
- onEventCallback: (socketEvent: unknown, newConversationId: string) => {
- handleMicroagentEvent(socketEvent, newConversationId);
- },
- });
- };
-
return (
<>
{messages.map((message, index) => (
@@ -235,27 +38,6 @@ export const Messages: React.FC<MessagesProps> = React.memo(
hasObservationPair={actionHasObservationPair(message)}
isAwaitingUserConfirmation={isAwaitingUserConfirmation}
isLastMessage={messages.length - 1 === index}
- microagentStatus={getMicroagentStatusForEvent(message.id)}
- microagentConversationId={getMicroagentConversationIdForEvent(
- message.id,
- )}
- microagentPRUrl={getMicroagentPRUrlForEvent(message.id)}
- actions={
- conversation?.selected_repository && !isV1Conversation
- ? [
- {
- icon: (
- <MemoryIcon className="w-[14px] h-[14px] text-white" />
- ),
- onClick: () => {
- setSelectedEventId(message.id);
- setShowLaunchMicroagentModal(true);
- },
- tooltip: t("MICROAGENT$ADD_TO_MEMORY"),
- },
- ]
- : undefined
- }
isInLast10Actions={messages.length - 1 - index < 10}
/>
))}
@@ -263,22 +45,6 @@ export const Messages: React.FC<MessagesProps> = React.memo(
{optimisticUserMessage && (
<ChatMessage type="user" message={optimisticUserMessage} />
)}
- {conversation?.selected_repository &&
- !isV1Conversation &&
- showLaunchMicroagentModal &&
- selectedEventId &&
- createPortal(
- <LaunchMicroagentModal
- onClose={() => setShowLaunchMicroagentModal(false)}
- onLaunch={handleLaunchMicroagent}
- selectedRepo={
- conversation.selected_repository.split("/").pop() || ""
- }
- eventId={selectedEventId}
- isLoading={isPending}
- />,
- document.getElementById("modal-portal-exit") || document.body,
- )}
</>
);
},
diff --git a/frontend/src/components/features/chat/microagent/launch-microagent-modal.tsx b/frontend/src/components/features/chat/microagent/launch-microagent-modal.tsx
deleted file mode 100644
index 40d67dbb1b..0000000000
--- a/frontend/src/components/features/chat/microagent/launch-microagent-modal.tsx
+++ /dev/null
@@ -1,179 +0,0 @@
-import React from "react";
-import { FaCircleInfo } from "react-icons/fa6";
-import { useTranslation } from "react-i18next";
-import { ModalBackdrop } from "#/components/shared/modals/modal-backdrop";
-import { ModalBody } from "#/components/shared/modals/modal-body";
-import { BrandButton } from "../../settings/brand-button";
-import { SettingsDropdownInput } from "../../settings/settings-dropdown-input";
-import { BadgeInput } from "#/components/shared/inputs/badge-input";
-import { cn } from "#/utils/utils";
-import CloseIcon from "#/icons/close.svg?react";
-import { useMicroagentPrompt } from "#/hooks/query/use-microagent-prompt";
-import { useHandleRuntimeActive } from "#/hooks/use-handle-runtime-active";
-import { LoadingMicroagentBody } from "./loading-microagent-body";
-import { LoadingMicroagentTextarea } from "./loading-microagent-textarea";
-import { useGetMicroagents } from "#/hooks/query/use-get-microagents";
-import { Typography } from "#/ui/typography";
-import { useActiveConversation } from "#/hooks/query/use-active-conversation";
-
-interface LaunchMicroagentModalProps {
- onClose: () => void;
- onLaunch: (query: string, target: string, triggers: string[]) => void;
- eventId: number;
- isLoading: boolean;
- selectedRepo: string;
-}
-
-export function LaunchMicroagentModal({
- onClose,
- onLaunch,
- eventId,
- isLoading,
- selectedRepo,
-}: LaunchMicroagentModalProps) {
- const { t } = useTranslation();
- const { runtimeActive } = useHandleRuntimeActive();
- const { data: conversation } = useActiveConversation();
- const { data: prompt, isLoading: promptIsLoading } =
- useMicroagentPrompt(eventId);
-
- const { data: microagents, isLoading: microagentsIsLoading } =
- useGetMicroagents(`${selectedRepo}/.openhands/microagents`);
-
- const [triggers, setTriggers] = React.useState<string[]>([]);
-
- // TODO: Hide LaunchMicroagentModal for V1 conversations
- // This is a temporary measure and may be re-enabled in the future
- const isV1Conversation = conversation?.conversation_version === "V1";
-
- // Don't render anything for V1 conversations
- if (isV1Conversation) {
- return null;
- }
-
- const formAction = (formData: FormData) => {
- const query = formData.get("query-input")?.toString();
- const target = formData.get("target-input")?.toString();
-
- if (query && target) {
- onLaunch(query, target, triggers);
- }
- };
-
- const onSubmit = (event: React.FormEvent<HTMLFormElement>) => {
- event.preventDefault();
- const formData = new FormData(event.currentTarget);
- formAction(formData);
- };
-
- return (
- <ModalBackdrop onClose={onClose}>
- {!runtimeActive && <LoadingMicroagentBody />}
- {runtimeActive && (
- <ModalBody className="items-start w-[728px]">
- <div className="flex items-center justify-between w-full">
- <h2 className="font-bold text-[20px] leading-6 -tracking-[0.01em] flex items-center gap-2">
- {t("MICROAGENT$ADD_TO_MICROAGENT")}
- <a
- href="https://docs.all-hands.dev/usage/prompting/microagents-overview#microagents-overview"
- target="_blank"
- rel="noopener noreferrer"
- >
- <FaCircleInfo className="text-primary" />
- </a>
- </h2>
-
- <button type="button" onClick={onClose}>
- <CloseIcon />
- </button>
- </div>
-
- <Typography.Text className="text-sm text-[#A3A3A3] font-normal leading-5">
- {t("MICROAGENT$DEFINITION")}
- </Typography.Text>
-
- <form
- data-testid="launch-microagent-modal"
- onSubmit={onSubmit}
- className="flex flex-col gap-6 w-full"
- >
- <label
- htmlFor="query-input"
- className="flex flex-col gap-2.5 w-full text-sm"
- >
- {t("MICROAGENT$WHAT_TO_REMEMBER")}
- {promptIsLoading && <LoadingMicroagentTextarea />}
- {!promptIsLoading && (
- <textarea
- required
- data-testid="query-input"
- name="query-input"
- defaultValue={prompt}
- placeholder={t("MICROAGENT$DESCRIBE_WHAT_TO_ADD")}
- rows={6}
- className={cn(
- "bg-tertiary border border-[#717888] w-full rounded p-2 placeholder:italic placeholder:text-tertiary-alt resize-none",
- "disabled:bg-[#2D2F36] disabled:border-[#2D2F36] disabled:cursor-not-allowed",
- )}
- />
- )}
- </label>
-
- <SettingsDropdownInput
- testId="target-input"
- name="target-input"
- label={t("MICROAGENT$WHERE_TO_PUT")}
- placeholder={t("MICROAGENT$SELECT_FILE_OR_CUSTOM")}
- required
- allowsCustomValue
- isLoading={microagentsIsLoading}
- items={
- microagents?.map((item) => ({
- key: item,
- label: item,
- })) || []
- }
- />
-
- <label
- htmlFor="trigger-input"
- className="flex flex-col gap-2.5 w-full text-sm"
- >
- <div className="flex items-center gap-2">
- {t("MICROAGENT$ADD_TRIGGERS")}
- <a
- href="https://docs.all-hands.dev/usage/prompting/microagents-keyword"
- target="_blank"
- rel="noopener noreferrer"
- >
- <FaCircleInfo className="text-primary" />
- </a>
- </div>
- <BadgeInput
- name="trigger-input"
- value={triggers}
- placeholder={t("MICROAGENT$TYPE_TRIGGER_SPACE")}
- onChange={setTriggers}
- />
- </label>
-
- <div className="flex items-center justify-end gap-2">
- <BrandButton type="button" variant="secondary" onClick={onClose}>
- {t("MICROAGENT$CANCEL")}
- </BrandButton>
- <BrandButton
- type="submit"
- variant="primary"
- isDisabled={
- isLoading || promptIsLoading || microagentsIsLoading
- }
- >
- {t("MICROAGENT$LAUNCH")}
- </BrandButton>
- </div>
- </form>
- </ModalBody>
- )}
- </ModalBackdrop>
- );
-}
diff --git a/frontend/src/components/features/chat/microagent/loading-microagent-body.tsx b/frontend/src/components/features/chat/microagent/loading-microagent-body.tsx
deleted file mode 100644
index f0fc25a67e..0000000000
--- a/frontend/src/components/features/chat/microagent/loading-microagent-body.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { Spinner } from "@heroui/react";
-import { useTranslation } from "react-i18next";
-import { ModalBody } from "#/components/shared/modals/modal-body";
-import { Typography } from "#/ui/typography";
-
-export function LoadingMicroagentBody() {
- const { t } = useTranslation();
- return (
- <ModalBody>
- <h2 className="font-bold text-[20px] leading-6 -tracking-[0.01em] flex items-center gap-2">
- {t("MICROAGENT$ADD_TO_MICROAGENT")}
- </h2>
- <Spinner size="lg" />
- <Typography.Text>{t("MICROAGENT$WAIT_FOR_RUNTIME")}</Typography.Text>
- </ModalBody>
- );
-}
diff --git a/frontend/src/components/features/chat/microagent/loading-microagent-textarea.tsx b/frontend/src/components/features/chat/microagent/loading-microagent-textarea.tsx
deleted file mode 100644
index 03b4f11771..0000000000
--- a/frontend/src/components/features/chat/microagent/loading-microagent-textarea.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { useTranslation } from "react-i18next";
-import { cn } from "#/utils/utils";
-
-export function LoadingMicroagentTextarea() {
- const { t } = useTranslation();
-
- return (
- <textarea
- required
- disabled
- defaultValue=""
- placeholder={t("MICROAGENT$LOADING_PROMPT")}
- rows={6}
- className={cn(
- "bg-tertiary border border-[#717888] w-full rounded p-2 placeholder:italic placeholder:text-tertiary-alt resize-none",
- "disabled:bg-[#2D2F36] disabled:border-[#2D2F36] disabled:cursor-not-allowed",
- )}
- />
- );
-}
diff --git a/frontend/src/components/features/chat/microagent/microagent-status-indicator.tsx b/frontend/src/components/features/chat/microagent/microagent-status-indicator.tsx
deleted file mode 100644
index bbcd1af052..0000000000
--- a/frontend/src/components/features/chat/microagent/microagent-status-indicator.tsx
+++ /dev/null
@@ -1,96 +0,0 @@
-import React from "react";
-import { useTranslation } from "react-i18next";
-import { Spinner } from "@heroui/react";
-import { MicroagentStatus } from "#/types/microagent-status";
-import { SuccessIndicator } from "../success-indicator";
-import { Typography } from "#/ui/typography";
-
-interface MicroagentStatusIndicatorProps {
- status: MicroagentStatus;
- conversationId?: string;
- prUrl?: string;
-}
-
-export function MicroagentStatusIndicator({
- status,
- conversationId,
- prUrl,
-}: MicroagentStatusIndicatorProps) {
- const { t } = useTranslation();
-
- const getStatusText = () => {
- switch (status) {
- case MicroagentStatus.WAITING:
- return t("MICROAGENT$STATUS_WAITING");
- case MicroagentStatus.CREATING:
- return t("MICROAGENT$STATUS_CREATING");
- case MicroagentStatus.COMPLETED:
- // If there's a PR URL, show "View your PR" instead of the default completed message
- return prUrl
- ? t("MICROAGENT$VIEW_YOUR_PR")
- : t("MICROAGENT$STATUS_COMPLETED");
- case MicroagentStatus.ERROR:
- return t("MICROAGENT$STATUS_ERROR");
- default:
- return "";
- }
- };
-
- const getStatusIcon = () => {
- switch (status) {
- case MicroagentStatus.WAITING:
- return <Spinner size="sm" />;
- case MicroagentStatus.CREATING:
- return <Spinner size="sm" />;
- case MicroagentStatus.COMPLETED:
- return <SuccessIndicator status="success" />;
- case MicroagentStatus.ERROR:
- return <SuccessIndicator status="error" />;
- default:
- return null;
- }
- };
-
- const statusText = getStatusText();
- const shouldShowAsLink = !!conversationId;
- const shouldShowPRLink = !!prUrl;
-
- const renderStatusText = () => {
- if (shouldShowPRLink) {
- return (
- <a
- href={prUrl}
- target="_blank"
- rel="noopener noreferrer"
- className="underline"
- >
- {statusText}
- </a>
- );
- }
-
- if (shouldShowAsLink) {
- return (
- <a
- href={`/conversations/${conversationId}`}
- target="_blank"
- rel="noopener noreferrer"
- className="underline"
- >
- {statusText}
- </a>
- );
- }
-
- return (
- <Typography.Text className="underline">{statusText}</Typography.Text>
- );
- };
-
- return (
- <div className="flex items-center gap-2 mt-2 p-2 text-sm">
- {getStatusIcon()}
- {renderStatusText()}
- </div>
- );
-}
diff --git a/frontend/src/components/features/chat/microagent/microagent-status-toast.tsx b/frontend/src/components/features/chat/microagent/microagent-status-toast.tsx
deleted file mode 100644
index 9df0487766..0000000000
--- a/frontend/src/components/features/chat/microagent/microagent-status-toast.tsx
+++ /dev/null
@@ -1,193 +0,0 @@
-import toast from "react-hot-toast";
-import { Spinner } from "@heroui/react";
-import { useTranslation } from "react-i18next";
-import { TOAST_OPTIONS } from "#/utils/custom-toast-handlers";
-import CloseIcon from "#/icons/close.svg?react";
-import { SuccessIndicator } from "../success-indicator";
-
-interface ConversationCreatedToastProps {
- conversationId: string;
- onClose: () => void;
-}
-
-interface ConversationStartingToastProps {
- conversationId: string;
- onClose: () => void;
-}
-
-function ConversationCreatedToast({
- conversationId,
- onClose,
-}: ConversationCreatedToastProps) {
- const { t } = useTranslation();
- return (
- <div className="flex items-start gap-2">
- <Spinner size="sm" />
- <div>
- {t("MICROAGENT$ADDING_CONTEXT")}
- <br />
- <a
- href={`/conversations/${conversationId}`}
- target="_blank"
- rel="noopener noreferrer"
- className="underline"
- >
- {t("MICROAGENT$VIEW_CONVERSATION")}
- </a>
- </div>
- <button type="button" onClick={onClose}>
- <CloseIcon />
- </button>
- </div>
- );
-}
-
-function ConversationStartingToast({
- conversationId,
- onClose,
-}: ConversationStartingToastProps) {
- const { t } = useTranslation();
- return (
- <div className="flex items-start gap-2">
- <Spinner size="sm" />
- <div>
- {t("MICROAGENT$CONVERSATION_STARTING")}
- <br />
- <a
- href={`/conversations/${conversationId}`}
- target="_blank"
- rel="noopener noreferrer"
- className="underline"
- >
- {t("MICROAGENT$VIEW_CONVERSATION")}
- </a>
- </div>
- <button type="button" onClick={onClose}>
- <CloseIcon />
- </button>
- </div>
- );
-}
-
-interface ConversationFinishedToastProps {
- conversationId: string;
- onClose: () => void;
-}
-
-function ConversationFinishedToast({
- conversationId,
- onClose,
-}: ConversationFinishedToastProps) {
- const { t } = useTranslation();
- return (
- <div className="flex items-start gap-2">
- <SuccessIndicator status="success" />
- <div>
- {t("MICROAGENT$SUCCESS_PR_READY")}
- <br />
- <a
- href={`/conversations/${conversationId}`}
- target="_blank"
- rel="noopener noreferrer"
- className="underline"
- >
- {t("MICROAGENT$VIEW_CONVERSATION")}
- </a>
- </div>
- <button type="button" onClick={onClose}>
- <CloseIcon />
- </button>
- </div>
- );
-}
-
-interface ConversationErroredToastProps {
- errorMessage: string;
- onClose: () => void;
-}
-
-function ConversationErroredToast({
- errorMessage,
- onClose,
-}: ConversationErroredToastProps) {
- const { t } = useTranslation();
-
- // Check if the error message is a translation key
- const displayMessage =
- errorMessage === "MICROAGENT$UNKNOWN_ERROR"
- ? t(errorMessage)
- : errorMessage;
-
- return (
- <div className="flex items-start gap-2">
- <SuccessIndicator status="error" />
- <div>{displayMessage}</div>
- <button type="button" onClick={onClose}>
- <CloseIcon />
- </button>
- </div>
- );
-}
-
-export const renderConversationCreatedToast = (conversationId: string) =>
- toast(
- (t) => (
- <ConversationCreatedToast
- conversationId={conversationId}
- onClose={() => toast.dismiss(t.id)}
- />
- ),
- {
- ...TOAST_OPTIONS,
- id: `status-${conversationId}`,
- duration: 5000,
- },
- );
-
-export const renderConversationFinishedToast = (conversationId: string) =>
- toast(
- (t) => (
- <ConversationFinishedToast
- conversationId={conversationId}
- onClose={() => toast.dismiss(t.id)}
- />
- ),
- {
- ...TOAST_OPTIONS,
- id: `status-${conversationId}`,
- duration: 5000,
- },
- );
-
-export const renderConversationErroredToast = (
- conversationId: string,
- errorMessage: string,
-) =>
- toast(
- (t) => (
- <ConversationErroredToast
- errorMessage={errorMessage}
- onClose={() => toast.dismiss(t.id)}
- />
- ),
- {
- ...TOAST_OPTIONS,
- id: `status-${conversationId}`,
- duration: 5000,
- },
- );
-
-export const renderConversationStartingToast = (conversationId: string) =>
- toast(
- (toastInstance) => (
- <ConversationStartingToast
- conversationId={conversationId}
- onClose={() => toast.dismiss(toastInstance.id)}
- />
- ),
- {
- ...TOAST_OPTIONS,
- id: `starting-${conversationId}`,
- duration: 10000, // Show for 10 seconds or until dismissed
- },
- );
diff --git a/frontend/src/components/shared/conversation-toast.tsx b/frontend/src/components/shared/conversation-toast.tsx
new file mode 100644
index 0000000000..ccfdeba698
--- /dev/null
+++ b/frontend/src/components/shared/conversation-toast.tsx
@@ -0,0 +1,22 @@
+import toast from "react-hot-toast";
+
+export function renderConversationErroredToast(
+ _conversationId: string,
+ message: string,
+): void {
+ toast.error(message);
+}
+
+export function renderConversationCreatedToast(): void {
+ toast.success("Runtime started");
+}
+
+export function renderConversationFinishedToast(): void {
+ toast.success("Conversation finished");
+}
+
+export function renderConversationStartingToast(conversationId: string): void {
+ toast.loading("Starting runtime...", {
+ id: `starting-${conversationId}`,
+ });
+}
diff --git a/frontend/src/components/v1/chat/event-message-components/error-event-message.tsx b/frontend/src/components/v1/chat/event-message-components/error-event-message.tsx
index 98ae2b23c6..541f86d07d 100644
--- a/frontend/src/components/v1/chat/event-message-components/error-event-message.tsx
+++ b/frontend/src/components/v1/chat/event-message-components/error-event-message.tsx
@@ -2,30 +2,12 @@ import React from "react";
import { AgentErrorEvent } from "#/types/v1/core";
import { isAgentErrorEvent } from "#/types/v1/type-guards";
import { ErrorMessage } from "../../../features/chat/error-message";
-import { MicroagentStatusWrapper } from "../../../features/chat/event-message-components/microagent-status-wrapper";
-// TODO: Implement V1 LikertScaleWrapper when API supports V1 event IDs
-// import { LikertScaleWrapper } from "../../../features/chat/event-message-components/likert-scale-wrapper";
-import { MicroagentStatus } from "#/types/microagent-status";
interface ErrorEventMessageProps {
event: AgentErrorEvent;
- microagentStatus?: MicroagentStatus | null;
- microagentConversationId?: string;
- microagentPRUrl?: string;
- actions?: Array<{
- icon: React.ReactNode;
- onClick: () => void;
- tooltip?: string;
- }>;
}
-export function ErrorEventMessage({
- event,
- microagentStatus,
- microagentConversationId,
- microagentPRUrl,
- actions,
-}: ErrorEventMessageProps) {
+export function ErrorEventMessage({ event }: ErrorEventMessageProps) {
if (!isAgentErrorEvent(event)) {
return null;
}
@@ -37,12 +19,6 @@ export function ErrorEventMessage({
errorId={event.id}
defaultMessage={event.error}
/>
- <MicroagentStatusWrapper
- microagentStatus={microagentStatus}
- microagentConversationId={microagentConversationId}
- microagentPRUrl={microagentPRUrl}
- actions={actions}
- />
{/* LikertScaleWrapper expects V0 event types, skip for now */}
</div>
);
diff --git a/frontend/src/components/v1/chat/event-message-components/finish-event-message.tsx b/frontend/src/components/v1/chat/event-message-components/finish-event-message.tsx
index 146c031dfb..59a122fc32 100644
--- a/frontend/src/components/v1/chat/event-message-components/finish-event-message.tsx
+++ b/frontend/src/components/v1/chat/event-message-components/finish-event-message.tsx
@@ -2,31 +2,17 @@ import React from "react";
import { ActionEvent } from "#/types/v1/core";
import { FinishAction } from "#/types/v1/core/base/action";
import { ChatMessage } from "../../../features/chat/chat-message";
-import { MicroagentStatusWrapper } from "../../../features/chat/event-message-components/microagent-status-wrapper";
// TODO: Implement V1 LikertScaleWrapper when API supports V1 event IDs
// import { LikertScaleWrapper } from "../../../features/chat/event-message-components/likert-scale-wrapper";
import { getEventContent } from "../event-content-helpers/get-event-content";
-import { MicroagentStatus } from "#/types/microagent-status";
interface FinishEventMessageProps {
event: ActionEvent<FinishAction>;
- microagentStatus?: MicroagentStatus | null;
- microagentConversationId?: string;
- microagentPRUrl?: string;
- actions?: Array<{
- icon: React.ReactNode;
- onClick: () => void;
- tooltip?: string;
- }>;
isFromPlanningAgent?: boolean;
}
export function FinishEventMessage({
event,
- microagentStatus,
- microagentConversationId,
- microagentPRUrl,
- actions,
isFromPlanningAgent = false,
}: FinishEventMessageProps) {
const eventContent = getEventContent(event);
@@ -41,15 +27,8 @@ export function FinishEventMessage({
<ChatMessage
type="agent"
message={message}
- actions={actions}
isFromPlanningAgent={isFromPlanningAgent}
/>
- <MicroagentStatusWrapper
- microagentStatus={microagentStatus}
- microagentConversationId={microagentConversationId}
- microagentPRUrl={microagentPRUrl}
- actions={actions}
- />
{/* LikertScaleWrapper expects V0 event types, skip for now */}
</>
);
diff --git a/frontend/src/components/v1/chat/event-message-components/observation-pair-event-message.tsx b/frontend/src/components/v1/chat/event-message-components/observation-pair-event-message.tsx
index 221d758dd6..83eea75d30 100644
--- a/frontend/src/components/v1/chat/event-message-components/observation-pair-event-message.tsx
+++ b/frontend/src/components/v1/chat/event-message-components/observation-pair-event-message.tsx
@@ -2,27 +2,13 @@ import React from "react";
import { ActionEvent } from "#/types/v1/core";
import { isActionEvent } from "#/types/v1/type-guards";
import { ChatMessage } from "../../../features/chat/chat-message";
-import { MicroagentStatusWrapper } from "../../../features/chat/event-message-components/microagent-status-wrapper";
-import { MicroagentStatus } from "#/types/microagent-status";
interface ObservationPairEventMessageProps {
event: ActionEvent;
- microagentStatus?: MicroagentStatus | null;
- microagentConversationId?: string;
- microagentPRUrl?: string;
- actions?: Array<{
- icon: React.ReactNode;
- onClick: () => void;
- tooltip?: string;
- }>;
}
export function ObservationPairEventMessage({
event,
- microagentStatus,
- microagentConversationId,
- microagentPRUrl,
- actions,
}: ObservationPairEventMessageProps) {
if (!isActionEvent(event)) {
return null;
@@ -42,23 +28,10 @@ export function ObservationPairEventMessage({
) {
return (
<div>
- <ChatMessage type="agent" message={thoughtContent} actions={actions} />
- <MicroagentStatusWrapper
- microagentStatus={microagentStatus}
- microagentConversationId={microagentConversationId}
- microagentPRUrl={microagentPRUrl}
- actions={actions}
- />
+ <ChatMessage type="agent" message={thoughtContent} />
</div>
);
}
- return (
- <MicroagentStatusWrapper
- microagentStatus={microagentStatus}
- microagentConversationId={microagentConversationId}
- microagentPRUrl={microagentPRUrl}
- actions={actions}
- />
- );
+ return null;
}
diff --git a/frontend/src/components/v1/chat/event-message-components/user-assistant-event-message.tsx b/frontend/src/components/v1/chat/event-message-components/user-assistant-event-message.tsx
index a51b912860..70e48cc1c2 100644
--- a/frontend/src/components/v1/chat/event-message-components/user-assistant-event-message.tsx
+++ b/frontend/src/components/v1/chat/event-message-components/user-assistant-event-message.tsx
@@ -5,32 +5,18 @@ import { ImageCarousel } from "../../../features/images/image-carousel";
// TODO: Implement file_urls support for V1 messages
// import { FileList } from "../../../features/files/file-list";
import { V1ConfirmationButtons } from "#/components/shared/buttons/v1-confirmation-buttons";
-import { MicroagentStatusWrapper } from "../../../features/chat/event-message-components/microagent-status-wrapper";
// TODO: Implement V1 LikertScaleWrapper when API supports V1 event IDs
// import { LikertScaleWrapper } from "../../../features/chat/event-message-components/likert-scale-wrapper";
import { parseMessageFromEvent } from "../event-content-helpers/parse-message-from-event";
-import { MicroagentStatus } from "#/types/microagent-status";
interface UserAssistantEventMessageProps {
event: MessageEvent;
- microagentStatus?: MicroagentStatus | null;
- microagentConversationId?: string;
- microagentPRUrl?: string;
- actions?: Array<{
- icon: React.ReactNode;
- onClick: () => void;
- tooltip?: string;
- }>;
isLastMessage: boolean;
isFromPlanningAgent: boolean;
}
export function UserAssistantEventMessage({
event,
- microagentStatus,
- microagentConversationId,
- microagentPRUrl,
- actions,
isLastMessage,
isFromPlanningAgent,
}: UserAssistantEventMessageProps) {
@@ -51,7 +37,6 @@ export function UserAssistantEventMessage({
<ChatMessage
type={event.source}
message={message}
- actions={actions}
isFromPlanningAgent={isFromPlanningAgent}
>
{imageUrls.length > 0 && (
@@ -60,12 +45,6 @@ export function UserAssistantEventMessage({
{/* TODO: Handle file_urls if V1 messages support them */}
{isLastMessage && <V1ConfirmationButtons />}
</ChatMessage>
- <MicroagentStatusWrapper
- microagentStatus={microagentStatus}
- microagentConversationId={microagentConversationId}
- microagentPRUrl={microagentPRUrl}
- actions={actions}
- />
{/* LikertScaleWrapper expects V0 event types, skip for now */}
</>
);
diff --git a/frontend/src/components/v1/chat/event-message.tsx b/frontend/src/components/v1/chat/event-message.tsx
index 14ee59df46..5d4e5910c6 100644
--- a/frontend/src/components/v1/chat/event-message.tsx
+++ b/frontend/src/components/v1/chat/event-message.tsx
@@ -9,7 +9,6 @@ import {
isPlanningFileEditorObservationEvent,
isHookExecutionEvent,
} from "#/types/v1/type-guards";
-import { MicroagentStatus } from "#/types/microagent-status";
import { useConfig } from "#/hooks/query/use-config";
import { useConversationStore } from "#/stores/conversation-store";
import { useAgentState } from "#/hooks/use-agent-state";
@@ -32,14 +31,6 @@ interface EventMessageProps {
event: OpenHandsEvent & { isFromPlanningAgent?: boolean };
messages: OpenHandsEvent[];
isLastMessage: boolean;
- microagentStatus?: MicroagentStatus | null;
- microagentConversationId?: string;
- microagentPRUrl?: string;
- actions?: Array<{
- icon: React.ReactNode;
- onClick: () => void;
- tooltip?: string;
- }>;
isInLast10Actions: boolean;
/** Set of event IDs that should render PlanPreview (one per user message phase) */
planPreviewEventIds?: Set<string>;
@@ -83,14 +74,6 @@ const shouldShowSkillReadyEvent = (messageEvent: MessageEvent): boolean => {
};
interface CommonProps {
- microagentStatus?: MicroagentStatus | null;
- microagentConversationId?: string;
- microagentPRUrl?: string;
- actions?: Array<{
- icon: React.ReactNode;
- onClick: () => void;
- tooltip?: string;
- }>;
isLastMessage: boolean;
isInLast10Actions: boolean;
config: unknown;
@@ -113,10 +96,6 @@ const renderUserMessageWithSkillReady = (
<>
<UserAssistantEventMessage
event={messageEvent}
- microagentStatus={commonProps.microagentStatus}
- microagentConversationId={commonProps.microagentConversationId}
- microagentPRUrl={commonProps.microagentPRUrl}
- actions={commonProps.actions}
isLastMessage={false}
isFromPlanningAgent={commonProps.isFromPlanningAgent}
/>
@@ -131,10 +110,6 @@ const renderUserMessageWithSkillReady = (
return (
<UserAssistantEventMessage
event={messageEvent}
- microagentStatus={commonProps.microagentStatus}
- microagentConversationId={commonProps.microagentConversationId}
- microagentPRUrl={commonProps.microagentPRUrl}
- actions={commonProps.actions}
isLastMessage={isLastMessage}
isFromPlanningAgent={commonProps.isFromPlanningAgent}
/>
@@ -147,10 +122,6 @@ export function EventMessage({
event,
messages,
isLastMessage,
- microagentStatus,
- microagentConversationId,
- microagentPRUrl,
- actions,
isInLast10Actions,
planPreviewEventIds,
}: EventMessageProps) {
@@ -173,10 +144,6 @@ export function EventMessage({
// Common props for components that need them
const commonProps = {
- microagentStatus,
- microagentConversationId,
- microagentPRUrl,
- actions,
isLastMessage,
isInLast10Actions,
config,
@@ -211,7 +178,6 @@ export function EventMessage({
<>
<ThoughtEventMessage
event={event}
- actions={actions}
isFromPlanningAgent={isFromPlanningAgent}
/>
<GenericEventMessageWrapper
@@ -258,7 +224,6 @@ export function EventMessage({
{correspondingAction && isActionEvent(correspondingAction) && (
<ThoughtEventMessage
event={correspondingAction}
- actions={actions}
isFromPlanningAgent={isFromPlanningAgent}
/>
)}
diff --git a/frontend/src/context/conversation-subscriptions-provider.tsx b/frontend/src/context/conversation-subscriptions-provider.tsx
index ab36d75774..b93845e368 100644
--- a/frontend/src/context/conversation-subscriptions-provider.tsx
+++ b/frontend/src/context/conversation-subscriptions-provider.tsx
@@ -18,7 +18,7 @@ import {
renderConversationErroredToast,
renderConversationCreatedToast,
renderConversationFinishedToast,
-} from "#/components/features/chat/microagent/microagent-status-toast";
+} from "#/components/shared/conversation-toast";
import { Provider } from "#/types/settings";
interface ConversationSocket {
@@ -185,14 +185,14 @@ export function ConversationSubscriptionsProvider({
);
} else if (isStatusUpdate(event)) {
if (event.type === "info" && event.id === "STATUS$STARTING_RUNTIME") {
- renderConversationCreatedToast(conversationId);
+ renderConversationCreatedToast();
}
} else if (
isOpenHandsEvent(event) &&
isAgentStateChangeObservation(event)
) {
if (event.extras.agent_state === AgentState.FINISHED) {
- renderConversationFinishedToast(conversationId);
+ renderConversationFinishedToast();
unsubscribeFromConversation(conversationId);
}
}
diff --git a/frontend/src/hooks/query/use-get-microagents.ts b/frontend/src/hooks/query/use-get-microagents.ts
deleted file mode 100644
index 67a4fecfd1..0000000000
--- a/frontend/src/hooks/query/use-get-microagents.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { useQuery } from "@tanstack/react-query";
-import { useConversationId } from "../use-conversation-id";
-import ConversationService from "#/api/conversation-service/conversation-service.api";
-
-export const useGetMicroagents = (microagentDirectory: string) => {
- const { conversationId } = useConversationId();
-
- return useQuery({
- queryKey: ["files", "microagents", conversationId, microagentDirectory],
- queryFn: () =>
- ConversationService.getFiles(conversationId!, microagentDirectory),
- enabled: !!conversationId,
- select: (data) =>
- data.map((fileName) => fileName.replace(microagentDirectory, "")),
- });
-};
diff --git a/frontend/src/hooks/query/use-microagent-prompt.ts b/frontend/src/hooks/query/use-microagent-prompt.ts
deleted file mode 100644
index 4661520d15..0000000000
--- a/frontend/src/hooks/query/use-microagent-prompt.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { useQuery } from "@tanstack/react-query";
-import ConversationService from "#/api/conversation-service/conversation-service.api";
-import { useConversationId } from "../use-conversation-id";
-
-export const useMicroagentPrompt = (eventId: number) => {
- const { conversationId } = useConversationId();
- return useQuery({
- queryKey: ["memory", "prompt", conversationId, eventId],
- queryFn: () =>
- ConversationService.getMicroagentPrompt(conversationId!, eventId),
- enabled: !!conversationId,
- staleTime: 1000 * 60 * 5, // 5 minutes
- gcTime: 1000 * 60 * 15, // 15 minutes
- });
-};
diff --git a/frontend/src/hooks/use-create-conversation-and-subscribe-multiple.ts b/frontend/src/hooks/use-create-conversation-and-subscribe-multiple.ts
index 1dd5833ab0..fa5c4ec41d 100644
--- a/frontend/src/hooks/use-create-conversation-and-subscribe-multiple.ts
+++ b/frontend/src/hooks/use-create-conversation-and-subscribe-multiple.ts
@@ -8,7 +8,7 @@ import { useConversationSubscriptions } from "#/context/conversation-subscriptio
import { Provider } from "#/types/settings";
import { CreateMicroagent, Conversation } from "#/api/open-hands.types";
import ConversationService from "#/api/conversation-service/conversation-service.api";
-import { renderConversationStartingToast } from "#/components/features/chat/microagent/microagent-status-toast";
+import { renderConversationStartingToast } from "#/components/shared/conversation-toast";
interface ConversationData {
conversationId: string;
diff --git a/frontend/src/types/microagent-status.ts b/frontend/src/types/microagent-status.ts
deleted file mode 100644
index 532cbffa02..0000000000
--- a/frontend/src/types/microagent-status.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-export enum MicroagentStatus {
- WAITING = "waiting",
- CREATING = "creating",
- COMPLETED = "completed",
- ERROR = "error",
-}
-
-export interface EventMicroagentStatus {
- eventId: number;
- conversationId: string;
- status: MicroagentStatus;
- prUrl?: string; // Optional PR URL for completed status
-}