Skip to content

🙌 OpenHands: AI-Driven Development

feat(frontend): Add /launch route for starting conversations with plugins (#12699)

John-Mason P. Shackelford7774f43ca116
diff --git a/frontend/__tests__/components/features/launch/plugin-launch-modal.test.tsx b/frontend/__tests__/components/features/launch/plugin-launch-modal.test.tsx
new file mode 100644
index 0000000000..c5c27adc5d
--- /dev/null
+++ b/frontend/__tests__/components/features/launch/plugin-launch-modal.test.tsx
@@ -0,0 +1,426 @@
+import { render, screen, waitFor } from "@testing-library/react";
+import { describe, it, expect, vi, beforeEach } from "vitest";
+import userEvent from "@testing-library/user-event";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { PluginLaunchModal } from "#/components/features/launch/plugin-launch-modal";
+import { PluginSpec } from "#/api/conversation-service/v1-conversation-service.types";
+
+const mockOnStartConversation = vi.fn();
+const mockOnClose = vi.fn();
+
+function renderModal(
+ plugins: PluginSpec[],
+ props: Partial<{
+ message: string;
+ isLoading: boolean;
+ }> = {},
+) {
+ const queryClient = new QueryClient({
+ defaultOptions: { queries: { retry: false } },
+ });
+
+ return render(
+ <QueryClientProvider client={queryClient}>
+ <PluginLaunchModal
+ plugins={plugins}
+ message={props.message}
+ isLoading={props.isLoading ?? false}
+ onStartConversation={mockOnStartConversation}
+ onClose={mockOnClose}
+ />
+ </QueryClientProvider>,
+ );
+}
+
+describe("PluginLaunchModal", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ describe("Plugin Display Name Extraction", () => {
+ it("should extract plugin name from repo_path when provided", () => {
+ renderModal([{ source: "github:owner/repo", repo_path: "plugins/my-plugin" }]);
+
+ // Plugin name should be "my-plugin" from the path
+ expect(screen.getByText("my-plugin")).toBeInTheDocument();
+ });
+
+ it("should show repo path when no repo_path (repo IS the plugin)", () => {
+ renderModal([{ source: "github:owner/my-plugin" }]);
+
+ // When no repo_path, the whole repo is the plugin, show "owner/my-plugin"
+ const elements = screen.getAllByText("owner/my-plugin");
+ expect(elements.length).toBeGreaterThan(0);
+ });
+
+ it("should extract name from git URL", () => {
+ renderModal([
+ { source: "https://github.com/owner/repo-name.git" },
+ ]);
+
+ const elements = screen.getAllByText("repo-name");
+ expect(elements.length).toBeGreaterThan(0);
+ });
+
+ it("should display full source when no special format", () => {
+ renderModal([{ source: "local-plugin" }]);
+
+ const elements = screen.getAllByText("local-plugin");
+ expect(elements.length).toBeGreaterThan(0);
+ });
+ });
+
+ describe("Modal Title", () => {
+ it("should show plugin name in title for single plugin", () => {
+ renderModal([{ source: "github:owner/awesome-plugin" }]);
+
+ // Title should include the plugin name - use getAllBy since text appears in multiple places
+ const elements = screen.getAllByText(/owner\/awesome-plugin/);
+ expect(elements.length).toBeGreaterThan(0);
+ });
+
+ it("should show generic title for multiple plugins", () => {
+ renderModal([
+ { source: "github:owner/plugin1" },
+ { source: "github:owner/plugin2" },
+ ]);
+
+ // The h2 title contains both LAUNCH$MODAL_TITLE and LAUNCH$MODAL_TITLE_GENERIC
+ const title = screen.getByRole("heading", { level: 2 });
+ expect(title.textContent).toContain("LAUNCH$MODAL_TITLE_GENERIC");
+ });
+ });
+
+ describe("Message Display", () => {
+ it("should display message when provided", () => {
+ renderModal([{ source: "github:owner/repo" }], {
+ message: "This is a custom message",
+ });
+
+ expect(screen.getByText("This is a custom message")).toBeInTheDocument();
+ });
+
+ it("should not render message element when not provided", () => {
+ renderModal([{ source: "github:owner/repo" }]);
+
+ // No message should be present
+ const modal = screen.getByTestId("plugin-launch-modal");
+ expect(modal.querySelector("p.text-neutral-400")).not.toBeInTheDocument();
+ });
+ });
+
+ describe("Expandable Sections", () => {
+ it("should expand plugin section by default when it has parameters", () => {
+ renderModal([
+ {
+ source: "github:owner/repo",
+ parameters: { apiKey: "test-key" },
+ },
+ ]);
+
+ // Parameter input should be visible (section is expanded)
+ expect(screen.getByTestId("plugin-0-param-apiKey")).toBeInTheDocument();
+ });
+
+ it("should collapse/expand section when clicking header", async () => {
+ const user = userEvent.setup();
+ renderModal([
+ {
+ source: "github:owner/repo",
+ parameters: { apiKey: "test-key" },
+ },
+ ]);
+
+ // Initially expanded - parameter visible
+ expect(screen.getByTestId("plugin-0-param-apiKey")).toBeInTheDocument();
+
+ // Click to collapse
+ await user.click(screen.getByTestId("plugin-section-0"));
+
+ // Parameter should be hidden
+ await waitFor(() => {
+ expect(
+ screen.queryByTestId("plugin-0-param-apiKey"),
+ ).not.toBeInTheDocument();
+ });
+
+ // Click to expand again
+ await user.click(screen.getByTestId("plugin-section-0"));
+
+ // Parameter should be visible again
+ await waitFor(() => {
+ expect(screen.getByTestId("plugin-0-param-apiKey")).toBeInTheDocument();
+ });
+ });
+ });
+
+ describe("Parameter Inputs", () => {
+ it("should render text input for string parameters", () => {
+ renderModal([
+ {
+ source: "github:owner/repo",
+ parameters: { name: "default-name" },
+ },
+ ]);
+
+ const input = screen.getByTestId("plugin-0-param-name");
+ expect(input).toHaveAttribute("type", "text");
+ expect(input).toHaveValue("default-name");
+ });
+
+ it("should render number input for number parameters", () => {
+ renderModal([
+ {
+ source: "github:owner/repo",
+ parameters: { count: 42 },
+ },
+ ]);
+
+ const input = screen.getByTestId("plugin-0-param-count");
+ expect(input).toHaveAttribute("type", "number");
+ expect(input).toHaveValue(42);
+ });
+
+ it("should render checkbox for boolean parameters", () => {
+ renderModal([
+ {
+ source: "github:owner/repo",
+ parameters: { enabled: true },
+ },
+ ]);
+
+ const checkbox = screen.getByTestId("plugin-0-param-enabled");
+ expect(checkbox).toHaveAttribute("type", "checkbox");
+ expect(checkbox).toBeChecked();
+ });
+
+ it("should update string parameter value when typing", async () => {
+ const user = userEvent.setup();
+ renderModal([
+ {
+ source: "github:owner/repo",
+ parameters: { apiKey: "initial" },
+ },
+ ]);
+
+ const input = screen.getByTestId("plugin-0-param-apiKey");
+ await user.clear(input);
+ await user.type(input, "new-value");
+
+ expect(input).toHaveValue("new-value");
+ });
+
+ it("should update number parameter value when typing", async () => {
+ const user = userEvent.setup();
+ renderModal([
+ {
+ source: "github:owner/repo",
+ parameters: { count: 5 },
+ },
+ ]);
+
+ const input = screen.getByTestId("plugin-0-param-count");
+ await user.clear(input);
+ await user.type(input, "100");
+
+ expect(input).toHaveValue(100);
+ });
+
+ it("should toggle boolean parameter when clicking checkbox", async () => {
+ const user = userEvent.setup();
+ renderModal([
+ {
+ source: "github:owner/repo",
+ parameters: { debug: false },
+ },
+ ]);
+
+ const checkbox = screen.getByTestId("plugin-0-param-debug");
+ expect(checkbox).not.toBeChecked();
+
+ await user.click(checkbox);
+
+ expect(checkbox).toBeChecked();
+ });
+ });
+
+ describe("Ref and Path Display", () => {
+ it("should display ref when provided", async () => {
+ renderModal([
+ {
+ source: "github:owner/repo",
+ ref: "v1.2.3",
+ parameters: { key: "value" },
+ },
+ ]);
+
+ // Check the expanded section contains the ref value
+ const modal = screen.getByTestId("plugin-launch-modal");
+ expect(modal.textContent).toContain("v1.2.3");
+ });
+
+ it("should display repo_path when provided", () => {
+ renderModal([
+ {
+ source: "github:owner/repo",
+ repo_path: "plugins/my-plugin",
+ parameters: { key: "value" },
+ },
+ ]);
+
+ // Check the expanded section contains the path value
+ const modal = screen.getByTestId("plugin-launch-modal");
+ expect(modal.textContent).toContain("plugins/my-plugin");
+ });
+ });
+
+ describe("Plugins Without Parameters", () => {
+ it("should show plugins list when all plugins have no parameters", () => {
+ renderModal([
+ { source: "github:owner/plugin1" },
+ { source: "github:owner/plugin2" },
+ ]);
+
+ expect(screen.getByText("LAUNCH$PLUGINS")).toBeInTheDocument();
+ // When no repo_path, the full repo path is shown (may appear multiple times)
+ expect(screen.getAllByText("owner/plugin1").length).toBeGreaterThan(0);
+ expect(screen.getAllByText("owner/plugin2").length).toBeGreaterThan(0);
+ });
+
+ it("should show 'Additional Plugins' when mixing plugins with and without params", () => {
+ renderModal([
+ { source: "github:owner/with-params", parameters: { key: "val" } },
+ { source: "github:owner/without-params" },
+ ]);
+
+ expect(screen.getByText("LAUNCH$ADDITIONAL_PLUGINS")).toBeInTheDocument();
+ // When no repo_path, the full repo path is shown
+ expect(screen.getAllByText("owner/without-params").length).toBeGreaterThan(0);
+ });
+
+ it("should show ref in simple plugin list", () => {
+ renderModal([
+ { source: "github:owner/plugin", ref: "main" },
+ ]);
+
+ expect(screen.getByText("@ main")).toBeInTheDocument();
+ });
+
+ it("should show repo_path in simple plugin list", () => {
+ renderModal([
+ { source: "github:owner/repo", repo_path: "plugins/city-weather" },
+ ]);
+
+ // Should show the plugin name
+ expect(screen.getByText("city-weather")).toBeInTheDocument();
+ // Should show the source info with path
+ const modal = screen.getByTestId("plugin-launch-modal");
+ expect(modal.textContent).toContain("owner/repo");
+ expect(modal.textContent).toContain("plugins/city-weather");
+ });
+ });
+
+ describe("Action Buttons", () => {
+ it("should call onClose when close button is clicked", async () => {
+ const user = userEvent.setup();
+ renderModal([{ source: "github:owner/repo" }]);
+
+ await user.click(screen.getByTestId("close-button"));
+
+ expect(mockOnClose).toHaveBeenCalledTimes(1);
+ });
+
+ it("should call onStartConversation with updated plugins when start button is clicked", async () => {
+ const user = userEvent.setup();
+ renderModal([
+ {
+ source: "github:owner/repo",
+ ref: "main",
+ parameters: { apiKey: "initial" },
+ },
+ ]);
+
+ // Update the parameter
+ const input = screen.getByTestId("plugin-0-param-apiKey");
+ await user.clear(input);
+ await user.type(input, "updated-key");
+
+ // Check the trust checkbox first
+ await user.click(screen.getByTestId("trust-checkbox"));
+
+ // Click start
+ await user.click(screen.getByTestId("start-conversation-button"));
+
+ expect(mockOnStartConversation).toHaveBeenCalledTimes(1);
+ const calledWithPlugins = mockOnStartConversation.mock.calls[0][0];
+ const calledWithMessage = mockOnStartConversation.mock.calls[0][1];
+ expect(calledWithPlugins[0].source).toBe("github:owner/repo");
+ expect(calledWithPlugins[0].ref).toBe("main");
+ expect(calledWithPlugins[0].parameters.apiKey).toBe("updated-key");
+ expect(calledWithMessage).toBeUndefined();
+ });
+
+ it("should call onStartConversation with message when provided", async () => {
+ const user = userEvent.setup();
+ renderModal(
+ [{ source: "github:owner/repo" }],
+ { message: "/city-weather:now Tokyo" },
+ );
+
+ // Check the trust checkbox first
+ await user.click(screen.getByTestId("trust-checkbox"));
+
+ await user.click(screen.getByTestId("start-conversation-button"));
+
+ expect(mockOnStartConversation).toHaveBeenCalledTimes(1);
+ const calledWithPlugins = mockOnStartConversation.mock.calls[0][0];
+ const calledWithMessage = mockOnStartConversation.mock.calls[0][1];
+ expect(calledWithPlugins[0].source).toBe("github:owner/repo");
+ expect(calledWithMessage).toBe("/city-weather:now Tokyo");
+ });
+
+ it("should show 'Starting...' text when loading", () => {
+ renderModal([{ source: "github:owner/repo" }], { isLoading: true });
+
+ expect(screen.getByText("LAUNCH$STARTING")).toBeInTheDocument();
+ });
+
+ it("should disable start button when loading", () => {
+ renderModal([{ source: "github:owner/repo" }], { isLoading: true });
+
+ expect(screen.getByTestId("start-conversation-button")).toBeDisabled();
+ });
+ });
+
+ describe("Multiple Plugins with Parameters", () => {
+ it("should render multiple expandable sections for plugins with parameters", () => {
+ renderModal([
+ { source: "github:owner/plugin1", parameters: { key1: "val1" } },
+ { source: "github:owner/plugin2", parameters: { key2: "val2" } },
+ ]);
+
+ expect(screen.getByTestId("plugin-section-0")).toBeInTheDocument();
+ expect(screen.getByTestId("plugin-section-1")).toBeInTheDocument();
+ });
+
+ it("should maintain separate state for each plugin's parameters", async () => {
+ const user = userEvent.setup();
+ renderModal([
+ { source: "github:owner/plugin1", parameters: { key1: "val1" } },
+ { source: "github:owner/plugin2", parameters: { key2: "val2" } },
+ ]);
+
+ // Update first plugin's parameter
+ const input1 = screen.getByTestId("plugin-0-param-key1");
+ await user.clear(input1);
+ await user.type(input1, "new-val1");
+
+ // Second plugin's parameter should be unchanged
+ const input2 = screen.getByTestId("plugin-1-param-key2");
+ expect(input2).toHaveValue("val2");
+
+ // First plugin should have new value
+ expect(input1).toHaveValue("new-val1");
+ });
+ });
+});
diff --git a/frontend/__tests__/hooks/mutation/use-create-conversation.test.tsx b/frontend/__tests__/hooks/mutation/use-create-conversation.test.tsx
index ba1a2ee498..6f56ce7f9d 100644
--- a/frontend/__tests__/hooks/mutation/use-create-conversation.test.tsx
+++ b/frontend/__tests__/hooks/mutation/use-create-conversation.test.tsx
@@ -98,6 +98,7 @@ describe("useCreateConversation", () => {
undefined,
undefined,
undefined,
+ undefined, // plugins
);
});
});
diff --git a/frontend/__tests__/hooks/mutation/use-new-conversation-command.test.tsx b/frontend/__tests__/hooks/mutation/use-new-conversation-command.test.tsx
index 07f110ff17..d4f81d4b0e 100644
--- a/frontend/__tests__/hooks/mutation/use-new-conversation-command.test.tsx
+++ b/frontend/__tests__/hooks/mutation/use-new-conversation-command.test.tsx
@@ -151,6 +151,7 @@ describe("useNewConversationCommand", () => {
undefined,
undefined,
undefined,
+ undefined, // plugins
"sandbox-456",
"gpt-4o",
);
@@ -268,6 +269,7 @@ describe("useNewConversationCommand", () => {
undefined, // trigger
undefined, // parent_conversation_id is NOT set
undefined, // agent_type
+ undefined, // plugins
"sandbox-456", // sandbox_id IS set to reuse the sandbox
"gpt-4o", // llm_model IS inherited from the original conversation
);
diff --git a/frontend/__tests__/routes/launch.test.tsx b/frontend/__tests__/routes/launch.test.tsx
new file mode 100644
index 0000000000..3f2ad57dfd
--- /dev/null
+++ b/frontend/__tests__/routes/launch.test.tsx
@@ -0,0 +1,576 @@
+import { render, screen, waitFor } from "@testing-library/react";
+import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
+import userEvent from "@testing-library/user-event";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { MemoryRouter, Routes, Route } from "react-router";
+import LaunchRoute from "#/routes/launch";
+
+// Mock the hooks
+const mockMutateAsync = vi.fn();
+const mockNavigate = vi.fn();
+
+vi.mock("#/hooks/mutation/use-create-conversation", () => ({
+ useCreateConversation: () => ({
+ mutateAsync: mockMutateAsync,
+ isPending: false,
+ }),
+}));
+
+vi.mock("react-router", async () => {
+ const actual = await vi.importActual("react-router");
+ return {
+ ...actual,
+ useNavigate: () => mockNavigate,
+ };
+});
+
+vi.mock("#/hooks/query/use-is-authed", () => ({
+ useIsAuthed: () => ({ data: true }),
+}));
+
+vi.mock("#/hooks/query/use-config", () => ({
+ useConfig: () => ({ data: { APP_MODE: "saas" } }),
+}));
+
+function renderLaunchRoute(searchParams: string) {
+ const queryClient = new QueryClient({
+ defaultOptions: {
+ queries: { retry: false },
+ },
+ });
+
+ return render(
+ <QueryClientProvider client={queryClient}>
+ <MemoryRouter initialEntries={[`/launch${searchParams}`]}>
+ <Routes>
+ <Route path="/launch" element={<LaunchRoute />} />
+ </Routes>
+ </MemoryRouter>
+ </QueryClientProvider>,
+ );
+}
+
+describe("LaunchRoute", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ mockMutateAsync.mockResolvedValue({ conversation_id: "test-conv-123" });
+ });
+
+ afterEach(() => {
+ vi.resetAllMocks();
+ });
+
+ describe("Query Parameter Parsing", () => {
+ it("should parse valid base64 encoded plugins", async () => {
+ // Single plugin with parameters
+ const plugins = [
+ {
+ source: "github:owner/repo",
+ ref: "main",
+ parameters: { apiKey: "test-key", maxRetries: 3 },
+ },
+ ];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ expect(screen.getByTestId("plugin-launch-modal")).toBeInTheDocument();
+ expect(screen.getByText("owner/repo")).toBeInTheDocument();
+ });
+
+ it("should parse multiple plugins from base64", async () => {
+ const plugins = [
+ { source: "github:owner/repo1", parameters: { key: "value1" } },
+ { source: "github:owner/repo2" },
+ ];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ expect(screen.getByTestId("plugin-launch-modal")).toBeInTheDocument();
+ // Plugin names appear multiple times, use getAllByText
+ expect(screen.getAllByText("owner/repo1").length).toBeGreaterThan(0);
+ expect(screen.getAllByText("owner/repo2").length).toBeGreaterThan(0);
+ });
+
+ it("should show error for invalid base64 encoding", () => {
+ renderLaunchRoute("?plugins=not-valid-base64!!!");
+
+ expect(screen.getByTestId("launch-error")).toBeInTheDocument();
+ expect(screen.getByText("LAUNCH$ERROR_INVALID_FORMAT")).toBeInTheDocument();
+ });
+
+ it("should show error for invalid JSON in decoded base64", () => {
+ const invalidJson = btoa("not valid json");
+
+ renderLaunchRoute(`?plugins=${invalidJson}`);
+
+ expect(screen.getByTestId("launch-error")).toBeInTheDocument();
+ expect(screen.getByText("LAUNCH$ERROR_INVALID_FORMAT")).toBeInTheDocument();
+ });
+
+ it("should show error when decoded plugins is not an array", () => {
+ const notArray = btoa(JSON.stringify({ source: "github:owner/repo" }));
+
+ renderLaunchRoute(`?plugins=${notArray}`);
+
+ expect(screen.getByTestId("launch-error")).toBeInTheDocument();
+ expect(screen.getByText("LAUNCH$ERROR_INVALID_FORMAT")).toBeInTheDocument();
+ });
+
+ it("should show error when plugin is missing source", () => {
+ const missingSource = btoa(JSON.stringify([{ ref: "main" }]));
+
+ renderLaunchRoute(`?plugins=${missingSource}`);
+
+ expect(screen.getByTestId("launch-error")).toBeInTheDocument();
+ expect(screen.getByText("LAUNCH$ERROR_INVALID_FORMAT")).toBeInTheDocument();
+ });
+
+ it("should parse simple params format (plugin_source)", () => {
+ renderLaunchRoute("?plugin_source=github:owner/simple-repo");
+
+ expect(screen.getByTestId("plugin-launch-modal")).toBeInTheDocument();
+ // Plugin name appears multiple times, use getAllByText
+ expect(screen.getAllByText("owner/simple-repo").length).toBeGreaterThan(0);
+ });
+
+ it("should parse simple params with ref", () => {
+ renderLaunchRoute(
+ "?plugin_source=github:owner/repo&plugin_ref=v1.0.0",
+ );
+
+ expect(screen.getByTestId("plugin-launch-modal")).toBeInTheDocument();
+ // Plugin name appears multiple times, use getAllByText
+ expect(screen.getAllByText("owner/repo").length).toBeGreaterThan(0);
+ });
+
+ it("should show error when no plugins specified", () => {
+ renderLaunchRoute("");
+
+ expect(screen.getByTestId("launch-error")).toBeInTheDocument();
+ expect(screen.getByText("LAUNCH$ERROR_NO_PLUGINS")).toBeInTheDocument();
+ });
+ });
+
+ describe("Message Sanitization", () => {
+ it("should display sanitized message", () => {
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+ const message = "Hello, this is a safe message";
+
+ renderLaunchRoute(`?plugins=${encoded}&message=${encodeURIComponent(message)}`);
+
+ expect(screen.getByText("Hello, this is a safe message")).toBeInTheDocument();
+ });
+
+ it("should remove script tags from message (XSS prevention)", () => {
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+ const maliciousMessage = '<script>alert("xss")</script>Safe text';
+
+ renderLaunchRoute(
+ `?plugins=${encoded}&message=${encodeURIComponent(maliciousMessage)}`,
+ );
+
+ // Script tags should be stripped (text content preserved but safe as plain text)
+ expect(screen.queryByText(/<script>/)).not.toBeInTheDocument();
+ // The text content remains but is rendered as plain text, not executed
+ expect(screen.getByText('alert("xss")Safe text')).toBeInTheDocument();
+ });
+
+ it("should strip img tags with onerror handlers (XSS prevention)", () => {
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+ const maliciousMessage = '<img src=x onerror=alert(1)>Safe content';
+
+ renderLaunchRoute(
+ `?plugins=${encoded}&message=${encodeURIComponent(maliciousMessage)}`,
+ );
+
+ // All HTML should be stripped, leaving only safe text
+ expect(screen.queryByText(/<img/)).not.toBeInTheDocument();
+ expect(screen.queryByText(/onerror/)).not.toBeInTheDocument();
+ expect(screen.getByText("Safe content")).toBeInTheDocument();
+ });
+
+ it("should strip svg tags with onload handlers (XSS prevention)", () => {
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+ const maliciousMessage = '<svg/onload=alert(1)>Safe content';
+
+ renderLaunchRoute(
+ `?plugins=${encoded}&message=${encodeURIComponent(maliciousMessage)}`,
+ );
+
+ // All HTML should be stripped
+ expect(screen.queryByText(/<svg/)).not.toBeInTheDocument();
+ expect(screen.queryByText(/onload/)).not.toBeInTheDocument();
+ expect(screen.getByText("Safe content")).toBeInTheDocument();
+ });
+
+ it("should strip all HTML tags for plain text display", () => {
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+ const htmlMessage = '<div><p>Hello</p> <b>World</b></div>';
+
+ renderLaunchRoute(
+ `?plugins=${encoded}&message=${encodeURIComponent(htmlMessage)}`,
+ );
+
+ // HTML tags should be stripped, text preserved
+ expect(screen.getByText("Hello World")).toBeInTheDocument();
+ });
+
+ it("should truncate long messages", () => {
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+ const longMessage = "A".repeat(600);
+
+ renderLaunchRoute(`?plugins=${encoded}&message=${encodeURIComponent(longMessage)}`);
+
+ // Should be truncated to 500 chars
+ const displayedMessage = screen.getByText(/A{100,}/);
+ expect(displayedMessage.textContent?.length).toBeLessThanOrEqual(500);
+ });
+ });
+
+ describe("Plugin Parameter Forms", () => {
+ it("should render text input for string parameters", async () => {
+ const plugins = [
+ {
+ source: "github:owner/repo",
+ parameters: { apiKey: "initial-value" },
+ },
+ ];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ const input = screen.getByTestId("plugin-0-param-apiKey");
+ expect(input).toHaveAttribute("type", "text");
+ expect(input).toHaveValue("initial-value");
+ });
+
+ it("should render number input for number parameters", () => {
+ const plugins = [
+ {
+ source: "github:owner/repo",
+ parameters: { maxRetries: 5 },
+ },
+ ];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ const input = screen.getByTestId("plugin-0-param-maxRetries");
+ expect(input).toHaveAttribute("type", "number");
+ expect(input).toHaveValue(5);
+ });
+
+ it("should render checkbox for boolean parameters", () => {
+ const plugins = [
+ {
+ source: "github:owner/repo",
+ parameters: { debugMode: true },
+ },
+ ];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ const checkbox = screen.getByTestId("plugin-0-param-debugMode");
+ expect(checkbox).toHaveAttribute("type", "checkbox");
+ expect(checkbox).toBeChecked();
+ });
+
+ it("should allow editing text parameter values", async () => {
+ const user = userEvent.setup();
+ const plugins = [
+ {
+ source: "github:owner/repo",
+ parameters: { apiKey: "old-value" },
+ },
+ ];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ const input = screen.getByTestId("plugin-0-param-apiKey");
+ await user.clear(input);
+ await user.type(input, "new-value");
+
+ expect(input).toHaveValue("new-value");
+ });
+ });
+
+ describe("Modal UI", () => {
+ it("should display start conversation button", () => {
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ expect(screen.getByTestId("start-conversation-button")).toBeInTheDocument();
+ });
+
+ it("should display close button", () => {
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ expect(screen.getByTestId("close-button")).toBeInTheDocument();
+ });
+
+ it("should navigate home when close button clicked", async () => {
+ const user = userEvent.setup();
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ await user.click(screen.getByTestId("close-button"));
+
+ expect(mockNavigate).toHaveBeenCalledWith("/");
+ });
+
+ it("should show plugins section for plugins without parameters", () => {
+ const plugins = [
+ { source: "github:owner/repo-without-params" },
+ { source: "github:owner/another-repo" },
+ ];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ expect(screen.getByText("LAUNCH$PLUGINS")).toBeInTheDocument();
+ // Plugin names appear multiple times (title area and list), use getAllByText
+ expect(screen.getAllByText("owner/repo-without-params").length).toBeGreaterThan(0);
+ expect(screen.getAllByText("owner/another-repo").length).toBeGreaterThan(0);
+ });
+
+ it("should show additional plugins label when mixing params and no-params plugins", () => {
+ const plugins = [
+ { source: "github:owner/with-params", parameters: { key: "value" } },
+ { source: "github:owner/without-params" },
+ ];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ expect(screen.getByText("LAUNCH$ADDITIONAL_PLUGINS")).toBeInTheDocument();
+ });
+ });
+
+ describe("Trust Checkbox", () => {
+ it("should display trust checkbox unchecked by default", () => {
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ const checkbox = screen.getByTestId("trust-checkbox");
+ expect(checkbox).toBeInTheDocument();
+ expect(checkbox).not.toBeChecked();
+ });
+
+ it("should display trust checkbox with associated label", () => {
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ // Check that the checkbox has a label associated with it
+ const checkbox = screen.getByTestId("trust-checkbox");
+ const label = document.querySelector('label[for="trust-checkbox"]');
+ expect(label).toBeInTheDocument();
+ });
+
+ it("should have trust checkbox label that references the translation key", () => {
+ const plugins = [
+ { source: "github:owner/repo1" },
+ { source: "github:owner/repo2" },
+ ];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ // In test environment, the translation key is shown
+ const label = document.querySelector('label[for="trust-checkbox"]');
+ expect(label).toBeInTheDocument();
+ expect(label?.textContent).toContain("LAUNCH$TRUST_SKILL_CHECKBOX");
+ });
+
+ it("should disable start button when trust checkbox is unchecked", () => {
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ const button = screen.getByTestId("start-conversation-button");
+ expect(button).toBeDisabled();
+ });
+
+ it("should enable start button when trust checkbox is checked", async () => {
+ const user = userEvent.setup();
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ const checkbox = screen.getByTestId("trust-checkbox");
+ await user.click(checkbox);
+
+ const button = screen.getByTestId("start-conversation-button");
+ expect(button).not.toBeDisabled();
+ });
+ });
+
+ describe("Conversation Creation", () => {
+ it("should call createConversation with plugins when start button clicked after checking trust", async () => {
+ const user = userEvent.setup();
+ const plugins = [
+ { source: "github:owner/repo", parameters: { apiKey: "test" } },
+ ];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ // First check the trust checkbox
+ await user.click(screen.getByTestId("trust-checkbox"));
+ await user.click(screen.getByTestId("start-conversation-button"));
+
+ await waitFor(() => {
+ expect(mockMutateAsync).toHaveBeenCalledWith({
+ plugins: [
+ {
+ source: "github:owner/repo",
+ ref: null,
+ repo_path: null,
+ parameters: { apiKey: "test" },
+ },
+ ],
+ query: undefined,
+ });
+ });
+ });
+
+ it("should call createConversation with plugins and initial message when message is provided", async () => {
+ const user = userEvent.setup();
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+ const message = "/city-weather:now Tokyo";
+
+ renderLaunchRoute(`?plugins=${encoded}&message=${encodeURIComponent(message)}`);
+
+ // First check the trust checkbox
+ await user.click(screen.getByTestId("trust-checkbox"));
+ await user.click(screen.getByTestId("start-conversation-button"));
+
+ await waitFor(() => {
+ expect(mockMutateAsync).toHaveBeenCalledWith({
+ plugins: [
+ {
+ source: "github:owner/repo",
+ ref: null,
+ repo_path: null,
+ parameters: null,
+ },
+ ],
+ query: "/city-weather:now Tokyo",
+ });
+ });
+ });
+
+ it("should navigate to conversation after successful creation", async () => {
+ const user = userEvent.setup();
+ mockMutateAsync.mockResolvedValue({ conversation_id: "new-conv-456" });
+
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ // First check the trust checkbox
+ await user.click(screen.getByTestId("trust-checkbox"));
+ await user.click(screen.getByTestId("start-conversation-button"));
+
+ await waitFor(() => {
+ expect(mockNavigate).toHaveBeenCalledWith("/conversations/new-conv-456");
+ });
+ });
+
+ it("should not call createConversation when trust checkbox is not checked", async () => {
+ const user = userEvent.setup();
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ // Try to click without checking trust (button should be disabled)
+ const button = screen.getByTestId("start-conversation-button");
+ expect(button).toBeDisabled();
+
+ // Even attempting to click shouldn't call the mutation
+ await user.click(button);
+
+ expect(mockMutateAsync).not.toHaveBeenCalled();
+ });
+ });
+
+ describe("Error Handling", () => {
+ it("should display go home button on error", () => {
+ renderLaunchRoute("");
+
+ expect(screen.getByTestId("go-home-button")).toBeInTheDocument();
+ });
+
+ it("should navigate home when go home button clicked", async () => {
+ const user = userEvent.setup();
+
+ renderLaunchRoute("");
+
+ await user.click(screen.getByTestId("go-home-button"));
+
+ expect(mockNavigate).toHaveBeenCalledWith("/");
+ });
+
+ it("should show creation failed error when API call fails", async () => {
+ const user = userEvent.setup();
+ mockMutateAsync.mockRejectedValue(new Error("API Error"));
+
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ // First check the trust checkbox
+ await user.click(screen.getByTestId("trust-checkbox"));
+ await user.click(screen.getByTestId("start-conversation-button"));
+
+ await waitFor(() => {
+ expect(screen.getByTestId("launch-error")).toBeInTheDocument();
+ expect(screen.getByText("LAUNCH$ERROR_CREATION_FAILED")).toBeInTheDocument();
+ });
+ });
+
+ it("should show try again button on creation failure", async () => {
+ const user = userEvent.setup();
+ mockMutateAsync.mockRejectedValue(new Error("API Error"));
+
+ const plugins = [{ source: "github:owner/repo" }];
+ const encoded = btoa(JSON.stringify(plugins));
+
+ renderLaunchRoute(`?plugins=${encoded}`);
+
+ // First check the trust checkbox
+ await user.click(screen.getByTestId("trust-checkbox"));
+ await user.click(screen.getByTestId("start-conversation-button"));
+
+ await waitFor(() => {
+ expect(screen.getByTestId("try-again-button")).toBeInTheDocument();
+ });
+ });
+ });
+});
diff --git a/frontend/src/api/conversation-service/v1-conversation-service.api.ts b/frontend/src/api/conversation-service/v1-conversation-service.api.ts
index bcdad50077..33268c526a 100644
--- a/frontend/src/api/conversation-service/v1-conversation-service.api.ts
+++ b/frontend/src/api/conversation-service/v1-conversation-service.api.ts
@@ -16,6 +16,7 @@ import type {
GetSkillsResponse,
GetHooksResponse,
V1RuntimeConversationInfo,
+ PluginSpec,
} from "./v1-conversation-service.types";
class V1ConversationService {
@@ -68,6 +69,7 @@ class V1ConversationService {
trigger?: ConversationTrigger,
parent_conversation_id?: string,
agent_type?: "default" | "plan",
+ plugins?: PluginSpec[],
sandbox_id?: string,
llm_model?: string,
): Promise<V1AppConversationStartTask> {
@@ -80,6 +82,7 @@ class V1ConversationService {
trigger,
parent_conversation_id: parent_conversation_id || null,
agent_type,
+ plugins: plugins || null,
sandbox_id: sandbox_id || null,
llm_model: llm_model || null,
};
diff --git a/frontend/src/api/conversation-service/v1-conversation-service.types.ts b/frontend/src/api/conversation-service/v1-conversation-service.types.ts
index 50e904d553..7793ad41ef 100644
--- a/frontend/src/api/conversation-service/v1-conversation-service.types.ts
+++ b/frontend/src/api/conversation-service/v1-conversation-service.types.ts
@@ -3,6 +3,14 @@ import { V1SandboxStatus } from "../sandbox-service/sandbox-service.types";
import { Provider } from "#/types/settings";
import { SuggestedTask } from "#/utils/types";
+// Plugin specification for starting conversations with plugins
+export interface PluginSpec {
+ source: string; // Plugin source: 'github:owner/repo', git URL, or local path
+ ref?: string | null; // Optional branch, tag, or commit
+ repo_path?: string | null; // Subdirectory path within the git repository
+ parameters?: Record<string, unknown> | null; // User-provided configuration values
+}
+
// V1 Metrics Types
export interface V1TokenUsage {
prompt_tokens: number;
@@ -54,6 +62,7 @@ export interface V1AppConversationStartRequest {
pr_number?: number[];
parent_conversation_id?: string | null;
agent_type?: "default" | "plan";
+ plugins?: PluginSpec[] | null; // Plugins to load when starting the conversation
}
export type V1AppConversationStartTaskStatus =
diff --git a/frontend/src/components/features/launch/plugin-launch-modal.tsx b/frontend/src/components/features/launch/plugin-launch-modal.tsx
new file mode 100644
index 0000000000..80b1c889cc
--- /dev/null
+++ b/frontend/src/components/features/launch/plugin-launch-modal.tsx
@@ -0,0 +1,232 @@
+import React from "react";
+import { useTranslation } from "react-i18next";
+import { IoClose } from "react-icons/io5";
+import { ModalBackdrop } from "#/components/shared/modals/modal-backdrop";
+import { BrandButton } from "#/components/features/settings/brand-button";
+import { I18nKey } from "#/i18n/declaration";
+import { PluginSpec } from "#/api/conversation-service/v1-conversation-service.types";
+import { Typography } from "#/ui/typography";
+import { cn } from "#/utils/utils";
+import { PluginLaunchPluginSection } from "./plugin-launch-plugin-section";
+
+interface PluginLaunchModalProps {
+ plugins: PluginSpec[];
+ message?: string;
+ isLoading?: boolean;
+ onStartConversation: (plugins: PluginSpec[], initialMessage?: string) => void;
+ onClose: () => void;
+}
+
+interface ExpandedState {
+ [key: number]: boolean;
+}
+
+export function PluginLaunchModal({
+ plugins,
+ message,
+ isLoading = false,
+ onStartConversation,
+ onClose,
+}: PluginLaunchModalProps) {
+ const { t } = useTranslation();
+ const [pluginConfigs, setPluginConfigs] =
+ React.useState<PluginSpec[]>(plugins);
+ const [expandedSections, setExpandedSections] = React.useState<ExpandedState>(
+ () => {
+ // Initially expand plugins that have parameters
+ const initial: ExpandedState = {};
+ plugins.forEach((plugin, index) => {
+ if (plugin.parameters && Object.keys(plugin.parameters).length > 0) {
+ initial[index] = true;
+ }
+ });
+ return initial;
+ },
+ );
+ const [trustConfirmed, setTrustConfirmed] = React.useState(false);
+
+ const pluginsWithParams = pluginConfigs.filter(
+ (p) => p.parameters && Object.keys(p.parameters).length > 0,
+ );
+ const pluginsWithoutParams = pluginConfigs.filter(
+ (p) => !p.parameters || Object.keys(p.parameters).length === 0,
+ );
+
+ const toggleSection = (index: number) => {
+ setExpandedSections((prev) => ({
+ ...prev,
+ [index]: !prev[index],
+ }));
+ };
+
+ const updateParameter = (
+ pluginIndex: number,
+ paramKey: string,
+ value: unknown,
+ ) => {
+ setPluginConfigs((prev) => {
+ const updated = [...prev];
+ const plugin = { ...updated[pluginIndex] };
+ plugin.parameters = {
+ ...plugin.parameters,
+ [paramKey]: value,
+ };
+ updated[pluginIndex] = plugin;
+ return updated;
+ });
+ };
+
+ const getPluginDisplayName = (plugin: PluginSpec): string => {
+ const { source, repo_path: repoPath } = plugin;
+
+ // If repo_path is specified, show the plugin name from the path
+ if (repoPath) {
+ const pathParts = repoPath.split("/");
+ const pluginName = pathParts[pathParts.length - 1];
+ return pluginName;
+ }
+
+ // Otherwise show the repo name
+ if (source.startsWith("github:")) {
+ return source.replace("github:", "");
+ }
+ if (source.includes("/")) {
+ const parts = source.split("/");
+ return parts[parts.length - 1].replace(".git", "");
+ }
+ return source;
+ };
+
+ const getPluginSourceInfo = (plugin: PluginSpec): string => {
+ const { source } = plugin;
+ if (source.startsWith("github:")) {
+ return source.replace("github:", "");
+ }
+ if (source.includes("github.com/")) {
+ return source.split("github.com/")[1]?.replace(".git", "") || source;
+ }
+ return source;
+ };
+
+ const getUniqueSources = (): string[] => {
+ const sources = pluginConfigs.map((plugin) => getPluginSourceInfo(plugin));
+ return [...new Set(sources)];
+ };
+
+ const handleStartConversation = () => {
+ onStartConversation(pluginConfigs, message);
+ };
+
+ const modalTitle =
+ pluginConfigs.length === 1
+ ? getPluginDisplayName(pluginConfigs[0])
+ : t(I18nKey.LAUNCH$MODAL_TITLE_GENERIC);
+
+ return (
+ <ModalBackdrop onClose={onClose}>
+ <div
+ data-testid="plugin-launch-modal"
+ className="bg-base-secondary p-6 rounded-xl flex flex-col gap-4 border border-tertiary w-[500px] max-w-[90vw] max-h-[80vh]"
+ >
+ <div className="flex w-full items-center justify-between">
+ <Typography.H2>
+ {t(I18nKey.LAUNCH$MODAL_TITLE)} {modalTitle}
+ </Typography.H2>
+ <button
+ type="button"
+ onClick={onClose}
+ className="rounded-md p-1 text-white hover:bg-tertiary cursor-pointer"
+ aria-label="Close"
+ data-testid="close-button"
+ >
+ <IoClose className="h-5 w-5" />
+ </button>
+ </div>
+
+ {message && <p className="text-sm text-white">{message}</p>}
+
+ <div className="flex-1 overflow-y-auto custom-scrollbar">
+ {pluginsWithParams.length > 0 && (
+ <div className="space-y-3">
+ {pluginConfigs.map((plugin, index) => (
+ <PluginLaunchPluginSection
+ key={`plugin-${index}`}
+ plugin={plugin}
+ originalIndex={index}
+ isExpanded={!!expandedSections[index]}
+ onToggle={() => toggleSection(index)}
+ getPluginDisplayName={getPluginDisplayName}
+ onParameterChange={updateParameter}
+ />
+ ))}
+ </div>
+ )}
+
+ {pluginsWithoutParams.length > 0 && (
+ <div className={cn(pluginsWithParams.length > 0 && "mt-4")}>
+ <Typography.H3 className="mb-2 text-white">
+ {pluginsWithParams.length > 0
+ ? t(I18nKey.LAUNCH$ADDITIONAL_PLUGINS)
+ : t(I18nKey.LAUNCH$PLUGINS)}
+ </Typography.H3>
+ <div className="space-y-2">
+ {pluginsWithoutParams.map((plugin, index) => (
+ <div
+ key={`simple-plugin-${index}`}
+ className="rounded-md bg-tertiary px-3 py-2 text-sm"
+ >
+ <div className="font-medium">
+ {getPluginDisplayName(plugin)}
+ </div>
+ <div className="text-xs text-white mt-1">
+ {getPluginSourceInfo(plugin)}
+ {plugin.repo_path && (
+ <span className="ml-1">/ {plugin.repo_path}</span>
+ )}
+ {plugin.ref && (
+ <span className="ml-2">@ {plugin.ref}</span>
+ )}
+ </div>
+ </div>
+ ))}
+ </div>
+ </div>
+ )}
+ </div>
+
+ <div className="pt-4 border-t border-tertiary">
+ <div className="flex items-start gap-3 mb-4">
+ <input
+ id="trust-checkbox"
+ data-testid="trust-checkbox"
+ type="checkbox"
+ checked={trustConfirmed}
+ onChange={(e) => setTrustConfirmed(e.target.checked)}
+ className="mt-1 h-4 w-4 flex-shrink-0"
+ />
+ <label htmlFor="trust-checkbox" className="text-sm text-white">
+ {t(I18nKey.LAUNCH$TRUST_SKILL_CHECKBOX, {
+ sources: getUniqueSources().join(", "),
+ interpolation: { escapeValue: false },
+ })}
+ </label>
+ </div>
+ <div className="flex w-full justify-end mt-8">
+ <BrandButton
+ testId="start-conversation-button"
+ type="button"
+ variant="primary"
+ onClick={handleStartConversation}
+ isDisabled={isLoading || !trustConfirmed}
+ className="px-4"
+ >
+ {isLoading
+ ? t(I18nKey.LAUNCH$STARTING)
+ : t(I18nKey.LAUNCH$START_CONVERSATION)}
+ </BrandButton>
+ </div>
+ </div>
+ </div>
+ </ModalBackdrop>
+ );
+}
diff --git a/frontend/src/components/features/launch/plugin-launch-parameter-input.tsx b/frontend/src/components/features/launch/plugin-launch-parameter-input.tsx
new file mode 100644
index 0000000000..868a4a1135
--- /dev/null
+++ b/frontend/src/components/features/launch/plugin-launch-parameter-input.tsx
@@ -0,0 +1,74 @@
+import { SettingsInput } from "#/components/features/settings/settings-input";
+
+export interface PluginLaunchParameterInputProps {
+ pluginIndex: number;
+ paramKey: string;
+ paramValue: unknown;
+ onParameterChange: (
+ pluginIndex: number,
+ paramKey: string,
+ value: unknown,
+ ) => void;
+}
+
+export function PluginLaunchParameterInput({
+ pluginIndex,
+ paramKey,
+ paramValue,
+ onParameterChange,
+}: PluginLaunchParameterInputProps) {
+ const inputId = `plugin-${pluginIndex}-param-${paramKey}`;
+
+ if (typeof paramValue === "boolean") {
+ return (
+ <label
+ htmlFor={inputId}
+ className="flex w-full cursor-pointer items-center gap-2.5"
+ >
+ <input
+ id={inputId}
+ data-testid={inputId}
+ type="checkbox"
+ checked={paramValue}
+ onChange={(e) =>
+ onParameterChange(pluginIndex, paramKey, e.target.checked)
+ }
+ className="h-4 w-4 shrink-0 rounded"
+ />
+ <span className="text-sm">{paramKey}</span>
+ </label>
+ );
+ }
+
+ if (typeof paramValue === "number") {
+ return (
+ <SettingsInput
+ testId={inputId}
+ name={`plugin-${pluginIndex}-param-${paramKey}`}
+ type="number"
+ label={paramKey}
+ value={String(paramValue)}
+ className="w-full"
+ onChange={(value) =>
+ onParameterChange(
+ pluginIndex,
+ paramKey,
+ value === "" ? 0 : parseFloat(value) || 0,
+ )
+ }
+ />
+ );
+ }
+
+ return (
+ <SettingsInput
+ testId={inputId}
+ name={`plugin-${pluginIndex}-param-${paramKey}`}
+ type="text"
+ label={paramKey}
+ value={String(paramValue ?? "")}
+ className="w-full"
+ onChange={(value) => onParameterChange(pluginIndex, paramKey, value)}
+ />
+ );
+}
diff --git a/frontend/src/components/features/launch/plugin-launch-plugin-section.tsx b/frontend/src/components/features/launch/plugin-launch-plugin-section.tsx
new file mode 100644
index 0000000000..b0b83d67f6
--- /dev/null
+++ b/frontend/src/components/features/launch/plugin-launch-plugin-section.tsx
@@ -0,0 +1,82 @@
+import { useTranslation } from "react-i18next";
+import { IoChevronDown, IoChevronForward } from "react-icons/io5";
+import { I18nKey } from "#/i18n/declaration";
+import { PluginSpec } from "#/api/conversation-service/v1-conversation-service.types";
+import { Typography } from "#/ui/typography";
+import { PluginLaunchParameterInput } from "./plugin-launch-parameter-input";
+
+export interface PluginLaunchPluginSectionProps {
+ plugin: PluginSpec;
+ originalIndex: number;
+ isExpanded: boolean;
+ onToggle: () => void;
+ getPluginDisplayName: (plugin: PluginSpec) => string;
+ onParameterChange: (
+ pluginIndex: number,
+ paramKey: string,
+ value: unknown,
+ ) => void;
+}
+
+export function PluginLaunchPluginSection({
+ plugin,
+ originalIndex,
+ isExpanded,
+ onToggle,
+ getPluginDisplayName,
+ onParameterChange,
+}: PluginLaunchPluginSectionProps) {
+ const { t } = useTranslation();
+ const hasParams =
+ plugin.parameters && Object.keys(plugin.parameters).length > 0;
+
+ if (!hasParams) {
+ return null;
+ }
+
+ return (
+ <div className="rounded-lg border border-tertiary bg-tertiary">
+ <button
+ type="button"
+ onClick={onToggle}
+ className="flex w-full items-center justify-between px-4 py-3 text-left hover:bg-base-tertiary rounded-t-lg cursor-pointer"
+ data-testid={`plugin-section-${originalIndex}`}
+ >
+ <Typography.Text className="text-base font-medium">
+ {getPluginDisplayName(plugin)}
+ </Typography.Text>
+ {isExpanded ? (
+ <IoChevronDown className="h-5 w-5 text-white" />
+ ) : (
+ <IoChevronForward className="h-5 w-5 text-white" />
+ )}
+ </button>
+
+ {isExpanded && (
+ <div className="border-t border-tertiary px-4 pb-3">
+ {plugin.ref && (
+ <div className="mb-2 text-sm text-white">
+ {t(I18nKey.LAUNCH$PLUGIN_REF)} {plugin.ref}
+ </div>
+ )}
+ {plugin.repo_path && (
+ <div className="mb-2 text-sm text-white">
+ {t(I18nKey.LAUNCH$PLUGIN_PATH)} {plugin.repo_path}
+ </div>
+ )}
+ <div className="flex flex-col gap-4">
+ {Object.entries(plugin.parameters || {}).map(([key, value]) => (
+ <PluginLaunchParameterInput
+ key={key}
+ pluginIndex={originalIndex}
+ paramKey={key}
+ paramValue={value}
+ onParameterChange={onParameterChange}
+ />
+ ))}
+ </div>
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/frontend/src/hooks/mutation/use-create-conversation.ts b/frontend/src/hooks/mutation/use-create-conversation.ts
index db5a700d8d..f0ceab359a 100644
--- a/frontend/src/hooks/mutation/use-create-conversation.ts
+++ b/frontend/src/hooks/mutation/use-create-conversation.ts
@@ -1,6 +1,7 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
import ConversationService from "#/api/conversation-service/conversation-service.api";
import V1ConversationService from "#/api/conversation-service/v1-conversation-service.api";
+import { PluginSpec } from "#/api/conversation-service/v1-conversation-service.types";
import { SuggestedTask } from "#/utils/types";
import { Provider } from "#/types/settings";
import { CreateMicroagent, Conversation } from "#/api/open-hands.types";
@@ -19,6 +20,7 @@ interface CreateConversationVariables {
createMicroagent?: CreateMicroagent;
parentConversationId?: string;
agentType?: "default" | "plan";
+ plugins?: PluginSpec[];
}
// Response type that combines both V1 and legacy responses
@@ -49,6 +51,7 @@ export const useCreateConversation = () => {
createMicroagent,
parentConversationId,
agentType,
+ plugins,
} = variables;
const useV1 = !!settings?.v1_enabled && !createMicroagent;
@@ -65,6 +68,7 @@ export const useCreateConversation = () => {
undefined, // trigger - set by backend when applicable
parentConversationId,
agentType,
+ plugins,
);
// Return a special task ID that the frontend will recognize
diff --git a/frontend/src/hooks/mutation/use-new-conversation-command.ts b/frontend/src/hooks/mutation/use-new-conversation-command.ts
index 51e1046ac1..de2adf74e0 100644
--- a/frontend/src/hooks/mutation/use-new-conversation-command.ts
+++ b/frontend/src/hooks/mutation/use-new-conversation-command.ts
@@ -44,6 +44,7 @@ export const useNewConversationCommand = () => {
undefined, // trigger
undefined, // parent_conversation_id
undefined, // agent_type
+ undefined, // plugins
conversation.sandbox_id ?? undefined, // sandbox_id - reuse the same sandbox
llmModel ?? undefined, // llm_model - preserve the LLM model
);
diff --git a/frontend/src/i18n/declaration.ts b/frontend/src/i18n/declaration.ts
index 9b355ae432..8fc4df82d8 100644
--- a/frontend/src/i18n/declaration.ts
+++ b/frontend/src/i18n/declaration.ts
@@ -1084,6 +1084,22 @@ export enum I18nKey {
CONVERSATION$NO_HISTORY_AVAILABLE = "CONVERSATION$NO_HISTORY_AVAILABLE",
CONVERSATION$SHARED_CONVERSATION = "CONVERSATION$SHARED_CONVERSATION",
CONVERSATION$LINK_COPIED = "CONVERSATION$LINK_COPIED",
+ LAUNCH$MODAL_TITLE = "LAUNCH$MODAL_TITLE",
+ LAUNCH$MODAL_TITLE_GENERIC = "LAUNCH$MODAL_TITLE_GENERIC",
+ LAUNCH$ADDITIONAL_PLUGINS = "LAUNCH$ADDITIONAL_PLUGINS",
+ LAUNCH$PLUGINS = "LAUNCH$PLUGINS",
+ LAUNCH$START_CONVERSATION = "LAUNCH$START_CONVERSATION",
+ LAUNCH$STARTING = "LAUNCH$STARTING",
+ LAUNCH$ERROR_TITLE = "LAUNCH$ERROR_TITLE",
+ LAUNCH$ERROR_NO_PLUGINS = "LAUNCH$ERROR_NO_PLUGINS",
+ LAUNCH$ERROR_INVALID_FORMAT = "LAUNCH$ERROR_INVALID_FORMAT",
+ LAUNCH$ERROR_CREATION_FAILED = "LAUNCH$ERROR_CREATION_FAILED",
+ LAUNCH$ERROR_CREATION_UNKNOWN = "LAUNCH$ERROR_CREATION_UNKNOWN",
+ LAUNCH$GO_HOME = "LAUNCH$GO_HOME",
+ LAUNCH$TRY_AGAIN = "LAUNCH$TRY_AGAIN",
+ LAUNCH$PLUGIN_REF = "LAUNCH$PLUGIN_REF",
+ LAUNCH$PLUGIN_PATH = "LAUNCH$PLUGIN_PATH",
+ LAUNCH$TRUST_SKILL_CHECKBOX = "LAUNCH$TRUST_SKILL_CHECKBOX",
ONBOARDING$STEP1_TITLE = "ONBOARDING$STEP1_TITLE",
ONBOARDING$STEP1_SUBTITLE = "ONBOARDING$STEP1_SUBTITLE",
ONBOARDING$SOFTWARE_ENGINEER = "ONBOARDING$SOFTWARE_ENGINEER",
diff --git a/frontend/src/i18n/translation.json b/frontend/src/i18n/translation.json
index 57b89cd193..fc2874d6fe 100644
--- a/frontend/src/i18n/translation.json
+++ b/frontend/src/i18n/translation.json
@@ -18428,6 +18428,278 @@
"uk": "Посилання скопійовано в буфер обміну",
"ca": "Enllaç copiat al porta-retalls"
},
+ "LAUNCH$MODAL_TITLE": {
+ "en": "Launch",
+ "ja": "起動",
+ "zh-CN": "启动",
+ "zh-TW": "啟動",
+ "ko-KR": "실행",
+ "no": "Start",
+ "it": "Avvia",
+ "pt": "Iniciar",
+ "es": "Iniciar",
+ "ar": "إطلاق",
+ "fr": "Lancer",
+ "tr": "Başlat",
+ "de": "Starten",
+ "uk": "Запустити",
+ "ca": "Inicia"
+ },
+ "LAUNCH$MODAL_TITLE_GENERIC": {
+ "en": "Launch Plugin",
+ "ja": "プラグインを起動",
+ "zh-CN": "启动插件",
+ "zh-TW": "啟動外掛",
+ "ko-KR": "플러그인 실행",
+ "no": "Start plugin",
+ "it": "Avvia plugin",
+ "pt": "Iniciar plugin",
+ "es": "Iniciar plugin",
+ "ar": "إطلاق المكون الإضافي",
+ "fr": "Lancer le plugin",
+ "tr": "Eklentiyi başlat",
+ "de": "Plugin starten",
+ "uk": "Запустити плагін",
+ "ca": "Inicia el connector"
+ },
+ "LAUNCH$ADDITIONAL_PLUGINS": {
+ "en": "Additional Plugins",
+ "ja": "追加プラグイン",
+ "zh-CN": "其他插件",
+ "zh-TW": "其他外掛",
+ "ko-KR": "추가 플러그인",
+ "no": "Ekstra plugins",
+ "it": "Plugin aggiuntivi",
+ "pt": "Plugins adicionais",
+ "es": "Plugins adicionales",
+ "ar": "مكونات إضافية أخرى",
+ "fr": "Plugins supplémentaires",
+ "tr": "Ek eklentiler",
+ "de": "Zusätzliche Plugins",
+ "uk": "Додаткові плагіни",
+ "ca": "Connectors addicionals"
+ },
+ "LAUNCH$PLUGINS": {
+ "en": "Plugins",
+ "ja": "プラグイン",
+ "zh-CN": "插件",
+ "zh-TW": "外掛",
+ "ko-KR": "플러그인",
+ "no": "Plugins",
+ "it": "Plugin",
+ "pt": "Plugins",
+ "es": "Plugins",
+ "ar": "المكونات الإضافية",
+ "fr": "Plugins",
+ "tr": "Eklentiler",
+ "de": "Plugins",
+ "uk": "Плагіни",
+ "ca": "Connectors"
+ },
+ "LAUNCH$START_CONVERSATION": {
+ "en": "Start Conversation",
+ "ja": "会話を開始",
+ "zh-CN": "开始对话",
+ "zh-TW": "開始對話",
+ "ko-KR": "대화 시작",
+ "no": "Start samtale",
+ "it": "Inizia conversazione",
+ "pt": "Iniciar conversa",
+ "es": "Iniciar conversación",
+ "ar": "بدء المحادثة",
+ "fr": "Démarrer la conversation",
+ "tr": "Konuşmayı başlat",
+ "de": "Unterhaltung starten",
+ "uk": "Почати розмову",
+ "ca": "Inicia la conversa"
+ },
+ "LAUNCH$STARTING": {
+ "en": "Starting...",
+ "ja": "開始中...",
+ "zh-CN": "启动中...",
+ "zh-TW": "啟動中...",
+ "ko-KR": "시작 중...",
+ "no": "Starter...",
+ "it": "Avvio in corso...",
+ "pt": "Iniciando...",
+ "es": "Iniciando...",
+ "ar": "جاري البدء...",
+ "fr": "Démarrage...",
+ "tr": "Başlatılıyor...",
+ "de": "Wird gestartet...",
+ "uk": "Запуск...",
+ "ca": "Iniciant..."
+ },
+ "LAUNCH$ERROR_TITLE": {
+ "en": "Unable to Launch",
+ "ja": "起動できません",
+ "zh-CN": "无法启动",
+ "zh-TW": "無法啟動",
+ "ko-KR": "실행할 수 없음",
+ "no": "Kan ikke starte",
+ "it": "Impossibile avviare",
+ "pt": "Não foi possível iniciar",
+ "es": "No se puede iniciar",
+ "ar": "تعذر الإطلاق",
+ "fr": "Impossible de lancer",
+ "tr": "Başlatılamıyor",
+ "de": "Start nicht möglich",
+ "uk": "Не вдалося запустити",
+ "ca": "No s'ha pogut iniciar"
+ },
+ "LAUNCH$ERROR_NO_PLUGINS": {
+ "en": "No plugins were specified. Please provide at least one plugin to launch.",
+ "ja": "プラグインが指定されていません。少なくとも1つのプラグインを指定してください。",
+ "zh-CN": "未指定插件。请至少提供一个插件来启动。",
+ "zh-TW": "未指定外掛。請至少提供一個外掛來啟動。",
+ "ko-KR": "지정된 플러그인이 없습니다. 실행하려면 최소 하나의 플러그인을 제공하세요.",
+ "no": "Ingen plugins er spesifisert. Vennligst oppgi minst én plugin for å starte.",
+ "it": "Nessun plugin specificato. Fornisci almeno un plugin per avviare.",
+ "pt": "Nenhum plugin especificado. Forneça pelo menos um plugin para iniciar.",
+ "es": "No se especificaron plugins. Proporcione al menos un plugin para iniciar.",
+ "ar": "لم يتم تحديد أي مكونات إضافية. يرجى توفير مكون إضافي واحد على الأقل للإطلاق.",
+ "fr": "Aucun plugin spécifié. Veuillez fournir au moins un plugin pour lancer.",
+ "tr": "Hiçbir eklenti belirtilmedi. Başlatmak için en az bir eklenti sağlayın.",
+ "de": "Keine Plugins angegeben. Bitte geben Sie mindestens ein Plugin zum Starten an.",
+ "uk": "Плагіни не вказано. Будь ласка, вкажіть принаймні один плагін для запуску.",
+ "ca": "No s'han especificat connectors. Proporcioneu almenys un connector per iniciar."
+ },
+ "LAUNCH$ERROR_INVALID_FORMAT": {
+ "en": "The plugin configuration is invalid. Please check the URL and try again.",
+ "ja": "プラグイン設定が無効です。URLを確認して再試行してください。",
+ "zh-CN": "插件配置无效。请检查URL并重试。",
+ "zh-TW": "外掛配置無效。請檢查URL並重試。",
+ "ko-KR": "플러그인 구성이 잘못되었습니다. URL을 확인하고 다시 시도하세요.",
+ "no": "Plugin-konfigurasjonen er ugyldig. Sjekk URL-en og prøv igjen.",
+ "it": "La configurazione del plugin non è valida. Controlla l'URL e riprova.",
+ "pt": "A configuração do plugin é inválida. Verifique a URL e tente novamente.",
+ "es": "La configuración del plugin no es válida. Verifique la URL e intente nuevamente.",
+ "ar": "تكوين المكون الإضافي غير صالح. يرجى التحقق من عنوان URL والمحاولة مرة أخرى.",
+ "fr": "La configuration du plugin est invalide. Veuillez vérifier l'URL et réessayer.",
+ "tr": "Eklenti yapılandırması geçersiz. Lütfen URL'yi kontrol edin ve tekrar deneyin.",
+ "de": "Die Plugin-Konfiguration ist ungültig. Bitte überprüfen Sie die URL und versuchen Sie es erneut.",
+ "uk": "Конфігурація плагіна недійсна. Будь ласка, перевірте URL та спробуйте ще раз.",
+ "ca": "La configuració del connector no és vàlida. Comproveu l'URL i torneu-ho a provar."
+ },
+ "LAUNCH$ERROR_CREATION_FAILED": {
+ "en": "Failed to Start Conversation",
+ "ja": "会話の開始に失敗しました",
+ "zh-CN": "启动对话失败",
+ "zh-TW": "啟動對話失敗",
+ "ko-KR": "대화 시작 실패",
+ "no": "Kunne ikke starte samtale",
+ "it": "Impossibile avviare la conversazione",
+ "pt": "Falha ao iniciar conversa",
+ "es": "Error al iniciar la conversación",
+ "ar": "فشل بدء المحادثة",
+ "fr": "Échec du démarrage de la conversation",
+ "tr": "Konuşma başlatılamadı",
+ "de": "Unterhaltung konnte nicht gestartet werden",
+ "uk": "Не вдалося розпочати розмову",
+ "ca": "No s'ha pogut iniciar la conversa"
+ },
+ "LAUNCH$ERROR_CREATION_UNKNOWN": {
+ "en": "An unexpected error occurred while starting the conversation. Please try again.",
+ "ja": "会話の開始中に予期しないエラーが発生しました。もう一度お試しください。",
+ "zh-CN": "启动对话时发生意外错误。请重试。",
+ "zh-TW": "啟動對話時發生意外錯誤。請重試。",
+ "ko-KR": "대화를 시작하는 중 예기치 않은 오류가 발생했습니다. 다시 시도해 주세요.",
+ "no": "En uventet feil oppstod ved start av samtalen. Vennligst prøv igjen.",
+ "it": "Si è verificato un errore imprevisto durante l'avvio della conversazione. Riprova.",
+ "pt": "Ocorreu um erro inesperado ao iniciar a conversa. Por favor, tente novamente.",
+ "es": "Ocurrió un error inesperado al iniciar la conversación. Por favor, inténtelo de nuevo.",
+ "ar": "حدث خطأ غير متوقع أثناء بدء المحادثة. يرجى المحاولة مرة أخرى.",
+ "fr": "Une erreur inattendue s'est produite lors du démarrage de la conversation. Veuillez réessayer.",
+ "tr": "Konuşma başlatılırken beklenmeyen bir hata oluştu. Lütfen tekrar deneyin.",
+ "de": "Beim Starten der Unterhaltung ist ein unerwarteter Fehler aufgetreten. Bitte versuchen Sie es erneut.",
+ "uk": "Під час запуску розмови виникла неочікувана помилка. Будь ласка, спробуйте ще раз.",
+ "ca": "S'ha produït un error inesperat en iniciar la conversa. Torneu-ho a provar."
+ },
+ "LAUNCH$GO_HOME": {
+ "en": "Go Home",
+ "ja": "ホームへ",
+ "zh-CN": "返回首页",
+ "zh-TW": "返回首頁",
+ "ko-KR": "홈으로",
+ "no": "Gå til hjem",
+ "it": "Vai alla home",
+ "pt": "Ir para início",
+ "es": "Ir al inicio",
+ "ar": "الذهاب إلى الصفحة الرئيسية",
+ "fr": "Aller à l'accueil",
+ "tr": "Ana sayfaya git",
+ "de": "Zur Startseite",
+ "uk": "На головну",
+ "ca": "Anar a l'inici"
+ },
+ "LAUNCH$TRY_AGAIN": {
+ "en": "Try Again",
+ "ja": "再試行",
+ "zh-CN": "重试",
+ "zh-TW": "重試",
+ "ko-KR": "다시 시도",
+ "no": "Prøv igjen",
+ "it": "Riprova",
+ "pt": "Tentar novamente",
+ "es": "Intentar de nuevo",
+ "ar": "حاول مرة أخرى",
+ "fr": "Réessayer",
+ "tr": "Tekrar dene",
+ "de": "Erneut versuchen",
+ "uk": "Спробувати ще раз",
+ "ca": "Torna-ho a provar"
+ },
+ "LAUNCH$PLUGIN_REF": {
+ "en": "ref:",
+ "ja": "ref:",
+ "zh-CN": "ref:",
+ "zh-TW": "ref:",
+ "ko-KR": "ref:",
+ "no": "ref:",
+ "it": "ref:",
+ "pt": "ref:",
+ "es": "ref:",
+ "ar": "ref:",
+ "fr": "ref:",
+ "tr": "ref:",
+ "de": "ref:",
+ "uk": "ref:",
+ "ca": "ref:"
+ },
+ "LAUNCH$PLUGIN_PATH": {
+ "en": "path:",
+ "ja": "path:",
+ "zh-CN": "path:",
+ "zh-TW": "path:",
+ "ko-KR": "path:",
+ "no": "path:",
+ "it": "path:",
+ "pt": "path:",
+ "es": "path:",
+ "ar": "path:",
+ "fr": "path:",
+ "tr": "path:",
+ "de": "path:",
+ "uk": "path:",
+ "ca": "path:"
+ },
+ "LAUNCH$TRUST_SKILL_CHECKBOX": {
+ "en": "I trust this skill from {{sources}} with the agent secrets defined in my account.",
+ "ja": "私は{{sources}}からのこのスキルを、アカウントに定義されたエージェントシークレットとともに信頼します。",
+ "zh-CN": "我信任来自 {{sources}} 的此技能,并允许其使用我账户中定义的代理密钥。",
+ "zh-TW": "我信任來自 {{sources}} 的此技能,並允許其使用我帳戶中定義的代理密鑰。",
+ "ko-KR": "{{sources}}의 이 스킬을 내 계정에 정의된 에이전트 비밀과 함께 신뢰합니다.",
+ "no": "Jeg stoler på denne ferdigheten fra {{sources}} med agenthemmelighetene definert i kontoen min.",
+ "it": "Mi fido di questa skill da {{sources}} con i segreti dell'agente definiti nel mio account.",
+ "pt": "Eu confio nesta habilidade de {{sources}} com os segredos do agente definidos em minha conta.",
+ "es": "Confío en esta habilidad de {{sources}} con los secretos del agente definidos en mi cuenta.",
+ "ar": "أثق في هذه المهارة من {{sources}} مع أسرار الوكيل المحددة في حسابي.",
+ "fr": "Je fais confiance à cette compétence de {{sources}} avec les secrets d'agent définis dans mon compte.",
+ "tr": "{{sources}} kaynağından gelen bu beceriye hesabımda tanımlı ajan sırlarıyla güveniyorum.",
+ "de": "Ich vertraue dieser Fähigkeit von {{sources}} mit den in meinem Konto definierten Agenten-Geheimnissen.",
+ "uk": "Я довіряю цій навичці з {{sources}} із секретами агента, визначеними в моєму обліковому записі.",
+ "ca": "Confio en aquesta habilitat de {{sources}} amb els secrets de l'agent definits al meu compte."
+ },
"ONBOARDING$STEP1_TITLE": {
"en": "What's your role?",
"ja": "あなたの役割は?",
diff --git a/frontend/src/routes.ts b/frontend/src/routes.ts
index ba401dae9d..5bdef1134e 100644
--- a/frontend/src/routes.ts
+++ b/frontend/src/routes.ts
@@ -11,6 +11,7 @@ export default [
layout("routes/root-layout.tsx", [
index("routes/home.tsx"),
route("accept-tos", "routes/accept-tos.tsx"),
+ route("launch", "routes/launch.tsx"),
route("settings", "routes/settings.tsx", [
index("routes/llm-settings.tsx"),
route("mcp", "routes/mcp-settings.tsx"),
diff --git a/frontend/src/routes/launch.tsx b/frontend/src/routes/launch.tsx
new file mode 100644
index 0000000000..c05ba0c152
--- /dev/null
+++ b/frontend/src/routes/launch.tsx
@@ -0,0 +1,204 @@
+import React from "react";
+import { useNavigate, useSearchParams } from "react-router";
+import { useTranslation } from "react-i18next";
+import { PluginLaunchModal } from "#/components/features/launch/plugin-launch-modal";
+import { PluginSpec } from "#/api/conversation-service/v1-conversation-service.types";
+import { useCreateConversation } from "#/hooks/mutation/use-create-conversation";
+import { I18nKey } from "#/i18n/declaration";
+
+type ErrorType = "no_plugins" | "invalid_format" | "creation_failed";
+
+interface ParseResult {
+ plugins: PluginSpec[];
+ message?: string;
+ error?: ErrorType;
+}
+
+function sanitizeMessage(message: string | null): string | undefined {
+ if (!message) return undefined;
+ // Strip ALL HTML tags for plain text display
+ const stripped = message.replace(/<[^>]*>/g, "").slice(0, 500);
+ return stripped || undefined;
+}
+
+function parsePluginsFromUrl(searchParams: URLSearchParams): ParseResult {
+ // Try base64 encoded plugins parameter first (production format)
+ const pluginsParam = searchParams.get("plugins");
+ if (pluginsParam) {
+ try {
+ const decoded = atob(pluginsParam);
+ const parsed = JSON.parse(decoded);
+
+ if (!Array.isArray(parsed)) {
+ return { plugins: [], error: "invalid_format" };
+ }
+
+ // Validate each plugin has at least a source
+ const validPlugins: PluginSpec[] = [];
+ for (const item of parsed) {
+ if (
+ typeof item !== "object" ||
+ !item ||
+ typeof item.source !== "string"
+ ) {
+ return { plugins: [], error: "invalid_format" };
+ }
+ validPlugins.push({
+ source: item.source,
+ ref: item.ref ?? null,
+ repo_path: item.repo_path ?? null,
+ parameters: item.parameters ?? null,
+ });
+ }
+
+ if (validPlugins.length === 0) {
+ return { plugins: [], error: "no_plugins" };
+ }
+
+ return {
+ plugins: validPlugins,
+ message: sanitizeMessage(searchParams.get("message")),
+ };
+ } catch {
+ return { plugins: [], error: "invalid_format" };
+ }
+ }
+
+ // Fallback: simple params format for dev/testing
+ const pluginSource = searchParams.get("plugin_source");
+ if (pluginSource) {
+ const plugin: PluginSpec = {
+ source: pluginSource,
+ ref: searchParams.get("plugin_ref") ?? null,
+ repo_path: searchParams.get("plugin_repo_path") ?? null,
+ parameters: null,
+ };
+ return {
+ plugins: [plugin],
+ message: sanitizeMessage(searchParams.get("message")),
+ };
+ }
+
+ return { plugins: [], error: "no_plugins" };
+}
+
+function ErrorDisplay({
+ errorType,
+ onGoHome,
+ onTryAgain,
+}: {
+ errorType: ErrorType;
+ onGoHome: () => void;
+ onTryAgain?: () => void;
+}) {
+ const { t } = useTranslation();
+
+ const errorMessages: Record<ErrorType, string> = {
+ no_plugins: t(I18nKey.LAUNCH$ERROR_NO_PLUGINS),
+ invalid_format: t(I18nKey.LAUNCH$ERROR_INVALID_FORMAT),
+ creation_failed: t(I18nKey.LAUNCH$ERROR_CREATION_FAILED),
+ };
+
+ return (
+ <div
+ className="flex h-full items-center justify-center"
+ data-testid="launch-error"
+ >
+ <div className="max-w-md rounded-lg bg-neutral-800 p-6 text-center">
+ <h2 className="mb-4 text-xl font-semibold text-red-400">
+ {t(I18nKey.LAUNCH$ERROR_TITLE)}
+ </h2>
+ <p className="mb-6 text-neutral-300">{errorMessages[errorType]}</p>
+ <div className="flex justify-center gap-3">
+ <button
+ type="button"
+ onClick={onGoHome}
+ className="rounded-md bg-neutral-700 px-4 py-2 text-sm text-neutral-200 hover:bg-neutral-600"
+ data-testid="go-home-button"
+ >
+ {t(I18nKey.LAUNCH$GO_HOME)}
+ </button>
+ {onTryAgain && (
+ <button
+ type="button"
+ onClick={onTryAgain}
+ className="rounded-md bg-blue-600 px-4 py-2 text-sm text-white hover:bg-blue-700"
+ data-testid="try-again-button"
+ >
+ {t(I18nKey.LAUNCH$TRY_AGAIN)}
+ </button>
+ )}
+ </div>
+ </div>
+ </div>
+ );
+}
+
+export default function LaunchRoute() {
+ const [searchParams] = useSearchParams();
+ const navigate = useNavigate();
+ const { t } = useTranslation();
+ const createConversation = useCreateConversation();
+
+ const [creationError, setCreationError] = React.useState<string | null>(null);
+
+ const parseResult = React.useMemo(
+ () => parsePluginsFromUrl(searchParams),
+ [searchParams],
+ );
+
+ const handleStartConversation = async (
+ plugins: PluginSpec[],
+ initialMessage?: string,
+ ) => {
+ setCreationError(null);
+ try {
+ const result = await createConversation.mutateAsync({
+ plugins,
+ query: initialMessage,
+ });
+ navigate(`/conversations/${result.conversation_id}`);
+ } catch {
+ setCreationError(t(I18nKey.LAUNCH$ERROR_CREATION_UNKNOWN));
+ }
+ };
+
+ const handleGoHome = () => {
+ navigate("/");
+ };
+
+ const handleTryAgain = () => {
+ setCreationError(null);
+ window.location.reload();
+ };
+
+ // Show error if parsing failed
+ if (parseResult.error) {
+ return (
+ <ErrorDisplay errorType={parseResult.error} onGoHome={handleGoHome} />
+ );
+ }
+
+ // Show error if conversation creation failed
+ if (creationError) {
+ return (
+ <ErrorDisplay
+ errorType="creation_failed"
+ onGoHome={handleGoHome}
+ onTryAgain={handleTryAgain}
+ />
+ );
+ }
+
+ return (
+ <div className="h-full" data-testid="launch-route">
+ <PluginLaunchModal
+ plugins={parseResult.plugins}
+ message={parseResult.message}
+ isLoading={createConversation.isPending}
+ onStartConversation={handleStartConversation}
+ onClose={handleGoHome}
+ />
+ </div>
+ );
+}