🙌 OpenHands: AI-Driven Development
feat: polish automations dashboard, recommended rail, and Add/Import flow (#16688)
FraterCCCLXIII7a9aacb7b69e
diff --git a/__tests__/components/automations/automation-card.test.tsx b/__tests__/components/automations/automation-card.test.tsxindex 71ae1b1965..c55bc76459 100644--- a/__tests__/components/automations/automation-card.test.tsx+++ b/__tests__/components/automations/automation-card.test.tsx@@ -2,14 +2,22 @@ import { render, screen } from "@testing-library/react";import userEvent from "@testing-library/user-event";import { describe, expect, it, vi } from "vitest";import { AutomationCard } from "#/components/features/automations/automation-card";-import type { Automation } from "#/types/automation";+import {+ AutomationRunStatus,+ type Automation,+ type AutomationRun,+} from "#/types/automation";+import type { InterfaceListInsights } from "#/manifests/types";vi.mock("react-i18next", () => ({- useTranslation: () => ({ t: (key: string) => key }),+ useTranslation: () => ({+ t: (key: string) => key,+ i18n: { language: "en" },+ }),}));vi.mock("#/context/navigation-context", () => ({- useNavigation: () => ({ navigate: vi.fn() }),+ useNavigation: () => ({ navigate: vi.fn(), currentPath: "/" }),}));vi.mock("#/hooks/use-has-permission", () => ({@@ -21,11 +29,37 @@ const automation: Automation = {name: "Async Standup Digest",prompt: "Generate an async standup digest from Slack activity.",enabled: true,- trigger: { type: "cron", schedule_human: "cron" },+ trigger: { type: "cron", schedule_human: "Mondays at 09:00" },created_at: "2026-01-01T00:00:00Z",updated_at: "2026-01-01T00:00:00Z",};+const insightsSpec = {+ health: {+ healthy: "Healthy",+ failing: "Failing",+ running: "Running",+ disabled: "Disabled",+ neverRun: "Never run",+ checking: "Checking",+ },+ lastRun: { label: "Last run", never: "Never", justNow: "Just now" },+ stats: { runs: "Runs", recentSuccess: "Success", averageDuration: "Avg" },+};++function createRun(overrides: Partial<AutomationRun> = {}): AutomationRun {+ return {+ id: "run-1",+ status: AutomationRunStatus.COMPLETED,+ conversation_id: null,+ bash_command_id: null,+ error_detail: null,+ started_at: "2026-01-02T00:00:00Z",+ completed_at: "2026-01-02T00:02:00Z",+ ...overrides,+ };+}+describe("AutomationCard", () => {it("uses the shared extension module interactive class without a resting border", () => {render(@@ -40,9 +74,29 @@ describe("AutomationCard", () => {const card = screen.getByTestId("automation-card-automation-1");expect(card.className).toContain("extension-module-card-interactive");+ expect(card.className).toContain("bg-base-secondary");expect(card.className).not.toContain("border-[var(--oh-border)]");- expect(card.className).not.toContain("hover:bg-surface-raised");- expect(card.className).not.toContain("hover:ring");+ });++ it("renders title, description, and overflow pills", () => {+ render(+ <AutomationCard+ automation={automation}+ onToggle={vi.fn()}+ onRunNow={vi.fn()}+ onExport={vi.fn()}+ onDelete={vi.fn()}+ />,+ );++ expect(screen.getByText("Async Standup Digest")).toBeInTheDocument();+ expect(+ screen.getByText("Generate an async standup digest from Slack activity."),+ ).toBeInTheDocument();+ expect(screen.getByText("Mondays at 09:00")).toBeInTheDocument();+ expect(+ screen.getByTestId("automation-pills-automation-1"),+ ).toBeInTheDocument();});it("renders a play run button and menu actions instead of a toggle switch", async () => {@@ -60,9 +114,9 @@ describe("AutomationCard", () => {expect(screen.getByTestId("automation-run-now-automation-1"),- ).toHaveTextContent("AUTOMATIONS$RUN_NOW");+ ).toHaveAttribute("aria-label", "AUTOMATIONS$RUN_NOW");expect(screen.getByTestId("automation-run-now-automation-1")).toHaveClass(- "h-8",+ "size-8",);expect(screen.queryByRole("switch")).not.toBeInTheDocument();@@ -71,6 +125,49 @@ describe("AutomationCard", () => {);expect(screen.getByText("COMMON$VIEW")).toBeInTheDocument();- expect(screen.getAllByText("AUTOMATIONS$RUN_NOW")).toHaveLength(2);+ expect(screen.getByText("AUTOMATIONS$RUN_NOW")).toBeInTheDocument();+ });++ it("shows a status strip and sparkline when insights are present", () => {+ const latestRun = createRun({+ started_at: new Date(Date.now() - 10 * 60_000).toISOString(),+ completed_at: new Date(Date.now() - 8 * 60_000).toISOString(),+ });++ render(+ <AutomationCard+ automation={automation}+ onToggle={vi.fn()}+ onRunNow={vi.fn()}+ onExport={vi.fn()}+ onDelete={vi.fn()}+ insights={{+ spec: insightsSpec satisfies InterfaceListInsights,+ state: {+ summary: {+ total: 4,+ latestRun,+ recentRuns: [latestRun],+ recentSuccessRate: 1,+ averageDurationMs: 120_000,+ },+ isLoading: false,+ isError: false,+ },+ }}+ />,+ );++ expect(screen.queryByTestId("automation-health-badge")).not.toBeInTheDocument();+ expect(+ screen.getByTestId("automation-last-run-automation-1"),+ ).toHaveTextContent("AUTOMATIONS$DETAIL$TIME_MINUTES_AGO");+ expect(screen.getByTestId("run-status-icon-completed")).toBeInTheDocument();+ expect(+ screen.getByTestId("automation-activity-automation-1"),+ ).toBeInTheDocument();+ expect(screen.getByTestId("automation-run-stats")).toBeInTheDocument();+ expect(screen.getByText("4")).toBeInTheDocument();+ expect(screen.getByText("100%")).toBeInTheDocument();});});diff --git a/__tests__/components/automations/automation-list-row.test.tsx b/__tests__/components/automations/automation-list-row.test.tsxindex 80a3c7ffec..b5925d8f75 100644--- a/__tests__/components/automations/automation-list-row.test.tsx+++ b/__tests__/components/automations/automation-list-row.test.tsx@@ -2,14 +2,22 @@ import { render, screen } from "@testing-library/react";import userEvent from "@testing-library/user-event";import { describe, expect, it, vi } from "vitest";import { AutomationListRow } from "#/components/features/automations/automation-list-row";-import type { Automation } from "#/types/automation";+import {+ AutomationRunStatus,+ type Automation,+ type AutomationRun,+} from "#/types/automation";+import type { InterfaceListInsights } from "#/manifests/types";vi.mock("react-i18next", () => ({- useTranslation: () => ({ t: (key: string) => key }),+ useTranslation: () => ({+ t: (key: string) => key,+ i18n: { language: "en" },+ }),}));vi.mock("#/context/navigation-context", () => ({- useNavigation: () => ({ navigate: vi.fn() }),+ useNavigation: () => ({ navigate: vi.fn(), currentPath: "/" }),}));vi.mock("#/hooks/use-has-permission", () => ({@@ -21,15 +29,45 @@ const automation: Automation = {name: "GitHub PR Reviewer",prompt: "Review pull requests.",enabled: true,- trigger: { type: "event" },+ trigger: {+ type: "event",+ on: "pull_request.opened",+ source: "github",+ },repository: "acme/repo",model: "Claude",created_at: "2026-01-01T00:00:00Z",updated_at: "2026-01-01T00:00:00Z",};+const insightsSpec = {+ health: {+ healthy: "Healthy",+ failing: "Failing",+ running: "Running",+ disabled: "Disabled",+ neverRun: "Never run",+ checking: "Checking",+ },+ lastRun: { label: "Last run", never: "Never", justNow: "Just now" },+ stats: { runs: "Runs", recentSuccess: "Success", averageDuration: "Avg" },+};++function createRun(overrides: Partial<AutomationRun> = {}): AutomationRun {+ return {+ id: "run-1",+ status: AutomationRunStatus.COMPLETED,+ conversation_id: null,+ bash_command_id: null,+ error_detail: null,+ started_at: "2026-01-02T00:00:00Z",+ completed_at: "2026-01-02T00:02:00Z",+ ...overrides,+ };+}+describe("AutomationListRow", () => {- it("renders title, pills, and action icons in a table row layout", () => {+ it("renders title, trigger meta, and action icons in a two-line list row", () => {render(<AutomationListRowautomation={automation}@@ -44,9 +82,11 @@ describe("AutomationListRow", () => {screen.getByTestId("automation-list-row-automation-1"),).toBeInTheDocument();expect(screen.getByText("GitHub PR Reviewer")).toBeInTheDocument();+ expect(screen.getByText("pull_request.opened")).toBeInTheDocument();+ expect(screen.getByText("GitHub")).toBeInTheDocument();expect(- screen.getByTestId("automation-pills-automation-1"),- ).toBeInTheDocument();+ screen.queryByTestId("automation-pills-automation-1"),+ ).not.toBeInTheDocument();expect(screen.getByTestId("automation-run-now-automation-1"),).toHaveAttribute("aria-label", "AUTOMATIONS$RUN_NOW");@@ -55,6 +95,45 @@ describe("AutomationListRow", () => {);});+ it("shows last-run status, relative time, and a sparkline when insights are present", () => {+ const latestRun = createRun({+ started_at: new Date(Date.now() - 10 * 60_000).toISOString(),+ completed_at: new Date(Date.now() - 8 * 60_000).toISOString(),+ });++ render(+ <AutomationListRow+ automation={automation}+ onToggle={vi.fn()}+ onRunNow={vi.fn()}+ onExport={vi.fn()}+ onDelete={vi.fn()}+ insights={{+ spec: insightsSpec satisfies InterfaceListInsights,+ state: {+ summary: {+ total: 4,+ latestRun,+ recentRuns: [latestRun],+ recentSuccessRate: 1,+ averageDurationMs: 120_000,+ },+ isLoading: false,+ isError: false,+ },+ }}+ />,+ );++ expect(+ screen.getByTestId("automation-last-run-automation-1"),+ ).toHaveTextContent("AUTOMATIONS$DETAIL$TIME_MINUTES_AGO");+ expect(screen.getByTestId("run-status-icon-completed")).toBeInTheDocument();+ expect(+ screen.getByTestId("automation-activity-automation-1"),+ ).toBeInTheDocument();+ });+it("opens the actions menu without triggering row navigation handlers", async () => {const user = userEvent.setup();diff --git a/__tests__/components/automations/build-automation-pills.test.tsx b/__tests__/components/automations/build-automation-pills.test.tsxnew file mode 100644index 0000000000..91a06dbe9d--- /dev/null+++ b/__tests__/components/automations/build-automation-pills.test.tsx@@ -0,0 +1,82 @@+import { render, screen } from "@testing-library/react";+import { describe, expect, it } from "vitest";+import { buildAutomationMetadataPills } from "#/components/features/automations/build-automation-pills";+import type { SkillCardPill } from "#/components/features/skills/skill-card-pill-row";+import type { Automation } from "#/types/automation";++function buildAutomation(overrides: Partial<Automation> = {}): Automation {+ return {+ id: "automation-1",+ name: "Triage",+ prompt: "Triage the issue.",+ enabled: true,+ trigger: { type: "event", on: "issue.updated", source: "linear" },+ created_at: "2026-01-01T00:00:00Z",+ updated_at: "2026-01-01T00:00:00Z",+ ...overrides,+ };+}++function renderPills(pills: SkillCardPill[]) {+ render(+ <div>+ {pills.map((pill) => (+ <span key={pill.id} data-testid={`pill-${pill.id}`}>+ {pill.node}+ </span>+ ))}+ </div>,+ );+}++describe("buildAutomationMetadataPills", () => {+ it("puts the event and source on separate pills", () => {+ const pills = buildAutomationMetadataPills(buildAutomation(), "unused");++ expect(pills.map((pill) => pill.id)).toEqual([+ "event-trigger",+ "event-source",+ ]);++ renderPills(pills);++ expect(screen.getByTestId("pill-event-trigger")).toHaveTextContent(+ "issue.updated",+ );+ expect(screen.getByTestId("pill-event-trigger")).not.toHaveTextContent(+ "linear",+ );+ expect(screen.getByTestId("pill-event-source")).toHaveTextContent("Linear");+ expect(screen.getByTestId("pill-event-source").firstElementChild).toHaveClass(+ "py-0.5",+ );+ expect(screen.getByTestId("automation-source-logo")).toBeInTheDocument();+ });++ it("renders a fallback icon when the source is not in the catalog", () => {+ renderPills(+ buildAutomationMetadataPills(+ buildAutomation({+ trigger: { type: "event", on: "alert.fired", source: "custom-pager" },+ }),+ "unused",+ ),+ );++ expect(screen.getByTestId("pill-event-source")).toHaveTextContent(+ "Custom-Pager",+ );+ expect(screen.getByTestId("automation-source-logo")).toBeInTheDocument();+ });++ it("omits the source pill when the event has no source", () => {+ const pills = buildAutomationMetadataPills(+ buildAutomation({+ trigger: { type: "event", on: "pull_request.opened" },+ }),+ "unused",+ );++ expect(pills.map((pill) => pill.id)).toEqual(["event-trigger"]);+ });+});diff --git a/__tests__/components/automations/detail/run-status-badge.test.tsx b/__tests__/components/automations/detail/run-status-badge.test.tsxindex f5dd8ae856..0181de0b2e 100644--- a/__tests__/components/automations/detail/run-status-badge.test.tsx+++ b/__tests__/components/automations/detail/run-status-badge.test.tsx@@ -55,6 +55,15 @@ describe("RunStatusBadge", () => {expect(screen.getByTestId("run-status-icon-completed")).toBeInTheDocument();});+ it("renders compact pills without an outline and with tighter left padding", () => {+ render(<RunStatusBadge status={AutomationRunStatus.FAILED} compact />);++ const badge = screen.getByText(I18nKey.AUTOMATIONS$DETAIL$FAILED);+ expect(badge.className).not.toContain("border");+ expect(badge).toHaveClass("pl-1");+ expect(badge).toHaveClass("pr-1.5");+ });+it("renders the status word next to the icon when showLabel is set", () => {render(<RunStatusBadgediff --git a/__tests__/components/automations/recommended-automations-rail.test.tsx b/__tests__/components/automations/recommended-automations-rail.test.tsxnew file mode 100644index 0000000000..7b1012a6f9--- /dev/null+++ b/__tests__/components/automations/recommended-automations-rail.test.tsx@@ -0,0 +1,193 @@+import { fireEvent, render, screen } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { I18nKey } from "#/i18n/declaration";+import { RecommendedAutomationsRail } from "#/components/features/automations/recommended-automations-rail";+import { AUTOMATION_STACK_SECTION_BOTTOM_CLASS } from "#/utils/automation-stack-section";++vi.mock("react-i18next", () => ({+ useTranslation: () => ({+ t: (key: string) => key,+ }),+}));++describe("RecommendedAutomationsRail", () => {+ beforeEach(() => {+ vi.stubGlobal(+ "ResizeObserver",+ class {+ observe = vi.fn();++ unobserve = vi.fn();++ disconnect = vi.fn();+ },+ );+ });++ afterEach(() => {+ vi.unstubAllGlobals();+ });++ it("renders remaining proven workflows before conversation-only extras", () => {+ render(+ <RecommendedAutomationsRail+ installedAutomations={[{ name: "GitHub Code Review Agent" }]}+ onSelect={vi.fn()}+ />,+ );++ const cardIds = screen+ .getAllByTestId(/^recommended-automation-rail-card-/)+ .map((card) =>+ card+ .getAttribute("data-testid")+ ?.replace("recommended-automation-rail-card-", ""),+ );++ expect(cardIds).toEqual([+ "github-repo-monitor",+ "slack-channel-monitor",+ "slack-standup-digest",+ "linear-triage-assistant",+ "jira-issue-to-pr",+ "research-brief-writer",+ ]);+ expect(+ screen.getByText(I18nKey.RECOMMENDED_AUTOMATIONS$SECTION_LABEL),+ ).toBeInTheDocument();+ });++ it("keeps space below the cards when later home sections are empty", () => {+ render(+ <RecommendedAutomationsRail+ installedAutomations={[]}+ onSelect={vi.fn()}+ />,+ );++ expect(screen.getByTestId("recommended-automations-rail")).toHaveClass(+ AUTOMATION_STACK_SECTION_BOTTOM_CLASS,+ );+ });++ it("calls onSelect when a rail card is clicked", async () => {+ const onSelect = vi.fn();+ const user = userEvent.setup();++ render(+ <RecommendedAutomationsRail+ installedAutomations={[]}+ onSelect={onSelect}+ />,+ );++ await user.click(+ screen.getByTestId("recommended-automation-rail-card-slack-standup-digest"),+ );++ expect(onSelect).toHaveBeenCalledWith(+ expect.objectContaining({ id: "slack-standup-digest" }),+ );+ });++ it("renders nothing when every recommended automation has been added", () => {+ const { container } = render(+ <RecommendedAutomationsRail+ installedAutomations={[+ { name: "GitHub Code Review Agent" },+ { name: "GitHub repository monitor" },+ { name: "Slack channel monitor" },+ { name: "Slack standup digest" },+ { name: "Linear issue triage assistant" },+ { name: "Jira issue to GitHub PR" },+ { name: "Research brief writer" },+ ]}+ onSelect={vi.fn()}+ />,+ );++ expect(container).toBeEmptyDOMElement();+ });++ it("keeps a 40px icon row and overlaps multiple logos to the right", () => {+ render(+ <RecommendedAutomationsRail+ installedAutomations={[]}+ onSelect={vi.fn()}+ />,+ );++ const single = screen.getByTestId(+ "recommended-automation-rail-icon-github-pr-reviewer",+ );+ const overlap = screen.getByTestId(+ "recommended-automation-rail-icon-jira-issue-to-pr",+ );++ expect(single).toHaveClass("h-10");+ expect(single).not.toHaveAttribute("data-layout");+ expect(overlap).toHaveClass("h-10", "-space-x-2");+ expect(overlap).toHaveAttribute("data-layout", "overlap");+ expect(overlap).not.toHaveClass("w-10", "bg-surface-raised");+ expect(overlap).not.toHaveAttribute("data-layout", "quadrants");+ });++ describe("clipped-content fades", () => {+ function mockScrollMetrics(+ element: HTMLElement,+ metrics: { scrollWidth: number; clientWidth: number; scrollLeft: number },+ ) {+ Object.defineProperty(element, "scrollWidth", {+ configurable: true,+ value: metrics.scrollWidth,+ });+ Object.defineProperty(element, "clientWidth", {+ configurable: true,+ value: metrics.clientWidth,+ });+ Object.defineProperty(element, "scrollLeft", {+ configurable: true,+ writable: true,+ value: metrics.scrollLeft,+ });+ }++ it("shows an edge gradient only on the clipped side", () => {+ render(+ <RecommendedAutomationsRail+ installedAutomations={[]}+ onSelect={vi.fn()}+ />,+ );++ const scroller = screen.getByTestId("recommended-automations-rail-scroll");+ const leftFade = screen.getByTestId(+ "recommended-automations-rail-fade-left",+ );+ const rightFade = screen.getByTestId(+ "recommended-automations-rail-fade-right",+ );++ mockScrollMetrics(scroller, {+ scrollWidth: 900,+ clientWidth: 320,+ scrollLeft: 0,+ });+ fireEvent.scroll(scroller);++ expect(rightFade).toHaveAttribute("data-visible", "true");+ expect(leftFade).toHaveAttribute("data-visible", "false");++ mockScrollMetrics(scroller, {+ scrollWidth: 900,+ clientWidth: 320,+ scrollLeft: 580,+ });+ fireEvent.scroll(scroller);++ expect(leftFade).toHaveAttribute("data-visible", "true");+ expect(rightFade).toHaveAttribute("data-visible", "false");+ });+ });+});diff --git a/__tests__/components/automations/recommended-automations.test.tsx b/__tests__/components/automations/recommended-automations.test.tsxindex b179a37c7a..f9322a8989 100644--- a/__tests__/components/automations/recommended-automations.test.tsx+++ b/__tests__/components/automations/recommended-automations.test.tsx@@ -24,6 +24,7 @@ import {type NavigationContextValue,} from "#/context/navigation-context";import type { Backend } from "#/api/backend-registry/types";+import AutomationService from "#/api/automation-service/automation-service.api";import { RecommendedAutomationsLauncher } from "#/components/features/automations/recommended-automations-launcher";import {RecommendedAutomationsSection,@@ -103,14 +104,20 @@ const navigationValue: NavigationContextValue = {navigate: mockNavigate,};-function renderLauncher({ withBackendProvider = false } = {}) {+function renderLauncher({+ withBackendProvider = false,+ variant = "catalog",+}: {+ withBackendProvider?: boolean;+ variant?: "catalog" | "rail";+} = {}) {const queryClient = new QueryClient({defaultOptions: { queries: { retry: false }, mutations: { retry: false } },});const launcher = (<NavigationProvider value={navigationValue}>- <RecommendedAutomationsLauncher />+ <RecommendedAutomationsLauncher variant={variant} /></NavigationProvider>);@@ -867,6 +874,54 @@ describe("recommended automations", () => {).not.toBeInTheDocument();});+ it("renders the compact rail instead of the catalog section", async () => {+ // Earlier cases call `vi.unstubAllGlobals()`, which also removes the+ // setup file's ResizeObserver stub the rail's fade tracking needs.+ vi.stubGlobal(+ "ResizeObserver",+ class {+ observe() {}++ unobserve() {}++ disconnect() {}+ },+ );+ vi.spyOn(AutomationService, "getAutomations").mockResolvedValue({+ automations: [+ {+ id: "installed-1",+ name: "GitHub Code Review Agent",+ trigger: { type: "cron", schedule: "0 9 * * *" },+ enabled: true,+ prompt: "Review PRs",+ created_at: "2026-01-01T00:00:00Z",+ updated_at: "2026-01-01T00:00:00Z",+ },+ ],+ total: 1,+ });++ renderLauncher({ variant: "rail" });++ expect(+ await screen.findByTestId("recommended-automations-rail"),+ ).toBeInTheDocument();+ expect(+ screen.queryByTestId("recommended-automations-section"),+ ).not.toBeInTheDocument();+ expect(+ screen.queryByTestId(+ "recommended-automation-rail-card-github-pr-reviewer",+ ),+ ).not.toBeInTheDocument();+ expect(+ screen.getByTestId(+ "recommended-automation-rail-card-slack-standup-digest",+ ),+ ).toBeInTheDocument();+ });+it("launches the recommendation after the missing MCP is installed", async () => {const createSpy = vi.spyOn(SettingsService, "createMcpServer")diff --git a/__tests__/components/automations/to-latest-run-state.test.ts b/__tests__/components/automations/to-latest-run-state.test.tsnew file mode 100644index 0000000000..bf72e90fab--- /dev/null+++ b/__tests__/components/automations/to-latest-run-state.test.ts@@ -0,0 +1,52 @@+import { describe, expect, it } from "vitest";+import { toRunSummaryState } from "#/components/features/automations/to-latest-run-state";+import { AutomationRunStatus, type AutomationRun } from "#/types/automation";++function createRun(overrides: Partial<AutomationRun> = {}): AutomationRun {+ return {+ id: "run-1",+ status: AutomationRunStatus.COMPLETED,+ conversation_id: null,+ bash_command_id: null,+ error_detail: null,+ started_at: "2026-01-02T00:00:00Z",+ completed_at: "2026-01-02T00:03:00Z",+ ...overrides,+ };+}++describe("toRunSummaryState", () => {+ it("summarizes recent runs for the dashboard stats footer", () => {+ const completed = createRun();+ const failed = createRun({+ id: "run-2",+ status: AutomationRunStatus.FAILED,+ started_at: "2026-01-02T00:10:00Z",+ completed_at: "2026-01-02T00:12:00Z",+ });++ const state = toRunSummaryState({+ latestRun: completed,+ recentRuns: [completed, failed],+ total: 8,+ isLoading: false,+ isError: false,+ });++ expect(state.summary?.total).toBe(8);+ expect(state.summary?.recentSuccessRate).toBe(0.5);+ expect(state.summary?.averageDurationMs).toBe(150_000);+ });++ it("keeps an empty loading state from showing fake totals", () => {+ const state = toRunSummaryState({+ latestRun: null,+ recentRuns: [],+ isLoading: true,+ isError: false,+ });++ expect(state.summary).toBeNull();+ expect(state.isLoading).toBe(true);+ });+});diff --git a/__tests__/components/features/home/featured-automations-section.test.tsx b/__tests__/components/features/home/featured-automations-section.test.tsxindex 31f0771ac1..e5144ff8be 100644--- a/__tests__/components/features/home/featured-automations-section.test.tsx+++ b/__tests__/components/features/home/featured-automations-section.test.tsx@@ -11,6 +11,7 @@ import { PinnedAutomationsDashboard } from "#/components/features/home/featured-import { RunningAutomationsList } from "#/components/features/home/featured-automations/running-automations-list";import { NavigationProvider } from "#/context/navigation-context";import { HOME_PINNED_AUTOMATIONS_KEY } from "#/hooks/use-home-pinned-automations";+import { AUTOMATION_STACK_SECTION_BOTTOM_CLASS } from "#/utils/automation-stack-section";import {AutomationRunStatus,type Automation,@@ -400,8 +401,20 @@ describe("home automations composer layout", () => {await user.click(screen.getByTestId("running-automation-pin-auto-1"));const dashboard = await screen.findByTestId("pinned-automations-dashboard");+ expect(dashboard).toHaveClass(AUTOMATION_STACK_SECTION_BOTTOM_CLASS);+ const pinnedCard = within(dashboard).getByTestId(+ "pinned-automation-card-auto-1",+ );+ expect(pinnedCard.className).toContain("extension-module-card-interactive");+ expect(pinnedCard.className).toContain("bg-base-secondary");+ expect(pinnedCard.className).not.toContain("border-[var(--oh-border)]");+ expect(pinnedCard).toBeInTheDocument();+ expect(+ within(dashboard).getByTestId("pinned-automation-pills-auto-1-wrap"),+ ).toBeInTheDocument();+ expect(within(dashboard).getByText("Daily at 09:00")).toBeInTheDocument();expect(- within(dashboard).getByTestId("pinned-automation-card-auto-1"),+ within(pinnedCard).getByTestId("automation-run-stats"),).toBeInTheDocument();expect(await within(dashboard).findByRole("link", {@@ -420,6 +433,10 @@ describe("home automations composer layout", () => {expect(getStoredPinnedIds()).toContain("auto-1");+ expect(+ screen.queryByTestId("pinned-automation-run-now-auto-1"),+ ).not.toBeInTheDocument();+await user.click(screen.getByTestId("pinned-automation-menu-auto-1"));expect(screen.getByTestId("pinned-automation-run-auto-1"),diff --git a/__tests__/components/features/home/home-chat-launcher.test.tsx b/__tests__/components/features/home/home-chat-launcher.test.tsxindex 4c5f0b1f0f..58b252ef19 100644--- a/__tests__/components/features/home/home-chat-launcher.test.tsx+++ b/__tests__/components/features/home/home-chat-launcher.test.tsx@@ -201,6 +201,19 @@ vi.mock("#/components/features/home/home-git-control-bar-preview", () => ({// Stub the picker modal: pressing it selects one plugin then closes, mirroring// the real modal's `onChange` + `onClose` contract. The picker catalog itself// is covered by plugin-picker.test.tsx.+vi.mock("#/components/features/automations/recommended-automations-launcher", () => ({+ RecommendedAutomationsLauncher: ({+ variant,+ className,+ }: {+ variant?: string;+ className?: string;+ }) =>+ variant === "rail" ? (+ <div data-testid="recommended-automations-rail" className={className} />+ ) : null,+}));+vi.mock("#/components/features/plugins/plugin-picker-modal", () => ({PluginPickerModal: ({onChange,@@ -581,4 +594,12 @@ describe("HomeChatLauncher", () => {metadata: null,});});++ it("always renders the recommended automations rail above pinned activity", () => {+ renderLauncher();++ expect(+ screen.getByTestId("recommended-automations-rail"),+ ).toBeInTheDocument();+ });});diff --git a/__tests__/components/features/skills/skill-card-pill-row.test.tsx b/__tests__/components/features/skills/skill-card-pill-row.test.tsxindex 52ce6e6b37..45862f1a46 100644--- a/__tests__/components/features/skills/skill-card-pill-row.test.tsx+++ b/__tests__/components/features/skills/skill-card-pill-row.test.tsx@@ -1,35 +1,83 @@-import { render, screen } from "@testing-library/react";-import { describe, expect, it, vi } from "vitest";+import React from "react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { act, screen, waitFor, within } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { renderWithProviders } from "test-utils";import {SKILL_CARD_PILL_CLASS,SkillCardPillRow,} from "#/components/features/skills/skill-card-pill-row";describe("SkillCardPillRow", () => {- it("keeps pills on a single nowrap row with overflow handling", () => {+ const observedCallbacks: ResizeObserverCallback[] = [];++ beforeEach(() => {+ observedCallbacks.length = 0;vi.stubGlobal("ResizeObserver",class {- observe() {}+ constructor(cb: ResizeObserverCallback) {+ observedCallbacks.push(cb);+ }++ observe() {+ const cb = observedCallbacks[observedCallbacks.length - 1];+ cb?.([], this as unknown as ResizeObserver);+ }disconnect() {}++ unobserve() {}},);+ });++ afterEach(() => {+ vi.unstubAllGlobals();+ });++ function stubWidths(containerWidth: number, pillWidth: number) {+ const row = screen.getByTestId("skill-triggers-test");+ Object.defineProperty(row, "clientWidth", {+ configurable: true,+ get: () => containerWidth,+ });++ const measure = row+ .closest('[data-testid="skill-triggers-test-wrap"]')+ ?.querySelector('[aria-hidden="true"]') as HTMLElement;+ Array.from(measure.children).forEach((child) => {+ Object.defineProperty(child, "offsetWidth", {+ configurable: true,+ get: () => pillWidth,+ });+ });++ act(() => {+ for (const cb of observedCallbacks) {+ cb([], {} as ResizeObserver);+ }+ });+ }- render(- <SkillCardPillRow- testId="skill-triggers-test"- pills={[- {- id: "type-knowledge",- node: <span className={SKILL_CARD_PILL_CLASS}>Trigger-based</span>,- },- {- id: "trigger-ssh",- node: <span className={SKILL_CARD_PILL_CLASS}>ssh</span>,- },- ]}- />,+ const pills = [+ {+ id: "event-trigger",+ node: (+ <span className={SKILL_CARD_PILL_CLASS}>+ pull_request_review_comment.created (github)+ </span>+ ),+ },+ {+ id: "model",+ node: <span className={SKILL_CARD_PILL_CLASS}>review-fast</span>,+ },+ ];++ it("keeps pills on a single nowrap row with overflow handling", () => {+ renderWithProviders(+ <SkillCardPillRow testId="skill-triggers-test" pills={pills} />,);const row = screen.getByTestId("skill-triggers-test");@@ -37,4 +85,111 @@ describe("SkillCardPillRow", () => {expect(row).toHaveClass("overflow-hidden");expect(row).not.toHaveClass("flex-wrap");});++ it("folds pills that do not fit into a +N popover", async () => {+ const user = userEvent.setup();+ renderWithProviders(+ <SkillCardPillRow testId="skill-triggers-test" pills={pills} />,+ );++ // Wide enough for one 80px pill + overflow reserve, not two.+ stubWidths(130, 80);++ await waitFor(() => {+ expect(+ screen.getByTestId("skill-triggers-test-overflow"),+ ).toBeInTheDocument();+ });++ expect(screen.getByTestId("skill-triggers-test")).toHaveTextContent(+ "pull_request_review_comment.created (github)",+ );+ expect(screen.getByTestId("skill-triggers-test")).not.toHaveTextContent(+ "review-fast",+ );++ const overflow = screen.getByTestId("skill-triggers-test-overflow");+ expect(overflow).toHaveAttribute(+ "aria-label",+ "SETTINGS$SKILLS_PILLS_OVERFLOW_ARIA",+ );++ await user.click(overflow);++ const popover = screen.getByTestId("skill-triggers-test-overflow-popover");+ expect(popover.parentElement).toBe(document.body);+ expect(+ within(popover).getByTestId("skill-triggers-test-overflow-item"),+ ).toHaveTextContent("review-fast");+ });++ it("opens the overflow popover without activating a wrapping card", async () => {+ const user = userEvent.setup();+ const onActivate = vi.fn();++ renderWithProviders(+ <div+ role="link"+ tabIndex={0}+ onClick={onActivate}+ onKeyDown={(event) => {+ if (event.key === "Enter") onActivate();+ }}+ >+ <SkillCardPillRow testId="skill-triggers-test" pills={pills} />+ </div>,+ );++ stubWidths(130, 80);++ await waitFor(() => {+ expect(+ screen.getByTestId("skill-triggers-test-overflow"),+ ).toBeInTheDocument();+ });++ await user.click(screen.getByTestId("skill-triggers-test-overflow"));++ expect(+ screen.getByTestId("skill-triggers-test-overflow-popover"),+ ).toBeInTheDocument();+ expect(onActivate).not.toHaveBeenCalled();+ });++ it("anchors the overflow popover below the +N pill", async () => {+ const user = userEvent.setup();+ renderWithProviders(+ <SkillCardPillRow testId="skill-triggers-test" pills={pills} />,+ );++ stubWidths(130, 80);++ await waitFor(() => {+ expect(+ screen.getByTestId("skill-triggers-test-overflow"),+ ).toBeInTheDocument();+ });++ const overflow = screen.getByTestId("skill-triggers-test-overflow");+ vi.spyOn(overflow, "getBoundingClientRect").mockReturnValue({+ x: 200,+ y: 100,+ top: 100,+ bottom: 118,+ left: 200,+ right: 236,+ width: 36,+ height: 18,+ toJSON: () => ({}),+ });++ await user.click(overflow);++ const popover = screen.getByTestId("skill-triggers-test-overflow-popover");+ expect(popover).toHaveStyle({+ position: "fixed",+ top: "122px",+ left: "200px",+ });+ });});diff --git a/__tests__/manifests/automation-insights.test.ts b/__tests__/manifests/automation-insights.test.tsindex f6592f6410..a7f0dfbe35 100644--- a/__tests__/manifests/automation-insights.test.ts+++ b/__tests__/manifests/automation-insights.test.ts@@ -49,6 +49,7 @@ function settled(summary: Partial<AutomationRunSummary>): RunSummaryState {summary: {total: 0,latestRun: null,+ recentRuns: [],recentSuccessRate: null,averageDurationMs: null,...summary,@@ -157,6 +158,7 @@ describe("summarizeAutomationRuns", () => {expect(summary).toEqual({total: 40,latestRun: runs[0],+ recentRuns: runs,recentSuccessRate: 0.5,averageDurationMs: (30_000 + 90_000) / 2,});diff --git a/__tests__/routes/automations-dashboard.test.tsx b/__tests__/routes/automations-dashboard.test.tsxindex 8b42a7e877..7f05657c77 100644--- a/__tests__/routes/automations-dashboard.test.tsx+++ b/__tests__/routes/automations-dashboard.test.tsx@@ -107,11 +107,10 @@ function renderAt(path: string, page: React.ReactElement) {async function renderDashboardWithSettledInsights() {renderAt("/automations", <AutomationsList />);await screen.findByTestId("automation-card-a-ok");- // The broken automation's badge carries the manifest's failing caption once- // its runs summary settles.+ // Insights have settled once the failed run's status is on the card.await within(await screen.findByTestId("automation-card-a-broken"),- ).findByText("Broken");+ ).findByTestId("run-status-icon-failed");}beforeEach(() => {@@ -154,9 +153,11 @@ describe("AutomationsList — manifest-declared dashboard", () => {await renderDashboardWithSettledInsights();// Assert — navigation, tiles, and controls all carry manifest captions;- // the catalog launcher has moved off this page.+ // the full catalog stays on Templates, and the compact rail is empty-state only.const nav = screen.getByTestId("automations-navbar-desktop");const automationsTile = screen.getByTestId("overview-tile-automations");+ const filters = screen.getByTestId("automations-filters");+ await userEvent.click(within(filters).getByTestId("dropdown-trigger"));expect({navLabels: [within(nav).getByText("Widget dashboard"),@@ -167,11 +168,15 @@ describe("AutomationsList — manifest-declared dashboard", () => {statusFilter: screen.getByLabelText("Filter widgets by state"),sortControl: screen.getByLabelText("Order widgets"),statsCaptions: screen.getAllByText("Widget wins").length,+ activity: screen.getAllByTestId(/^automation-activity-/).length,launcher: screen.queryByTestId("recommended-automations-section"),+ rail: screen.queryByTestId("recommended-automations-rail"),}).toMatchObject({navLabels: 2,statsCaptions: 2,+ activity: 2,launcher: null,+ rail: null,});});@@ -188,12 +193,100 @@ describe("AutomationsList — manifest-declared dashboard", () => {]);});+ it("nests status, trigger, and sort dropdowns inside one Filters control", async () => {+ // Arrange+ const user = userEvent.setup();+ await renderDashboardWithSettledInsights();++ // Assert — the three filters stay inside the combined menu until opened.+ expect(screen.queryByTestId("automations-filter-status")).toBeNull();+ expect(screen.queryByTestId("automations-filter-trigger")).toBeNull();+ expect(screen.queryByTestId("automations-sort")).toBeNull();++ // Act+ await user.click(+ within(screen.getByTestId("automations-filters")).getByTestId(+ "dropdown-trigger",+ ),+ );++ // Assert+ expect(+ within(screen.getByTestId("automations-filters-menu")).getByTestId(+ "automations-filter-status",+ ),+ ).toBeInTheDocument();+ expect(+ within(screen.getByTestId("automations-filters-menu")).getByTestId(+ "automations-filter-trigger",+ ),+ ).toBeInTheDocument();+ expect(+ within(screen.getByTestId("automations-filters-menu")).getByTestId(+ "automations-sort",+ ),+ ).toBeInTheDocument();+ expect(+ within(screen.getByTestId("automations-filters-menu")).getByText(+ "Filter widgets by state",+ ),+ ).toBeInTheDocument();+ expect(+ within(screen.getByTestId("automations-filters-menu")).getByText(+ "Filter widgets by trigger",+ ),+ ).toBeInTheDocument();+ expect(+ within(screen.getByTestId("automations-filters-menu")).getByText(+ "Order widgets",+ ),+ ).toBeInTheDocument();+ expect(+ screen.queryByTestId("automations-filters-reset"),+ ).not.toBeInTheDocument();+ });++ it("resets applied filters from the Filters menu", async () => {+ // Arrange+ const user = userEvent.setup();+ await renderDashboardWithSettledInsights();+ await user.click(+ within(screen.getByTestId("automations-filters")).getByTestId(+ "dropdown-trigger",+ ),+ );+ await user.click(+ within(screen.getByTestId("automations-filter-status")).getByTestId(+ "dropdown-trigger",+ ),+ );+ await user.click(screen.getByTestId("automations-filter-status-failing"));+ await waitFor(() => {+ expect(screen.queryByTestId("automation-card-a-ok")).toBeNull();+ });++ // Act+ await user.click(screen.getByTestId("automations-filters-reset"));++ // Assert+ await screen.findByTestId("automation-card-a-ok");+ expect(screen.getByTestId("automation-card-a-broken")).toBeInTheDocument();+ expect(+ screen.queryByTestId("automations-filters-reset"),+ ).not.toBeInTheDocument();+ });+it("narrows to latest-run failures through the status filter", async () => {// Arrangeconst user = userEvent.setup();await renderDashboardWithSettledInsights();- // Act — pick the manifest's "failing" option.+ // Act — open Filters, then pick the manifest's "failing" option.+ await user.click(+ within(screen.getByTestId("automations-filters")).getByTestId(+ "dropdown-trigger",+ ),+ );await user.click(within(screen.getByTestId("automations-filter-status")).getByTestId("dropdown-trigger",diff --git a/__tests__/routes/automations-list.test.tsx b/__tests__/routes/automations-list.test.tsxindex 90e9cc003a..99293ac506 100644--- a/__tests__/routes/automations-list.test.tsx+++ b/__tests__/routes/automations-list.test.tsx@@ -1,6 +1,6 @@import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import React from "react";-import { render, screen, waitFor } from "@testing-library/react";+import { render, screen, waitFor, within } from "@testing-library/react";import userEvent from "@testing-library/user-event";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { MemoryRouter } from "react-router";@@ -22,6 +22,7 @@ import {type Automation,type AutomationsResponse,} from "#/types/automation";+import { AUTOMATION_STACK_SECTION_BOTTOM_CLASS } from "#/utils/automation-stack-section";vi.mock("#/api/automation-service/automation-service.api", () => ({default: {@@ -161,7 +162,7 @@ describe("AutomationsList — Edit from the row kebab is local-only", () => {});describe("AutomationsList — view mode toggle", () => {- it("switches saved automations from cards to table rows", async () => {+ it("switches saved automations from cards to list rows", async () => {const user = userEvent.setup();renderList();await waitFor(() => {@@ -205,6 +206,24 @@ describe("AutomationsList — view mode toggle", () => {screen.queryByTestId("automations-view-toggle-list"),).not.toBeInTheDocument();});++ it("keeps the recommended rail inside the empty state instead of above it", async () => {+ vi.mocked(AutomationService.getAutomations).mockResolvedValue({+ automations: [],+ total: 0,+ });+ renderList();++ const empty = await screen.findByTestId("automations-empty");+ const rail = await within(empty).findByTestId(+ "recommended-automations-rail",+ );+ expect(rail).toBeInTheDocument();+ expect(rail).not.toHaveClass(AUTOMATION_STACK_SECTION_BOTTOM_CLASS);+ expect(screen.getAllByTestId("recommended-automations-rail")).toHaveLength(+ 1,+ );+ });});describe("AutomationsList — Run now toasts", () => {@@ -340,6 +359,49 @@ describe("AutomationsList — Run now toasts", () => {});});+describe("AutomationsList — add automation menu", () => {+ it("opens create and import from the Add Automation dropdown", async () => {+ const user = userEvent.setup();+ renderList();+ await screen.findByText(automation.name);++ const addTrigger = screen.getByTestId("automations-add-automation");+ expect(addTrigger).toHaveClass("bg-base-secondary");+ expect(+ screen.queryByTestId("automations-import-automation"),+ ).not.toBeInTheDocument();++ await user.click(addTrigger);+ expect(screen.getByTestId("automations-add-automation-menu")).not.toHaveClass(+ "mt-2",+ );+ expect(+ screen.getByTestId("automations-import-automation"),+ ).toBeInTheDocument();++ await user.click(screen.getByTestId("automations-add-automation-create"));+ expect(screen.getByTestId("add-automation-modal")).toBeInTheDocument();+ });++ it("opens the import picker from the Add Automation menu", async () => {+ const user = userEvent.setup();+ renderList();+ await screen.findByText(automation.name);++ await user.click(screen.getByTestId("automations-add-automation"));+ await user.click(screen.getByTestId("automations-import-automation"));++ const modal = screen.getByTestId("import-automation-modal");+ expect(modal).toHaveAttribute("data-view", "picker");+ expect(+ screen.getByTestId("import-automation-dropzone"),+ ).toBeInTheDocument();+ expect(+ screen.getByTestId("import-automation-choose-file"),+ ).toBeInTheDocument();+ });+});+describe("AutomationsList — list freshness on remount", () => {it("surfaces automations created since the last visit without a manual refresh", async () => {// Arrange — share a QueryClient across two mounts to simulate the userdiff --git a/__tests__/routes/automations-subpages-absent.test.tsx b/__tests__/routes/automations-subpages-absent.test.tsxindex 30fb0cd58a..245b0e994f 100644--- a/__tests__/routes/automations-subpages-absent.test.tsx+++ b/__tests__/routes/automations-subpages-absent.test.tsx@@ -105,7 +105,7 @@ describe("an interface manifest that declares no sub-page surface", () => {expect({nav: screen.queryByTestId("automations-navbar-desktop"),tile: screen.queryByTestId("overview-tile-automations"),- statusFilter: screen.queryByTestId("automations-filter-status"),+ statusFilter: screen.queryByTestId("automations-filters"),launcher: await screen.findByTestId("recommended-automations-section"),}).toMatchObject({ nav: null, tile: null, statusFilter: null });});diff --git a/__tests__/utils/extension-module-card-classes.test.ts b/__tests__/utils/extension-module-card-classes.test.tsindex b5a219a69c..91fbfd09d4 100644--- a/__tests__/utils/extension-module-card-classes.test.ts+++ b/__tests__/utils/extension-module-card-classes.test.ts@@ -5,6 +5,7 @@ import {extensionModuleCardGridClassName,extensionModuleCardGridContainerClassName,extensionModuleCardInteractiveClassName,+ extensionModuleCardPillClassName,extensionModuleCardSurfaceClassName,} from "#/utils/extension-module-card-classes";@@ -25,6 +26,12 @@ describe("extensionModuleCardSurface class", () => {});});+describe("extensionModuleCardPill class", () => {+ it("omits an outline so chips stay fill-only", () => {+ expect(extensionModuleCardPillClassName).not.toContain("border");+ });+});+describe("extensionModuleCardGrid classes", () => {it("uses a container query breakpoint at 600px column width", () => {expect(EXTENSION_MODULE_CARD_GRID_SINGLE_COLUMN_MAX_PX).toBe(599);diff --git a/__tests__/utils/recommended-automation-rail.test.ts b/__tests__/utils/recommended-automation-rail.test.tsnew file mode 100644index 0000000000..50243f46b4--- /dev/null+++ b/__tests__/utils/recommended-automation-rail.test.ts@@ -0,0 +1,92 @@+import { describe, expect, it } from "vitest";+import { AUTOMATION_CATALOG } from "@openhands/extensions/automations";+import { SETUP_REGISTRY } from "#/manifests/manifest-sources";+import {+ flattenRecommendedRailGroups,+ getRecommendedRailGroups,+ isCatalogAutomationAdded,+ isConversationLaunchAutomation,+ normalizeAutomationKey,+} from "#/utils/recommended-automation-rail";++const prReviewer = AUTOMATION_CATALOG.find(+ (entry) => entry.id === "github-pr-reviewer",+)!;+const slackStandup = AUTOMATION_CATALOG.find(+ (entry) => entry.id === "slack-standup-digest",+)!;+const upstreamFork = AUTOMATION_CATALOG.find(+ (entry) => entry.id === "upstream-fork-sync",+)!;++describe("recommended automation rail", () => {+ it("normalizes catalog ids and human titles to the same key", () => {+ expect(normalizeAutomationKey("GitHub Code Review Agent")).toBe(+ "github-code-review-agent",+ );+ expect(normalizeAutomationKey(" slack-standup-digest ")).toBe(+ "slack-standup-digest",+ );+ });++ it("treats an installed automation as added when the name matches id, title, or skill", () => {+ expect(+ isCatalogAutomationAdded(prReviewer, [+ { name: "GitHub Code Review Agent" },+ ]),+ ).toBe(true);+ expect(+ isCatalogAutomationAdded(prReviewer, [{ name: "github-pr-reviewer" }]),+ ).toBe(true);+ expect(+ isCatalogAutomationAdded(slackStandup, [{ name: "Daily digest" }]),+ ).toBe(false);+ });++ it("keeps proven workflows first and drops ones that have already been added", () => {+ const groups = getRecommendedRailGroups([+ { name: "GitHub Code Review Agent" },+ ]);++ expect(groups.proven.map((entry) => entry.id)).toEqual([+ "github-repo-monitor",+ "slack-channel-monitor",+ ]);+ });++ it("appends other useful automations that open in a new conversation", () => {+ const groups = getRecommendedRailGroups([]);+ const conversationIds = groups.conversation.map((entry) => entry.id);++ expect(groups.proven.map((entry) => entry.id)).toEqual([+ "github-pr-reviewer",+ "github-repo-monitor",+ "slack-channel-monitor",+ ]);+ expect(conversationIds).toEqual([+ "slack-standup-digest",+ "linear-triage-assistant",+ "jira-issue-to-pr",+ "research-brief-writer",+ ]);+ expect(conversationIds).not.toContain("upstream-fork-sync");+ expect(conversationIds).not.toContain("incident-retrospective-drafter");+ expect(isConversationLaunchAutomation(slackStandup)).toBe(true);+ expect(isConversationLaunchAutomation(upstreamFork)).toBe(false);+ expect(SETUP_REGISTRY.findById(upstreamFork.id)).not.toBeNull();+ });++ it("returns an empty rail when every recommended automation has been added", () => {+ const groups = getRecommendedRailGroups([+ { name: "GitHub Code Review Agent" },+ { name: "GitHub repository monitor" },+ { name: "Slack channel monitor" },+ { name: "Slack standup digest" },+ { name: "Linear issue triage assistant" },+ { name: "Jira issue to GitHub PR" },+ { name: "Research brief writer" },+ ]);++ expect(flattenRecommendedRailGroups(groups)).toEqual([]);+ });+});diff --git a/scripts/seed-automation-ux-data.mjs b/scripts/seed-automation-ux-data.mjsnew file mode 100644index 0000000000..a08e7ac835--- /dev/null+++ b/scripts/seed-automation-ux-data.mjs@@ -0,0 +1,810 @@+#!/usr/bin/env node+/**+ * Seed local automation UX data (list, filters, detail, run history).+ *+ * Usage:+ * node scripts/seed-automation-ux-data.mjs+ *+ * Env:+ * AUTOMATION_BASE_URL Ingress origin (default http://localhost:8100)+ * SESSION_API_KEY X-Session-API-Key (default ~/.openhands/agent-canvas/api-key.txt)+ * AUTOMATION_DB SQLite path (default .tmp/automation/automations.db)+ */++import { execFileSync } from "node:child_process";+import { readFileSync } from "node:fs";+import { homedir } from "node:os";+import { dirname, join, resolve } from "node:path";+import { fileURLToPath } from "node:url";+import { randomUUID } from "node:crypto";++const __dirname = dirname(fileURLToPath(import.meta.url));+const repoRoot = resolve(__dirname, "..");++const BASE_URL = (+ process.env.AUTOMATION_BASE_URL || "http://localhost:8100"+).replace(/\/$/, "");+const DB_PATH =+ process.env.AUTOMATION_DB ||+ join(repoRoot, ".tmp/automation/automations.db");+const API_KEY =+ process.env.SESSION_API_KEY ||+ readFileSync(+ join(homedir(), ".openhands/agent-canvas/api-key.txt"),+ "utf8",+ ).trim();++const hoursAgo = (hours) => new Date(Date.now() - hours * 3_600_000);++const SEEDS = [+ {+ name: "PR Triage Digest",+ prompt:+ "Review newly opened pull requests in acme/frontend-app, identify risky changes, summarize likely impact, and prepare a concise digest with priority ordering for the engineering review channel.",+ model: "triage-fast",+ timeout: 600,+ enabled: true,+ repos: [{ url: "acme/frontend-app", ref: "main", provider: "github" }],+ trigger: {+ type: "cron",+ schedule: "0 9 * * 1-5",+ timezone: "America/Los_Angeles",+ },+ scheduleHuman: "Weekdays at 09:00",+ lastTriggeredHoursAgo: 2,+ runs: [+ ["COMPLETED", 2, 0.42],+ ["COMPLETED", 26, 0.38],+ ["FAILED", 50, 0.11],+ ["COMPLETED", 74, 0.41],+ ["COMPLETED", 98, 0.36],+ ["COMPLETED", 170, 0.4],+ ["FAILED", 194, 0.09],+ ["COMPLETED", 218, 0.37],+ ["COMPLETED", 242, 0.39],+ ["COMPLETED", 266, 0.35],+ ],+ },+ {+ name: "Nightly Security Pass",+ prompt:+ "Scan the acme/backend-api repository for known security vulnerabilities, outdated dependencies, and insecure code patterns. Produce a prioritized remediation summary.",+ model: "security-careful",+ timeout: 900,+ enabled: true,+ repos: [{ url: "acme/backend-api", ref: "main", provider: "github" }],+ trigger: { type: "cron", schedule: "30 1 * * *", timezone: "UTC" },+ scheduleHuman: "Daily at 01:30",+ lastTriggeredHoursAgo: 8,+ runs: [+ ["COMPLETED", 8, 1.12],+ ["COMPLETED", 32, 1.05],+ ["COMPLETED", 56, 0.98],+ ["FAILED", 80, 0.22],+ ["COMPLETED", 104, 1.08],+ ],+ },+ {+ name: "Docs Sync on Push",+ prompt:+ "Monitor acme/docs for new pushes. For each push, generate a changelog-ready summary of what changed and why.",+ model: "docs-fast",+ enabled: true,+ repos: [{ url: "acme/docs", ref: "main", provider: "github" }],+ trigger: { type: "cron", schedule: "*/15 * * * *", timezone: "America/New_York" },+ scheduleHuman: "Every 15 minutes",+ lastTriggeredHoursAgo: 1,+ runs: [+ ["COMPLETED", 1, 0.08],+ ["CANCELLED", 18, null],+ ["SKIPPED", 42, null],+ ],+ },+ {+ name: "Release Readiness Review",+ prompt:+ "Compile a release readiness report: list open blockers, active incidents, and pending approvals for acme/realtime-service.",+ model: "release-review",+ enabled: false,+ repos: [{ url: "acme/realtime-service", ref: "release", provider: "github" }],+ trigger: { type: "cron", schedule: "0 11 * * 5", timezone: "America/Chicago" },+ scheduleHuman: "Fridays at 11:00",+ lastTriggeredHoursAgo: 14 * 24,+ runs: [+ ["FAILED", 14 * 24, null],+ ["COMPLETED", 21 * 24, 0.67],+ ],+ },+ {+ name: "Incident Webhook Summary",+ prompt:+ "Summarize incoming incident webhooks, categorize by severity, and post a digest to the on-call Slack channel.",+ model: "incident-summary",+ enabled: false,+ repos: [{ url: "acme/incident-service", ref: "main", provider: "github" }],+ trigger: { type: "cron", schedule: "0 */2 * * *", timezone: "UTC" },+ scheduleHuman: "Every 2 hours",+ lastTriggeredHoursAgo: null,+ runs: [],+ },+ {+ name: "PR Review on Open",+ prompt:+ "When a new PR is opened, perform a thorough code review focusing on correctness, security, and performance. Post findings as inline comments.",+ model: "review-fast",+ timeout: 1800,+ enabled: true,+ repos: [{ url: "acme/frontend-app", ref: "main", provider: "github" }],+ trigger: {+ type: "event",+ source: "github",+ on: "pull_request.opened",+ filter: "repository.full_name == 'acme/frontend-app'",+ },+ lastTriggeredHoursAgo: 3,+ runs: [+ ["COMPLETED", 3, 0.88],+ ["COMPLETED", 6, 0.79],+ ["FAILED", 20, 0.15],+ ["COMPLETED", 44, 0.81],+ ["COMPLETED", 68, 0.74],+ ],+ },+ {+ name: "Release Notes Generator",+ prompt:+ "Generate comprehensive release notes from the commits since the last release. Include breaking changes, new features, and bug fixes.",+ model: "docs-fast",+ enabled: true,+ repos: [{ url: "acme/backend-api", ref: "main", provider: "github" }],+ trigger: {+ type: "event",+ source: "github",+ on: "release.published",+ filter: "glob(release.tag_name, 'v*') && !release.prerelease",+ },+ lastTriggeredHoursAgo: 72,+ runs: [+ ["COMPLETED", 72, 0.54],+ ["COMPLETED", 240, 0.61],+ ],+ },+ {+ name: "Weekly Standup Digest",+ prompt:+ "Collect merged PRs, open incidents, and Linear tickets moved this week. Draft a standup digest for #eng-standup.",+ model: "standup-fast",+ enabled: true,+ repos: [{ url: "acme/frontend-app", ref: "main", provider: "github" }],+ trigger: { type: "cron", schedule: "0 9 * * 1", timezone: "America/Los_Angeles" },+ scheduleHuman: "Mondays at 09:00",+ lastTriggeredHoursAgo: 0.25,+ running: true,+ runs: [+ ["COMPLETED", 168, 0.29],+ ["COMPLETED", 336, 0.31],+ ["COMPLETED", 504, 0.27],+ ],+ },+ {+ name: "Slack Channel Monitor",+ prompt:+ "Watch #support for customer-reported regressions. When a thread looks like a product bug, file a Linear issue and link the Slack thread.",+ model: "support-fast",+ enabled: true,+ trigger: {+ type: "event",+ source: "slack",+ on: "message.channels",+ filter: "icontains(text, 'bug') || icontains(text, 'broken')",+ },+ lastTriggeredHoursAgo: 5,+ runs: [+ ["COMPLETED", 5, 0.19],+ ["COMPLETED", 12, 0.16],+ ["SKIPPED", 29, null],+ ["COMPLETED", 53, 0.21],+ ],+ },+ {+ name: "Dependabot Triage",+ prompt:+ "Review Dependabot PRs, group safe version bumps, and flag breaking major upgrades that need a human owner.",+ model: "triage-fast",+ enabled: true,+ repos: [{ url: "acme/backend-api", ref: "main", provider: "github" }],+ trigger: { type: "cron", schedule: "0 8 * * 1-5", timezone: "UTC" },+ scheduleHuman: "Weekdays at 08:00",+ lastTriggeredHoursAgo: 4,+ runs: [+ ["FAILED", 4, 0.07],+ ["FAILED", 28, 0.06],+ ["COMPLETED", 52, 0.33],+ ["FAILED", 76, 0.05],+ ],+ },+ {+ name: "Stale PR Nudge",+ prompt:+ "Find pull requests in acme/frontend-app that have had no review activity for 5 days. Post a polite nudge on the PR and summarize owners in #eng-reviews.",+ model: "triage-fast",+ enabled: true,+ repos: [{ url: "acme/frontend-app", ref: "main", provider: "github" }],+ trigger: { type: "cron", schedule: "0 10 * * 1-5", timezone: "America/Los_Angeles" },+ scheduleHuman: "Weekdays at 10:00",+ lastTriggeredHoursAgo: 6,+ runs: [+ ["COMPLETED", 6, 0.14],+ ["COMPLETED", 30, 0.12],+ ["COMPLETED", 54, 0.16],+ ["SKIPPED", 78, null],+ ],+ },+ {+ name: "Flaky Test Hunter",+ prompt:+ "Analyze the last 48 hours of CI on acme/frontend-app. Identify flaky tests, group by file, and open or update a tracking issue with reproduction hints.",+ model: "careful",+ timeout: 1200,+ enabled: true,+ repos: [{ url: "acme/frontend-app", ref: "main", provider: "github" }],+ trigger: { type: "cron", schedule: "0 7 * * *", timezone: "UTC" },+ scheduleHuman: "Daily at 07:00",+ lastTriggeredHoursAgo: 9,+ runs: [+ ["COMPLETED", 9, 1.44],+ ["FAILED", 33, 0.28],+ ["COMPLETED", 57, 1.31],+ ["COMPLETED", 81, 1.22],+ ],+ },+ {+ name: "License Compliance Sweep",+ prompt:+ "Scan acme/backend-api dependencies for GPL or unknown licenses. Produce a table of new findings since the last run.",+ model: "security-careful",+ enabled: true,+ repos: [{ url: "acme/backend-api", ref: "main", provider: "github" }],+ trigger: { type: "cron", schedule: "0 3 * * 1", timezone: "UTC" },+ scheduleHuman: "Mondays at 03:00",+ lastTriggeredHoursAgo: 20,+ runs: [+ ["COMPLETED", 20, 0.77],+ ["COMPLETED", 188, 0.81],+ ],+ },+ {+ name: "Changelog Drafter",+ prompt:+ "Draft this week's changelog for acme/docs from merged PRs labeled feature, fix, or breaking.",+ model: "docs-fast",+ enabled: true,+ repos: [{ url: "acme/docs", ref: "main", provider: "github" }],+ trigger: { type: "cron", schedule: "0 16 * * 5", timezone: "America/New_York" },+ scheduleHuman: "Fridays at 16:00",+ lastTriggeredHoursAgo: 48,+ runs: [+ ["COMPLETED", 48, 0.24],+ ["COMPLETED", 216, 0.22],+ ["CANCELLED", 384, null],+ ],+ },+ {+ name: "Broken Link Checker",+ prompt:+ "Crawl published docs in acme/docs, report broken internal and external links, and file issues for anything older than 7 days.",+ model: "docs-fast",+ enabled: false,+ repos: [{ url: "acme/docs", ref: "main", provider: "github" }],+ trigger: { type: "cron", schedule: "0 4 * * 0", timezone: "UTC" },+ scheduleHuman: "Sundays at 04:00",+ lastTriggeredHoursAgo: 36,+ runs: [+ ["FAILED", 36, null],+ ["COMPLETED", 204, 0.45],+ ],+ },+ {+ name: "Onboarding Buddy",+ prompt:+ "When a new engineer is added to the org, generate a first-week checklist from acme/handbook and post it to their Slack DM.",+ model: "standup-fast",+ enabled: true,+ repos: [{ url: "acme/handbook", ref: "main", provider: "github" }],+ trigger: {+ type: "event",+ source: "github",+ on: "membership.added",+ filter: "team.name == 'engineering'",+ },+ lastTriggeredHoursAgo: 96,+ runs: [+ ["COMPLETED", 96, 0.18],+ ],+ },+ {+ name: "Issue to Draft PR",+ prompt:+ "When a Linear issue is labeled 'ready-for-agent', create a draft PR in the linked repo with a first-pass implementation and a test plan.",+ model: "careful",+ timeout: 1800,+ enabled: true,+ repos: [{ url: "acme/backend-api", ref: "main", provider: "github" }],+ trigger: {+ type: "event",+ source: "linear",+ on: "issue.updated",+ filter: "contains(labels, 'ready-for-agent')",+ },+ lastTriggeredHoursAgo: 11,+ running: true,+ runs: [+ ["COMPLETED", 35, 2.18],+ ["FAILED", 59, 0.41],+ ["COMPLETED", 110, 1.96],+ ],+ },+ {+ name: "CI Failure Autopsy",+ prompt:+ "When a GitHub check suite fails on main, summarize the failing jobs, likely root cause, and whether this looks flaky or a real regression.",+ model: "careful",+ enabled: true,+ repos: [{ url: "acme/frontend-app", ref: "main", provider: "github" }],+ trigger: {+ type: "event",+ source: "github",+ on: "check_suite.completed",+ filter: "check_suite.conclusion == 'failure' && check_suite.head_branch == 'main'",+ },+ lastTriggeredHoursAgo: 1.5,+ runs: [+ ["COMPLETED", 1.5, 0.52],+ ["COMPLETED", 7, 0.48],+ ["FAILED", 14, 0.19],+ ["COMPLETED", 22, 0.55],+ ["COMPLETED", 31, 0.47],+ ],+ },+ {+ name: "Push Changelog Ping",+ prompt:+ "On every push to main in acme/docs, post a 3-bullet summary to #docs-updates.",+ model: "docs-fast",+ enabled: true,+ repos: [{ url: "acme/docs", ref: "main", provider: "github" }],+ trigger: {+ type: "event",+ source: "github",+ on: "push",+ filter: "ref == 'refs/heads/main'",+ },+ lastTriggeredHoursAgo: 0.8,+ runs: [+ ["COMPLETED", 0.8, 0.06],+ ["COMPLETED", 3.2, 0.05],+ ["SKIPPED", 5, null],+ ["COMPLETED", 9, 0.07],+ ["COMPLETED", 14, 0.06],+ ],+ },+ {+ name: "Review Comment Resolver",+ prompt:+ "When a reviewer leaves a comment containing '@openhands please fix', apply the requested change and reply with a summary of the edit.",+ model: "review-fast",+ timeout: 1500,+ enabled: true,+ repos: [{ url: "acme/frontend-app", ref: "main", provider: "github" }],+ trigger: {+ type: "event",+ source: "github",+ on: "pull_request_review_comment.created",+ filter: "icontains(comment.body, '@openhands please fix')",+ },+ lastTriggeredHoursAgo: 7,+ runs: [+ ["COMPLETED", 7, 0.63],+ ["COMPLETED", 19, 0.71],+ ["CANCELLED", 27, null],+ ],+ },+ {+ name: "Jira Bug to Repro",+ prompt:+ "When a Jira bug is moved to Ready, clone the linked repo, write a failing reproduction test, and attach the patch to the ticket.",+ model: "careful",+ enabled: false,+ repos: [{ url: "acme/realtime-service", ref: "main", provider: "github" }],+ trigger: {+ type: "event",+ source: "jira",+ on: "issue.updated",+ filter: "fields.status.name == 'Ready' && fields.issuetype.name == 'Bug'",+ },+ lastTriggeredHoursAgo: 60,+ runs: [+ ["FAILED", 60, 0.33],+ ],+ },+ {+ name: "Monthly Cost Report",+ prompt:+ "Summarize last month's LLM spend by automation, highlight outliers, and recommend timeouts or model changes.",+ model: "standup-fast",+ enabled: true,+ trigger: { type: "cron", schedule: "0 9 1 * *", timezone: "America/Los_Angeles" },+ scheduleHuman: "1st of the month at 09:00",+ lastTriggeredHoursAgo: 240,+ runs: [+ ["COMPLETED", 240, 0.31],+ ["COMPLETED", 960, 0.28],+ ],+ },+ {+ name: "Weekend On-call Brief",+ prompt:+ "Friday afternoon: compile open Sev-1/Sev-2 incidents, recent deploys, and a rollback cheat sheet for the weekend on-call.",+ model: "incident-summary",+ enabled: true,+ repos: [{ url: "acme/incident-service", ref: "main", provider: "github" }],+ trigger: { type: "cron", schedule: "0 16 * * 5", timezone: "America/Los_Angeles" },+ scheduleHuman: "Fridays at 16:00",+ lastTriggeredHoursAgo: 50,+ runs: [+ ["COMPLETED", 50, 0.39],+ ["COMPLETED", 218, 0.41],+ ["COMPLETED", 386, 0.36],+ ],+ },+ {+ name: "i18n Drift Check",+ prompt:+ "Compare src/i18n/translation.json keys against English source strings. List missing translations and unused keys.",+ model: "docs-fast",+ enabled: true,+ repos: [{ url: "acme/frontend-app", ref: "main", provider: "github" }],+ trigger: { type: "cron", schedule: "30 6 * * 1-5", timezone: "UTC" },+ scheduleHuman: "Weekdays at 06:30",+ lastTriggeredHoursAgo: 12,+ runs: [+ ["COMPLETED", 12, 0.17],+ ["COMPLETED", 36, 0.15],+ ["FAILED", 60, 0.04],+ ["COMPLETED", 84, 0.16],+ ],+ },+ {+ name: "Coverage Gate Watcher",+ prompt:+ "If a PR drops line coverage by more than 1%, comment with the files responsible and suggested tests.",+ model: "review-fast",+ enabled: true,+ repos: [{ url: "acme/backend-api", ref: "main", provider: "github" }],+ trigger: {+ type: "event",+ source: "github",+ on: "pull_request.synchronize",+ filter: "repository.full_name == 'acme/backend-api'",+ },+ lastTriggeredHoursAgo: 4.5,+ runs: [+ ["COMPLETED", 4.5, 0.27],+ ["SKIPPED", 8, null],+ ["COMPLETED", 16, 0.29],+ ["COMPLETED", 28, 0.25],+ ],+ },+ {+ name: "Draft PR Reminder",+ prompt:+ "Find draft PRs older than 10 days. Ask the author if they still intend to ship, and close with a comment if they agree.",+ model: "triage-fast",+ enabled: false,+ repos: [{ url: "acme/frontend-app", ref: "main", provider: "github" }],+ trigger: { type: "cron", schedule: "0 12 * * 3", timezone: "America/Los_Angeles" },+ scheduleHuman: "Wednesdays at 12:00",+ lastTriggeredHoursAgo: null,+ runs: [],+ },+ {+ name: "Design Token Audit",+ prompt:+ "Scan acme/frontend-app for hardcoded hex colors and spacing values that should use design tokens. Group by file and suggest replacements.",+ model: "docs-fast",+ enabled: true,+ repos: [{ url: "acme/frontend-app", ref: "main", provider: "github" }],+ trigger: { type: "cron", schedule: "0 5 * * 2", timezone: "UTC" },+ scheduleHuman: "Tuesdays at 05:00",+ lastTriggeredHoursAgo: 70,+ runs: [+ ["COMPLETED", 70, 0.58],+ ["COMPLETED", 238, 0.62],+ ],+ },+ {+ name: "Sentry Spike Explainer",+ prompt:+ "When Sentry error volume spikes 3x hour-over-hour, explain the top stack traces and whether a recent deploy is implicated.",+ model: "incident-summary",+ enabled: true,+ trigger: {+ type: "event",+ source: "sentry",+ on: "metric.alert",+ filter: "alert.name == 'error-volume-spike'",+ },+ lastTriggeredHoursAgo: 15,+ runs: [+ ["COMPLETED", 15, 0.44],+ ["FAILED", 40, 0.12],+ ["COMPLETED", 90, 0.49],+ ],+ },+ {+ name: "GitLab MR Review",+ prompt:+ "Review newly opened merge requests in acme/data-platform. Focus on SQL safety, partition filters, and cost of full-table scans.",+ model: "review-fast",+ timeout: 1800,+ enabled: true,+ repos: [{ url: "acme/data-platform", ref: "main", provider: "gitlab" }],+ trigger: {+ type: "event",+ source: "gitlab",+ on: "merge_request.opened",+ },+ lastTriggeredHoursAgo: 18,+ runs: [+ ["COMPLETED", 18, 0.91],+ ["COMPLETED", 41, 0.84],+ ["COMPLETED", 73, 0.88],+ ],+ },+ {+ name: "Bitbucket Nightly Diff",+ prompt:+ "Summarize commits landed in acme/legacy-billing since yesterday and flag schema migrations.",+ model: "triage-fast",+ enabled: true,+ repos: [{ url: "acme/legacy-billing", ref: "master", provider: "bitbucket" }],+ trigger: { type: "cron", schedule: "0 2 * * *", timezone: "UTC" },+ scheduleHuman: "Daily at 02:00",+ lastTriggeredHoursAgo: 13,+ runs: [+ ["COMPLETED", 13, 0.21],+ ["COMPLETED", 37, 0.19],+ ["FAILED", 61, null],+ ["COMPLETED", 85, 0.2],+ ],+ },+ {+ name: "Customer Quote Miner",+ prompt:+ "Read #win-stories and #support. Extract reusable customer quotes and file them in acme/handbook/sales-quotes.md.",+ model: "standup-fast",+ enabled: false,+ repos: [{ url: "acme/handbook", ref: "main", provider: "github" }],+ trigger: { type: "cron", schedule: "0 15 * * 5", timezone: "America/New_York" },+ scheduleHuman: "Fridays at 15:00",+ lastTriggeredHoursAgo: 400,+ runs: [+ ["COMPLETED", 400, 0.13],+ ],+ },+ {+ name: "Pending Dispatch Smoke",+ prompt:+ "No-op smoke automation used to preview a queued PENDING run in the activity log.",+ model: "fast",+ enabled: true,+ trigger: { type: "cron", schedule: "0 * * * *", timezone: "UTC" },+ scheduleHuman: "Hourly",+ lastTriggeredHoursAgo: 0.05,+ pending: true,+ runs: [+ ["COMPLETED", 1.1, 0.03],+ ["COMPLETED", 2.1, 0.03],+ ],+ },+];++function toHexUuid(id) {+ return id.replaceAll("-", "");+}++function sqlQuote(value) {+ if (value == null) return "NULL";+ if (typeof value === "number") return String(value);+ return `'${String(value).replaceAll("'", "''")}'`;+}++function sqlite(sql) {+ return execFileSync("sqlite3", [DB_PATH, sql], { encoding: "utf8" }).trim();+}++async function api(path, { method = "GET", body } = {}) {+ const response = await fetch(`${BASE_URL}${path}`, {+ method,+ headers: {+ "X-Session-API-Key": API_KEY,+ "Content-Type": "application/json",+ },+ ...(body !== undefined ? { body: JSON.stringify(body) } : {}),+ });+ const text = await response.text();+ let data = null;+ if (text) {+ try {+ data = JSON.parse(text);+ } catch {+ data = text;+ }+ }+ if (!response.ok) {+ throw new Error(+ `${method} ${path} failed (${response.status}): ${typeof data === "string" ? data : JSON.stringify(data)}`,+ );+ }+ return data;+}++async function deleteExistingSeeds() {+ const list = await api("/api/automation/v1?limit=100");+ const names = new Set(["_probe", ...SEEDS.map((seed) => seed.name)]);+ for (const automation of list.automations ?? []) {+ if (!names.has(automation.name)) continue;+ await api(`/api/automation/v1/${automation.id}`, { method: "DELETE" });+ console.log(`deleted ${automation.name}`);+ }+}++function insertRuns(automationId, seed) {+ const hexAutomationId = toHexUuid(automationId);+ const rows = [];++ if (seed.running || seed.pending) {+ const started = hoursAgo(seed.pending ? 0.05 : 0.25);+ const timeout = new Date(Date.now() + 7 * 86_400_000);+ rows.push({+ id: toHexUuid(randomUUID()),+ status: seed.pending ? "PENDING" : "RUNNING",+ error: null,+ started,+ completed: null,+ conversationId: seed.pending+ ? null+ : `conv-ux-${toHexUuid(randomUUID()).slice(0, 8)}`,+ bashCommandId: seed.pending+ ? null+ : `cmd-ux-${toHexUuid(randomUUID()).slice(0, 8)}`,+ cost: null,+ timeout,+ });+ }++ for (const [status, hours, cost] of seed.runs) {+ const started = hoursAgo(hours);+ const durationMs =+ status === "SKIPPED" ? 8_000 : 90_000 + Math.round(Math.random() * 180_000);+ const completed =+ status === "RUNNING" ? null : new Date(started.getTime() + durationMs);+ const failedBeforeSandbox = status === "FAILED" && cost == null;+ rows.push({+ id: toHexUuid(randomUUID()),+ status,+ error:+ status === "FAILED"+ ? failedBeforeSandbox+ ? "Sandbox provisioning failed: no available runtime"+ : "Process exited with code 1"+ : null,+ started,+ completed,+ conversationId: failedBeforeSandbox+ ? null+ : `conv-ux-${toHexUuid(randomUUID()).slice(0, 8)}`,+ bashCommandId: failedBeforeSandbox+ ? null+ : `cmd-ux-${toHexUuid(randomUUID()).slice(0, 8)}`,+ cost,+ timeout: null,+ });+ }++ for (const row of rows) {+ sqlite(`+ INSERT INTO automation_runs (+ id, automation_id, status, error_detail, created_at, started_at,+ completed_at, conversation_id, timeout_at, sandbox_id, event_payload,+ bash_command_id, telemetry_distinct_id, cost+ ) VALUES (+ ${sqlQuote(row.id)},+ ${sqlQuote(hexAutomationId)},+ ${sqlQuote(row.status)},+ ${sqlQuote(row.error)},+ ${sqlQuote(row.started.toISOString())},+ ${sqlQuote(row.started.toISOString())},+ ${sqlQuote(row.completed ? row.completed.toISOString() : null)},+ ${sqlQuote(row.conversationId)},+ ${sqlQuote(row.timeout ? row.timeout.toISOString() : null)},+ ${sqlQuote(row.conversationId ? `sbx-ux-${row.id.slice(0, 8)}` : null)},+ NULL,+ ${sqlQuote(row.bashCommandId)},+ NULL,+ ${sqlQuote(row.cost)}+ );+ `);+ }++ return rows.length;+}++function decorateAutomation(automationId, seed) {+ const hexId = toHexUuid(automationId);+ const trigger = {+ ...seed.trigger,+ ...(seed.scheduleHuman ? { schedule_human: seed.scheduleHuman } : {}),+ };+ const lastTriggered =+ seed.lastTriggeredHoursAgo == null+ ? null+ : hoursAgo(seed.lastTriggeredHoursAgo).toISOString();++ sqlite(`+ UPDATE automations+ SET+ trigger = ${sqlQuote(JSON.stringify(trigger))},+ last_triggered_at = ${sqlQuote(lastTriggered)},+ updated_at = ${sqlQuote(new Date().toISOString())}+ WHERE id = ${sqlQuote(hexId)};+ `);+}++async function createSeed(seed) {+ const created = await api("/api/automation/v1/preset/prompt", {+ method: "POST",+ body: {+ name: seed.name,+ prompt: seed.prompt,+ trigger: seed.trigger,+ ...(seed.model ? { model: seed.model } : {}),+ ...(seed.timeout != null ? { timeout: seed.timeout } : {}),+ ...(seed.repos ? { repos: seed.repos } : {}),+ },+ });++ if (created.enabled !== seed.enabled) {+ await api(`/api/automation/v1/${created.id}`, {+ method: "PATCH",+ body: { enabled: seed.enabled },+ });+ }++ decorateAutomation(created.id, seed);+ const runCount = insertRuns(created.id, seed);+ console.log(+ `seeded ${seed.name} (${created.id}) — ${runCount} runs, enabled=${seed.enabled}`,+ );+ return created;+}++async function main() {+ const health = await api("/api/automation/health");+ if (health.status !== "ok") {+ throw new Error(`Automation backend is not healthy: ${JSON.stringify(health)}`);+ }++ await deleteExistingSeeds();+ for (const seed of SEEDS) {+ await createSeed(seed);+ }++ const list = await api("/api/automation/v1?limit=100");+ console.log(`\n${list.total} automations ready at ${BASE_URL}/automations`);+}++main().catch((error) => {+ console.error(error.message);+ process.exit(1);+});diff --git a/src/components/features/automations/add-automation-menu.tsx b/src/components/features/automations/add-automation-menu.tsxnew file mode 100644index 0000000000..9edfeb53ae--- /dev/null+++ b/src/components/features/automations/add-automation-menu.tsx@@ -0,0 +1,151 @@+import { useEffect, useLayoutEffect, useRef, useState } from "react";+import ReactDOM from "react-dom";+import { ChevronDown, FileUp, Plus } from "lucide-react";+import { useTranslation } from "react-i18next";+import { ContextMenuListItem } from "#/components/features/context-menu/context-menu-list-item";+import { BrandButton } from "#/components/features/settings/brand-button";+import { I18nKey } from "#/i18n/declaration";+import { ContextMenu } from "#/ui/context-menu";+import { KebabMenuItemContent } from "./kebab-menu-item-content";++interface AddAutomationMenuProps {+ onAdd: () => void;+ onImport: () => void;+ isAddDisabled?: boolean;+}++export function AddAutomationMenu({+ onAdd,+ onImport,+ isAddDisabled = false,+}: AddAutomationMenuProps) {+ const { t } = useTranslation("openhands");+ const [open, setOpen] = useState(false);+ const [portalStyle, setPortalStyle] = useState<React.CSSProperties>();+ const triggerRef = useRef<HTMLButtonElement>(null);+ const menuRef = useRef<HTMLUListElement>(null);++ useLayoutEffect(() => {+ if (!open || !triggerRef.current) return undefined;++ const updatePosition = () => {+ const rect = triggerRef.current?.getBoundingClientRect();+ if (!rect) return;++ setPortalStyle({+ position: "fixed",+ zIndex: 9999,+ top: rect.bottom + 2,+ right: window.innerWidth - rect.right,+ });+ };++ updatePosition();+ window.addEventListener("resize", updatePosition);+ window.addEventListener("scroll", updatePosition, true);+ return () => {+ window.removeEventListener("resize", updatePosition);+ window.removeEventListener("scroll", updatePosition, true);+ };+ }, [open]);++ useEffect(() => {+ if (!open) return undefined;++ const handleClickOutside = (event: MouseEvent) => {+ const target = event.target as Node;+ if (+ triggerRef.current?.contains(target) ||+ menuRef.current?.contains(target)+ ) {+ return;+ }+ setOpen(false);+ };++ const handleEscape = (event: KeyboardEvent) => {+ if (event.key === "Escape") {+ setOpen(false);+ }+ };++ document.addEventListener("mousedown", handleClickOutside);+ document.addEventListener("keydown", handleEscape);+ return () => {+ document.removeEventListener("mousedown", handleClickOutside);+ document.removeEventListener("keydown", handleEscape);+ };+ }, [open]);++ const closeAnd = (action: () => void) => {+ action();+ setOpen(false);+ };++ const menu =+ open && portalStyle ? (+ <ContextMenu+ ref={menuRef}+ testId="automations-add-automation-menu"+ theme="popover"+ position="none"+ alignment="none"+ spacing="none"+ className="min-w-[10rem]"+ >+ <li>+ <ContextMenuListItem+ testId="automations-add-automation-create"+ isDisabled={isAddDisabled}+ className="group"+ onClick={() => {+ if (isAddDisabled) return;+ closeAnd(onAdd);+ }}+ >+ <KebabMenuItemContent+ icon={<Plus className="size-4" aria-hidden />}+ label={t(I18nKey.AUTOMATIONS$CREATE_AUTOMATION_BUTTON)}+ />+ </ContextMenuListItem>+ </li>+ <li>+ <ContextMenuListItem+ testId="automations-import-automation"+ className="group"+ onClick={() => closeAnd(onImport)}+ >+ <KebabMenuItemContent+ icon={<FileUp className="size-4" aria-hidden />}+ label={t(I18nKey.AUTOMATIONS$IMPORT)}+ />+ </ContextMenuListItem>+ </li>+ </ContextMenu>+ ) : null;++ return (+ <>+ <BrandButton+ ref={triggerRef}+ type="button"+ variant="secondary"+ testId="automations-add-automation"+ className="whitespace-nowrap"+ aria-haspopup="menu"+ aria-expanded={open}+ onClick={() => setOpen((current) => !current)}+ >+ {t(I18nKey.AUTOMATIONS$ADD_AUTOMATION)}+ <ChevronDown className="size-4 shrink-0" aria-hidden />+ </BrandButton>++ {open && portalStyle && typeof document !== "undefined"+ ? ReactDOM.createPortal(+ <div style={portalStyle}>{menu}</div>,+ document.body,+ )+ : null}+ </>+ );+}diff --git a/src/components/features/automations/automation-action-button-classes.ts b/src/components/features/automations/automation-action-button-classes.tsindex 532a8aef7e..5409644dad 100644--- a/src/components/features/automations/automation-action-button-classes.ts+++ b/src/components/features/automations/automation-action-button-classes.ts@@ -5,9 +5,3 @@ export const automationIconActionButtonClassName = cn("inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-interactive-hover hover:text-white focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-muted",dropdownInstantColorClassName,);--/** Text + icon Run now control on automation grid cards (matches kebab height). */-export const automationRunNowTextButtonClassName = cn(- "inline-flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-md border-0 bg-transparent px-2 text-xs text-muted hover:bg-interactive-hover hover:text-white focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-muted",- dropdownInstantColorClassName,-);diff --git a/src/components/features/automations/automation-card-skeleton.tsx b/src/components/features/automations/automation-card-skeleton.tsxindex a583cf28e8..c447abe2b4 100644--- a/src/components/features/automations/automation-card-skeleton.tsx+++ b/src/components/features/automations/automation-card-skeleton.tsx@@ -8,14 +8,19 @@ export function AutomationCardSkeleton() {><div className="flex items-start justify-between"><div className="h-5 w-40 animate-pulse rounded bg-surface-raised" />- <div className="h-5 w-10 animate-pulse rounded-full bg-surface-raised" />+ <div className="size-8 animate-pulse rounded-md bg-surface-raised" /></div><div className="mt-2 h-4 w-72 animate-pulse rounded bg-surface-raised" />- <div className="mt-4 flex gap-2">+ <div className="mt-3 flex gap-2">+ <div className="h-5 w-20 animate-pulse rounded-full bg-surface-raised" />+ <div className="h-5 w-24 animate-pulse rounded bg-surface-raised" />+ </div>+ <div className="mt-3 flex gap-2"><div className="h-7 w-32 animate-pulse rounded-full bg-surface-raised" /><div className="h-7 w-28 animate-pulse rounded-full bg-surface-raised" /><div className="h-7 w-24 animate-pulse rounded-full bg-surface-raised" /></div>+ <div className="mt-3 h-9 animate-pulse rounded-md bg-surface-raised" /></div>);}diff --git a/src/components/features/automations/automation-card.tsx b/src/components/features/automations/automation-card.tsxindex a75c0cc650..2b2de25038 100644--- a/src/components/features/automations/automation-card.tsx+++ b/src/components/features/automations/automation-card.tsx@@ -1,29 +1,36 @@+import { Tooltip } from "@heroui/react";import { useMemo } from "react";import { useTranslation } from "react-i18next";import { I18nKey } from "#/i18n/declaration";import type { Automation } from "#/types/automation";+import { AutomationRunStatus } from "#/types/automation";import { KebabMenu } from "./kebab-menu";import { useHasPermission } from "#/hooks/use-has-permission";import { useNavigation } from "#/context/navigation-context";import PlayIcon from "#/icons/play.svg?react";-import ClockIcon from "#/icons/clock.svg?react";-import { Zap } from "lucide-react";import { SkillCardPillRow } from "#/components/features/skills/skill-card-pill-row";+import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";import { cn } from "#/utils/utils";+import { formatRelativeTime } from "#/utils/format-relative-time";+import { buildAutomationMetadataPills } from "./build-automation-pills";+import { buildAutomationMenuItems } from "./build-automation-menu-items";+import { automationIconActionButtonClassName } from "./automation-action-button-classes";+import { AutomationRunStats } from "./automation-run-insights";+import { automationCardStatusStripClassName } from "./automation-view-mode";import {extensionModuleCardInteractiveClassName,extensionModuleCardSurfaceClassName,} from "#/utils/extension-module-card-classes";-import { buildAutomationMetadataPills } from "./build-automation-pills";-import { buildAutomationMenuItems } from "./build-automation-menu-items";-import { automationRunNowTextButtonClassName } from "./automation-action-button-classes";-import { AutomationHealthBadge } from "./automation-health-badge";-import { AutomationRunStats, lastRunText } from "./automation-run-insights";-import {- deriveAutomationHealth,- type RunSummaryState,-} from "#/manifests/automation-insights";+import { toLatestRunState } from "./to-latest-run-state";+import { RunStatusBadge } from "./detail/run-status-badge";+import { AutomationRunActivitySparkline } from "#/components/features/home/featured-automations/automation-run-activity-sparkline";+import type { RunSummaryState } from "#/manifests/automation-insights";import type { InterfaceListInsights } from "#/manifests/types";+import {+ getLastRunTimestamp,+ shortenAutomationErrorDetail,+ shouldShowAutomationErrorHovercard,+} from "#/components/features/home/featured-automations/automation-run-health";/** Run insights shown when the manifest declares the dashboard surface. */export interface AutomationInsightsProps {@@ -53,7 +60,7 @@ export function AutomationCard({insights,}: AutomationCardProps) {const { navigate } = useNavigation();- const { t } = useTranslation("openhands");+ const { t, i18n } = useTranslation("openhands");const canManage = useHasPermission("manage_automations");const scheduleLabel =@@ -80,89 +87,173 @@ export function AutomationCard({onDelete,});- const handleCardClick = () => {- handleView();- };+ const runState = toLatestRunState(insights?.state);+ const { latestRun, recentRuns, isLoading, isError } = runState;+ const timestamp = latestRun ? getLastRunTimestamp(latestRun) : null;+ const errorDetail =+ latestRun?.status === AutomationRunStatus.FAILED+ ? latestRun.error_detail?.trim() || null+ : null;+ const shortErrorDetail = errorDetail+ ? shortenAutomationErrorDetail(errorDetail)+ : null;+ const showErrorHovercard =+ errorDetail != null &&+ shortErrorDetail != null &&+ shouldShowAutomationErrorHovercard(errorDetail, shortErrorDetail);+ const disableAnimation = import.meta.env.MODE === "test";return (<divrole="link"tabIndex={0}data-testid={`automation-card-${automation.id}`}- onClick={handleCardClick}- onKeyDown={(e) => {- if (e.key === "Enter") handleCardClick();+ onClick={handleView}+ onKeyDown={(event) => {+ if (event.key === "Enter") handleView();}}className={cn(- "flex min-w-0 flex-col gap-3 overflow-hidden p-4 text-left",+ "group relative flex min-w-0 flex-col overflow-hidden p-4 text-left",extensionModuleCardSurfaceClassName,extensionModuleCardInteractiveClassName,)}>- <header className="flex items-start justify-between gap-3">- <div className="flex min-w-0 flex-1 flex-col gap-1.5">- <h3 className="flex items-center gap-2 truncate text-sm font-semibold text-white">- {automation.trigger.type === "event" ? (- <Zap className="size-4 shrink-0 text-muted" aria-hidden="true" />- ) : (- <ClockIcon className="size-4 shrink-0 text-muted" />- )}- <span className="truncate">{automation.name}</span>+ <header className="flex flex-col gap-1.5">+ <div className="flex h-8 items-center justify-between gap-3">+ <h3 className="min-w-0 flex-1 truncate text-sm font-semibold leading-none text-[var(--oh-foreground)]">+ {automation.name}</h3>- {automation.prompt ? (- <p className="line-clamp-2 text-xs leading-relaxed text-tertiary-light">- {automation.prompt}- </p>- ) : null}+ <div className="flex shrink-0 items-center gap-0.5">+ {canManage ? (+ <StyledTooltip+ content={t(I18nKey.AUTOMATIONS$RUN_NOW)}+ placement="top"+ >+ <button+ type="button"+ data-testid={`automation-run-now-${automation.id}`}+ aria-label={t(I18nKey.AUTOMATIONS$RUN_NOW)}+ aria-busy={isRunPending}+ disabled={isRunPending || !automation.enabled}+ onClick={(event) => {+ event.stopPropagation();+ onRunNow(automation.id);+ }}+ className={automationIconActionButtonClassName}+ >+ <PlayIcon className="size-4 shrink-0" aria-hidden />+ </button>+ </StyledTooltip>+ ) : null}+ <KebabMenu+ items={menuItems}+ triggerClassName="opacity-70 group-hover:opacity-100"+ />+ </div></div>+ {automation.prompt ? (+ <p className="line-clamp-2 text-xs leading-relaxed text-[var(--oh-text-secondary)]">+ {automation.prompt}+ </p>+ ) : null}+ </header>- <div className="flex shrink-0 items-center gap-0.5">- {canManage ? (- <button- type="button"- data-testid={`automation-run-now-${automation.id}`}- aria-busy={isRunPending}- disabled={isRunPending || !automation.enabled}- onClick={(event) => {- event.stopPropagation();- onRunNow(automation.id);- }}- className={automationRunNowTextButtonClassName}- >- <PlayIcon className="size-3.5 shrink-0" aria-hidden />- {t(I18nKey.AUTOMATIONS$RUN_NOW)}- </button>+ {pills.length > 0 || recentRuns.length > 0 ? (+ <div+ className={cn(+ "mt-3 flex items-center gap-3",+ pills.length > 0 ? "justify-between" : "justify-end",+ )}+ >+ {pills.length > 0 ? (+ <div className="min-w-0 flex-1 overflow-hidden">+ <SkillCardPillRow+ pills={pills}+ testId={`automation-pills-${automation.id}`}+ />+ </div>+ ) : null}+ {recentRuns.length > 0 ? (+ <AutomationRunActivitySparkline+ automationId={automation.id}+ runs={recentRuns}+ testId={`automation-activity-${automation.id}`}+ />) : null}- <KebabMenu items={menuItems} /></div>- </header>+ ) : null}{insights ? (- <div className="flex flex-wrap items-center gap-2 text-xs text-muted">- <AutomationHealthBadge- health={deriveAutomationHealth(automation, insights.state)}- labels={insights.spec.health}- />- <span data-testid={`automation-last-run-${automation.id}`}>- {`${insights.spec.lastRun.label} ${lastRunText(- insights.state?.summary?.latestRun?.started_at ??- automation.last_triggered_at,- insights.spec.lastRun,- t(I18nKey.CONVERSATION$AGO),- )}`}- </span>- </div>- ) : null}+ <div className={automationCardStatusStripClassName}>+ <div className="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">+ {isLoading ? (+ <div+ className="h-3.5 w-3/4 animate-pulse rounded bg-surface-raised motion-reduce:animate-none"+ aria-hidden="true"+ />+ ) : null}++ {!isLoading && isError ? (+ <p className="truncate text-[var(--oh-text-secondary)]">+ {t(I18nKey.FEATURED_AUTOMATIONS$STATUS_UNAVAILABLE)}+ </p>+ ) : null}++ {!isLoading && !isError && !latestRun ? (+ <p className="truncate text-[var(--oh-text-secondary)]">+ {t(I18nKey.AUTOMATIONS$DETAIL$NO_RUNS)}+ </p>+ ) : null}++ {latestRun ? (+ <>+ <RunStatusBadge status={latestRun.status} iconOnly showLabel />- {pills.length > 0 ? (- <SkillCardPillRow- pills={pills}- testId={`automation-pills-${automation.id}`}- />+ {shortErrorDetail ? (+ showErrorHovercard && errorDetail ? (+ <Tooltip+ content={+ <p className="max-w-xs whitespace-pre-wrap break-words p-2 text-xs">+ {errorDetail}+ </p>+ }+ placement="top"+ closeDelay={100}+ disableAnimation={disableAnimation}+ className="rounded-xl border border-[var(--oh-border)] bg-base-secondary p-0 text-white shadow-xl"+ >+ <span className="min-w-0 flex-1 cursor-default truncate text-[var(--oh-status-error)]">+ {shortErrorDetail}+ </span>+ </Tooltip>+ ) : (+ <p className="min-w-0 flex-1 truncate text-[var(--oh-status-error)]">+ {shortErrorDetail}+ </p>+ )+ ) : null}+ </>+ ) : null}+ </div>++ {timestamp ? (+ <span+ data-testid={`automation-last-run-${automation.id}`}+ className="shrink-0 text-[var(--oh-text-secondary)]"+ >+ {formatRelativeTime(timestamp, i18n.language, t)}+ </span>+ ) : null}+ </div>) : null}{insights ? (- <AutomationRunStats state={insights.state} copy={insights.spec.stats} />+ <div className="mt-3">+ <AutomationRunStats+ state={insights.state}+ copy={insights.spec.stats}+ />+ </div>) : null}</div>);diff --git a/src/components/features/automations/automation-group.tsx b/src/components/features/automations/automation-group.tsxindex 85e9006c04..017dc24f50 100644--- a/src/components/features/automations/automation-group.tsx+++ b/src/components/features/automations/automation-group.tsx@@ -4,7 +4,7 @@ import { AutomationCard } from "./automation-card";import { AutomationListRow } from "./automation-list-row";import { StatusBadge } from "./status-badge";import {- automationListTableClassName,+ automationActivityListClassName,type AutomationViewMode,} from "./automation-view-mode";import {@@ -79,41 +79,26 @@ export function AutomationGroup({</div></div>) : (- <div- className={cn(- automationListTableClassName,- "mt-3",- insights && "@container",- )}- >- <table- className={cn(- "w-full min-w-full [&>tbody>tr:first-child]:border-t-0",- insights && "table-fixed",- )}- >- <tbody>- {automations.map((automation) => (- <AutomationListRow- key={automation.id}- automation={automation}- onToggle={onToggle}- onRunNow={onRunNow}- isRunPending={runPendingId === automation.id}- onDelete={onDelete}- onExport={onExport}- onEdit={onEdit}- insights={- insights && {- spec: insights.spec,- state: insights.byId.get(automation.id),- }- }- />- ))}- </tbody>- </table>- </div>+ <ul className={cn(automationActivityListClassName, "mt-3")}>+ {automations.map((automation) => (+ <AutomationListRow+ key={automation.id}+ automation={automation}+ onToggle={onToggle}+ onRunNow={onRunNow}+ isRunPending={runPendingId === automation.id}+ onDelete={onDelete}+ onExport={onExport}+ onEdit={onEdit}+ insights={+ insights && {+ spec: insights.spec,+ state: insights.byId.get(automation.id),+ }+ }+ />+ ))}+ </ul>)}</section>);diff --git a/src/components/features/automations/automation-list-row.tsx b/src/components/features/automations/automation-list-row.tsxindex cdb49c61c3..80a1a59d47 100644--- a/src/components/features/automations/automation-list-row.tsx+++ b/src/components/features/automations/automation-list-row.tsx@@ -1,31 +1,38 @@-import { useMemo } from "react";+import { Tooltip } from "@heroui/react";import { useTranslation } from "react-i18next";+import { Zap } from "lucide-react";import { I18nKey } from "#/i18n/declaration";import type { Automation } from "#/types/automation";import { KebabMenu } from "./kebab-menu";import { useHasPermission } from "#/hooks/use-has-permission";import { useNavigation } from "#/context/navigation-context";+import { NavigationLink } from "#/components/shared/navigation-link";import PlayIcon from "#/icons/play.svg?react";import ClockIcon from "#/icons/clock.svg?react";-import { Zap } from "lucide-react";import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";-import { SkillCardPillRow } from "#/components/features/skills/skill-card-pill-row";import { cn } from "#/utils/utils";+import { formatRelativeTime } from "#/utils/format-relative-time";+import { extensionModuleCardPillClassName } from "#/utils/extension-module-card-classes";import { automationIconActionButtonClassName } from "./automation-action-button-classes";-import { buildAutomationMetadataPills } from "./build-automation-pills";import { buildAutomationMenuItems } from "./build-automation-menu-items";+import { automationActivityRowClassName } from "./automation-view-mode";+import { RunStatusBadge } from "./detail/run-status-badge";+import { AutomationRunActivitySparkline } from "#/components/features/home/featured-automations/automation-run-activity-sparkline";+import { AutomationHealthIndicator } from "#/components/features/home/featured-automations/automation-health-indicator";import {- automationListRowClassName,- automationListCellClassName,-} from "./automation-view-mode";-import { AutomationHealthBadge } from "./automation-health-badge";+ HomeAutomationRunTooltip,+ getRunStatusLabelKey,+} from "#/components/features/home/featured-automations/home-automation-run-tooltip";import {- averageDurationDisplay,- lastRunText,- runCountDisplay,-} from "./automation-run-insights";-import { deriveAutomationHealth } from "#/manifests/automation-insights";+ deriveRunHealth,+ formatTriggerSourceLabel,+ getLastRunTimestamp,+ getTriggerEventLabel,+ getTriggerScheduleLabel,+ getTriggerSource,+} from "#/components/features/home/featured-automations/automation-run-health";import type { AutomationInsightsProps } from "./automation-card";+import { toLatestRunState } from "./to-latest-run-state";interface AutomationListRowProps {automation: Automation;@@ -49,16 +56,9 @@ export function AutomationListRow({insights,}: AutomationListRowProps) {const { navigate } = useNavigation();- const { t } = useTranslation("openhands");+ const { t, i18n } = useTranslation("openhands");const canManage = useHasPermission("manage_automations");- const scheduleLabel =- automation.trigger.schedule_human || automation.trigger.type;- const pills = useMemo(- () => buildAutomationMetadataPills(automation, scheduleLabel),- [automation, scheduleLabel],- );-const handleView = () => {navigate?.(`/automations/${automation.id}`);};@@ -76,119 +76,147 @@ export function AutomationListRow({onDelete,});- const handleRowClick = () => {- handleView();- };+ const isEventTrigger = automation.trigger.type === "event";+ const TriggerIcon = isEventTrigger ? Zap : ClockIcon;+ const triggerEventLabel = getTriggerEventLabel(automation);+ const triggerScheduleLabel = getTriggerScheduleLabel(automation);+ const triggerSource = getTriggerSource(automation);+ const hasTriggerMeta = Boolean(+ triggerEventLabel || triggerScheduleLabel || triggerSource,+ );++ const runState = toLatestRunState(insights?.state);+ const health = deriveRunHealth(runState);+ const latestRun = runState.latestRun;+ const lastRunAt = latestRun+ ? getLastRunTimestamp(latestRun)+ : automation.last_triggered_at;+ const whenLabel = lastRunAt+ ? formatRelativeTime(lastRunAt, i18n.language, t)+ : null;+ const hasMeta =+ hasTriggerMeta || Boolean(whenLabel) || Boolean(latestRun?.status);+ const detailHref = `/automations/${encodeURIComponent(automation.id)}`;+ const statusLabelKey = getRunStatusLabelKey(runState);+ const disableAnimation = import.meta.env.MODE === "test";return (- <tr+ <lidata-testid={`automation-list-row-${automation.id}`}- onClick={handleRowClick}- onKeyDown={(event) => {- if (event.key === "Enter") {- handleRowClick();- }- }}- tabIndex={0}- className={cn(automationListRowClassName, "cursor-pointer")}+ className={automationActivityRowClassName}>- <td className={automationListCellClassName}>- <div className="flex min-w-0 items-center gap-1.5">- {automation.trigger.type === "event" ? (- <Zap className="size-4 shrink-0 text-muted" aria-hidden="true" />- ) : (- <ClockIcon className="size-4 shrink-0 text-muted" />- )}- <span- className="max-w-[40%] shrink-0 truncate text-sm font-medium text-white"- title={automation.name}- >- {automation.name}- </span>- {pills.length > 0 ? (- <div className="min-w-0 flex-1">- <SkillCardPillRow- pills={pills}- testId={`automation-pills-${automation.id}`}- />- </div>- ) : null}- </div>- </td>+ <Tooltip+ content={+ <HomeAutomationRunTooltip+ automation={automation}+ runState={runState}+ />+ }+ placement="top-start"+ closeDelay={100}+ disableAnimation={disableAnimation}+ className="rounded-xl border border-[var(--oh-border)] bg-base-secondary p-0 text-white shadow-xl"+ >+ <NavigationLink+ to={detailHref}+ aria-label={`${automation.name} ${t(statusLabelKey)}`}+ className="flex min-w-0 flex-1 items-center justify-between gap-3 px-3 py-2.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--oh-focus)]"+ >+ <div className="grid min-w-0 flex-1 grid-cols-[auto_minmax(0,1fr)] gap-x-2">+ <span+ data-testid={`automation-health-${automation.id}`}+ className="inline-flex h-5 w-2.5 shrink-0 items-center justify-center"+ >+ <AutomationHealthIndicator health={health} />+ </span>+ <span className="truncate text-sm font-medium leading-5 text-[var(--oh-foreground)]">+ {automation.name}+ </span>+ {hasMeta ? (+ <span className="col-start-2 mt-0.5 flex min-w-0 items-center gap-1.5 text-xs leading-4 text-[var(--oh-text-secondary)]">+ <TriggerIcon className="size-3 shrink-0" aria-hidden="true" />+ {triggerEventLabel ? (+ <span className="truncate">{triggerEventLabel}</span>+ ) : null}+ {triggerScheduleLabel ? (+ <span className="truncate">{triggerScheduleLabel}</span>+ ) : null}+ {triggerSource ? (+ <span+ className={cn(+ extensionModuleCardPillClassName,+ "shrink-0 px-1.5 py-0 text-[var(--oh-text-secondary)]",+ )}+ >+ {formatTriggerSourceLabel(triggerSource)}+ </span>+ ) : null}+ {whenLabel ? (+ <>+ {hasTriggerMeta ? (+ <span className="shrink-0" aria-hidden="true">+ ·+ </span>+ ) : null}+ <span+ data-testid={`automation-last-run-${automation.id}`}+ className="truncate"+ >+ {whenLabel}+ </span>+ </>+ ) : null}+ {latestRun ? (+ <>+ {hasTriggerMeta || whenLabel ? (+ <span className="shrink-0" aria-hidden="true">+ ·+ </span>+ ) : null}+ <RunStatusBadge status={latestRun.status} compact />+ </>+ ) : null}+ </span>+ ) : null}+ <span className="sr-only">{t(statusLabelKey)}</span>+ </div>+ </NavigationLink>+ </Tooltip>- {insights ? (- <>- <td- data-testid={`automation-health-${automation.id}`}- className={cn(- "hidden w-[110px] @min-[36rem]:table-cell",- automationListCellClassName,- )}+ <div className="flex shrink-0 items-center gap-1.5 pr-1.5">+ {insights ? (+ <AutomationRunActivitySparkline+ automationId={automation.id}+ runs={runState.recentRuns}+ testId={`automation-activity-${automation.id}`}+ />+ ) : null}+ {canManage ? (+ <StyledTooltip+ content={t(I18nKey.AUTOMATIONS$RUN_NOW)}+ placement="top">- <AutomationHealthBadge- health={deriveAutomationHealth(automation, insights.state)}- labels={insights.spec.health}- />- </td>- <td- data-testid={`automation-last-run-${automation.id}`}- className={cn(- "hidden w-[84px] whitespace-nowrap text-xs text-muted @min-[44rem]:table-cell",- automationListCellClassName,- )}- >- {lastRunText(- insights.state?.summary?.latestRun?.started_at ??- automation.last_triggered_at,- insights.spec.lastRun,- t(I18nKey.CONVERSATION$AGO),- )}- </td>- <td- data-testid={`automation-run-stats-${automation.id}`}- title={`${insights.spec.stats.runs} · ${insights.spec.stats.averageDuration}`}- className={cn(- "hidden w-[140px] whitespace-nowrap text-right text-xs text-muted @min-[56rem]:table-cell",- automationListCellClassName,- )}- >- {`${runCountDisplay(insights.state)} · ${averageDurationDisplay(insights.state)}`}- </td>- </>- ) : null}-- <td- className={cn(- insights ? "w-[90px]" : "w-0",- "whitespace-nowrap",- automationListCellClassName,- )}- >- <div className="flex items-center justify-end gap-0.5">- {canManage ? (- <StyledTooltip- content={t(I18nKey.AUTOMATIONS$RUN_NOW)}- placement="top"+ <button+ type="button"+ data-testid={`automation-run-now-${automation.id}`}+ aria-label={t(I18nKey.AUTOMATIONS$RUN_NOW)}+ aria-busy={isRunPending}+ disabled={isRunPending || !automation.enabled}+ onClick={(event) => {+ event.stopPropagation();+ onRunNow(automation.id);+ }}+ className={automationIconActionButtonClassName}>- <button- type="button"- data-testid={`automation-run-now-${automation.id}`}- aria-label={t(I18nKey.AUTOMATIONS$RUN_NOW)}- aria-busy={isRunPending}- disabled={isRunPending || !automation.enabled}- onClick={(event) => {- event.stopPropagation();- onRunNow(automation.id);- }}- className={automationIconActionButtonClassName}- >- <PlayIcon className="size-4 shrink-0" aria-hidden />- </button>- </StyledTooltip>- ) : null}- <KebabMenu items={menuItems} />- </div>- </td>- </tr>+ <PlayIcon className="size-4 shrink-0" aria-hidden />+ </button>+ </StyledTooltip>+ ) : null}+ <KebabMenu+ items={menuItems}+ triggerClassName="opacity-70 group-hover:opacity-100"+ />+ </div>+ </li>);}diff --git a/src/components/features/automations/automation-run-insights.tsx b/src/components/features/automations/automation-run-insights.tsxindex 529f79c49f..ec92bcca30 100644--- a/src/components/features/automations/automation-run-insights.tsx+++ b/src/components/features/automations/automation-run-insights.tsx@@ -57,7 +57,7 @@ export function AutomationRunStats({ state, copy }: AutomationRunStatsProps) {return (<dldata-testid="automation-run-stats"- className="grid grid-cols-3 gap-2 border-t border-[var(--oh-border)] pt-3 text-xs"+ className="grid grid-cols-3 gap-2 text-xs">{cells.map((cell) => (<div key={cell.label} className="min-w-0">diff --git a/src/components/features/automations/automation-view-mode.ts b/src/components/features/automations/automation-view-mode.tsindex bdb4c3bba5..308222c529 100644--- a/src/components/features/automations/automation-view-mode.ts+++ b/src/components/features/automations/automation-view-mode.ts@@ -15,8 +15,13 @@ export function writeStoredAutomationViewMode(view: AutomationViewMode): void {window.localStorage.setItem(AUTOMATIONS_VIEW_MODE_STORAGE_KEY, view);}-export {- tableContainerClassName as automationListTableClassName,- tableRowInteractiveClassName as automationListRowClassName,- tableCellClassName as automationListCellClassName,-} from "#/utils/table-row-classes";+/** Shared chrome for the dashboard list and the home activity list. */+export const automationActivityListClassName =+ "divide-y divide-[var(--oh-border-subtle)] overflow-hidden rounded-xl border border-[var(--oh-border-subtle)] bg-[var(--oh-surface)]";++export const automationActivityRowClassName =+ "group relative flex items-stretch transition-colors hover:bg-surface-raised has-[:focus-visible]:bg-surface-raised";++/** Inset last-run strip used under the trigger/sparkline row. */+export const automationCardStatusStripClassName =+ "mt-3 flex min-h-9 items-center justify-between gap-2 overflow-hidden rounded-md border border-[var(--oh-border-subtle)] bg-[var(--oh-surface)] px-3 py-2 text-xs";diff --git a/src/components/features/automations/build-automation-pills.tsx b/src/components/features/automations/build-automation-pills.tsxindex 4fa3cc8ca0..15e1f9cbae 100644--- a/src/components/features/automations/build-automation-pills.tsx+++ b/src/components/features/automations/build-automation-pills.tsx@@ -1,12 +1,19 @@import FolderIcon from "#/icons/folder.svg?react";import ClockIcon from "#/icons/clock.svg?react";import SparkleIcon from "#/icons/sparkle.svg?react";-import { Zap } from "lucide-react";+import { Plug, Zap } from "lucide-react";+import { INTEGRATION_CATALOG as MCP_MARKETPLACE } from "@openhands/extensions/integrations";import type { SkillCardPill } from "#/components/features/skills/skill-card-pill-row";+import { McpLogoBadge } from "#/components/features/mcp-logo-badge";import type { Automation } from "#/types/automation";import { cn } from "#/utils/utils";import { extensionModuleCardPillClassName } from "#/utils/extension-module-card-classes";-import { formatEventOn } from "#/utils/automation-schedule";+import { getMarketplaceEntryById } from "#/utils/mcp-marketplace-utils";+import {+ formatTriggerSourceLabel,+ getTriggerEventLabel,+ getTriggerSource,+} from "#/components/features/home/featured-automations/automation-run-health";export function buildAutomationMetadataPills(automation: Automation,@@ -27,22 +34,47 @@ export function buildAutomationMetadataPills(}if (automation.trigger.type === "event") {- const eventLabel = [- automation.trigger.on ? formatEventOn(automation.trigger.on) : "",- automation.trigger.source ? `(${automation.trigger.source})` : "",- ]- .filter(Boolean)- .join(" ");+ const eventLabel = getTriggerEventLabel(automation);+ if (eventLabel) {+ pills.push({+ id: "event-trigger",+ node: (+ <span className={cn(extensionModuleCardPillClassName, "gap-1")}>+ <Zap className="size-3 shrink-0" aria-hidden="true" />+ {eventLabel}+ </span>+ ),+ });+ }- pills.push({- id: "event-trigger",- node: (- <span className={cn(extensionModuleCardPillClassName, "gap-1")}>- <Zap className="size-3 shrink-0" aria-hidden="true" />- {eventLabel}- </span>- ),- });+ const source = getTriggerSource(automation);+ if (source) {+ const sourceEntry = getMarketplaceEntryById(+ source.toLowerCase(),+ MCP_MARKETPLACE,+ );+ pills.push({+ id: "event-source",+ node: (+ <span className={cn(extensionModuleCardPillClassName, "gap-1")}>+ {sourceEntry ? (+ <McpLogoBadge+ entry={sourceEntry}+ size="xs"+ testId="automation-source-logo"+ />+ ) : (+ <Plug+ className="size-3 shrink-0"+ aria-hidden="true"+ data-testid="automation-source-logo"+ />+ )}+ {formatTriggerSourceLabel(source)}+ </span>+ ),+ });+ }} else {pills.push({id: "schedule",diff --git a/src/components/features/automations/create-instructions.tsx b/src/components/features/automations/create-instructions.tsxindex d1227e4979..6032278c54 100644--- a/src/components/features/automations/create-instructions.tsx+++ b/src/components/features/automations/create-instructions.tsx@@ -68,18 +68,18 @@ export function CreateInstructionsContent({i18nKey={I18nKey.AUTOMATIONS$EMPTY_OPTION_CONVERSATION_DESC}components={CREATE_INSTRUCTIONS_INLINE_COMPONENTS}/>{" "}- {t(I18nKey.AUTOMATIONS$CREATE_INSTRUCTIONS_GUIDANCE)}- </p>-- <div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">+ {t(I18nKey.AUTOMATIONS$CREATE_INSTRUCTIONS_GUIDANCE)}{" "}<ahref={getAutomationsDocsUrl()}target="_blank"rel="noopener noreferrer"- className="text-sm text-muted underline transition-colors hover:text-foreground"+ className="text-muted underline transition-colors hover:text-foreground">{t(I18nKey.AUTOMATIONS$EMPTY_LEARN_MORE)}</a>+ </p>++ <div className="flex justify-center"><BrandButtontype="button"variant="primary"@@ -132,12 +132,7 @@ export function CreateInstructions({return (<div className="w-full max-w-2xl">- <h3 className="text-center text-sm font-medium text-content">- {t(I18nKey.AUTOMATIONS$EMPTY_HOW_TO_CREATE_TITLE)}- </h3>- <div className="mt-4">- <CreateInstructionsContent />- </div>+ <CreateInstructionsContent /></div>);}diff --git a/src/components/features/automations/dashboard/automations-dashboard-controls.tsx b/src/components/features/automations/dashboard/automations-dashboard-controls.tsxindex 74b85de137..e5cdb9a06c 100644--- a/src/components/features/automations/dashboard/automations-dashboard-controls.tsx+++ b/src/components/features/automations/dashboard/automations-dashboard-controls.tsx@@ -1,10 +1,32 @@+import { type ReactNode, useState } from "react";+import { ChevronDown, ListFilter } from "lucide-react";+import { useTranslation } from "react-i18next";+import { I18nKey } from "#/i18n/declaration";import { EnumFilterDropdown } from "#/components/shared/filters/enum-filter-dropdown";+import { useClickOutsideElement } from "#/hooks/use-click-outside-element";import type { DashboardSpec } from "#/manifests/automation-interface";import type {DashboardSortValue,DashboardStatusValue,DashboardTriggerValue,} from "#/manifests/types";+import { dropdownFilterTriggerClassName } from "#/utils/dropdown-classes";+import { cn } from "#/utils/utils";++function FilterField({+ label,+ children,+}: {+ label: string;+ children: ReactNode;+}) {+ return (+ <div className="flex flex-col gap-1">+ <span className="text-xs font-medium text-muted">{label}</span>+ {children}+ </div>+ );+}function toLabelMap<T extends string>(options: readonly { value: T; label: string }[],@@ -25,9 +47,10 @@ interface AutomationsDashboardControlsProps {}/**- * The manifest-declared filter and sort dropdowns, in the manifest's order.- * Which filters exist, their options, and every caption are the manifest's;- * the predicates and comparators behind the values are the host's.+ * One Filters trigger that nests the manifest-declared status, trigger, and+ * sort dropdowns. Which filters exist, their options, and every caption stay+ * the manifest's; the predicates and comparators behind the values stay the+ * host's.*/export function AutomationsDashboardControls({spec,@@ -38,39 +61,120 @@ export function AutomationsDashboardControls({onTriggerChange,onSortChange,}: AutomationsDashboardControlsProps) {+ const { t } = useTranslation("openhands");+ const [open, setOpen] = useState(false);+ const containerRef = useClickOutsideElement<HTMLDivElement>(() =>+ setOpen(false),+ );++ const statusFilter = spec.filters.find((filter) => filter.id === "status");+ const triggerFilter = spec.filters.find((filter) => filter.id === "trigger");+ const activeCount = [+ statusFilter && status !== statusFilter.options[0]?.value,+ triggerFilter && trigger !== triggerFilter.options[0]?.value,+ sort !== spec.sort.default,+ ].filter(Boolean).length;+ const filtersLabel = t(I18nKey.AUTOMATIONS$FILTERS);+ const defaultStatus = statusFilter?.options[0]?.value;+ const defaultTrigger = triggerFilter?.options[0]?.value;++ const resetAll = () => {+ if (defaultStatus) onStatusChange(defaultStatus);+ if (defaultTrigger) onTriggerChange(defaultTrigger);+ onSortChange(spec.sort.default);+ };+return (- <>- {spec.filters.map((filter) =>- filter.id === "status" ? (- <EnumFilterDropdown- key={filter.id}- testId="automations-filter-status"- value={status}- onChange={onStatusChange}- options={filter.options.map((option) => option.value)}- labelByValue={toLabelMap(filter.options)}- ariaLabel={filter.label}- />- ) : (- <EnumFilterDropdown- key={filter.id}- testId="automations-filter-trigger"- value={trigger}- onChange={onTriggerChange}- options={filter.options.map((option) => option.value)}- labelByValue={toLabelMap(filter.options)}- ariaLabel={filter.label}- />- ),- )}- <EnumFilterDropdown- testId="automations-sort"- value={sort}- onChange={onSortChange}- options={spec.sort.options.map((option) => option.value)}- labelByValue={toLabelMap(spec.sort.options)}- ariaLabel={spec.sort.label}- />- </>+ <div+ ref={containerRef}+ className="relative shrink-0 w-auto"+ data-testid="automations-filters"+ >+ <button+ type="button"+ data-testid="dropdown-trigger"+ aria-haspopup="true"+ aria-expanded={open}+ aria-label={filtersLabel}+ onClick={() => setOpen((prev) => !prev)}+ className={cn(+ dropdownFilterTriggerClassName,+ "h-9 py-0",+ activeCount > 0 && "border-white/60 bg-white/10",+ )}+ >+ <ListFilter className="h-4 w-4 shrink-0" aria-hidden />+ <span className="whitespace-nowrap">{filtersLabel}</span>+ {activeCount > 0 ? (+ <span className="rounded-full bg-white px-1.5 text-[11px] font-medium text-black">+ {activeCount}+ </span>+ ) : null}+ <ChevronDown+ className={cn(+ "h-4 w-4 shrink-0 text-tertiary-alt transition-transform",+ open && "rotate-180",+ )}+ aria-hidden+ />+ </button>++ {open ? (+ <div+ role="group"+ data-testid="automations-filters-menu"+ aria-label={filtersLabel}+ className="absolute right-0 top-full z-50 mt-1 flex min-w-[16rem] w-max flex-col gap-3 overflow-visible rounded-[6px] bg-tertiary p-3 context-menu-box-shadow"+ >+ {statusFilter ? (+ <FilterField label={statusFilter.label}>+ <EnumFilterDropdown+ testId="automations-filter-status"+ value={status}+ onChange={onStatusChange}+ options={statusFilter.options.map((option) => option.value)}+ labelByValue={toLabelMap(statusFilter.options)}+ ariaLabel={statusFilter.label}+ fullWidth+ />+ </FilterField>+ ) : null}+ {triggerFilter ? (+ <FilterField label={triggerFilter.label}>+ <EnumFilterDropdown+ testId="automations-filter-trigger"+ value={trigger}+ onChange={onTriggerChange}+ options={triggerFilter.options.map((option) => option.value)}+ labelByValue={toLabelMap(triggerFilter.options)}+ ariaLabel={triggerFilter.label}+ fullWidth+ />+ </FilterField>+ ) : null}+ <FilterField label={spec.sort.label}>+ <EnumFilterDropdown+ testId="automations-sort"+ value={sort}+ onChange={onSortChange}+ options={spec.sort.options.map((option) => option.value)}+ labelByValue={toLabelMap(spec.sort.options)}+ ariaLabel={spec.sort.label}+ fullWidth+ />+ </FilterField>+ {activeCount > 0 ? (+ <button+ type="button"+ data-testid="automations-filters-reset"+ onClick={resetAll}+ className="self-start text-sm text-muted hover:text-foreground"+ >+ {t(I18nKey.AUTOMATIONS$RESET_ALL)}+ </button>+ ) : null}+ </div>+ ) : null}+ </div>);}diff --git a/src/components/features/automations/dashboard/use-automation-sub-page-nav.ts b/src/components/features/automations/dashboard/use-automation-sub-page-nav.tsindex cc1426dcf1..7b5cda2e54 100644--- a/src/components/features/automations/dashboard/use-automation-sub-page-nav.ts+++ b/src/components/features/automations/dashboard/use-automation-sub-page-nav.ts@@ -30,7 +30,12 @@ export function useAutomationSubPageNav(): AutomationSubPageNav | null {.map((item) => ({to: item.to,label: item.label,- Icon: MANIFEST_ICON_BY_SLUG[item.icon],+ // Templates is a catalog, so the host always shows the library icon+ // even while the published manifest still names sparkles.+ Icon:+ item.page === "templates"+ ? MANIFEST_ICON_BY_SLUG.library+ : MANIFEST_ICON_BY_SLUG[item.icon],testId: `automations-navigation-${item.page}`,})),};diff --git a/src/components/features/automations/detail/run-status-badge.tsx b/src/components/features/automations/detail/run-status-badge.tsxindex 27b2ade21c..3a5326e6dc 100644--- a/src/components/features/automations/detail/run-status-badge.tsx+++ b/src/components/features/automations/detail/run-status-badge.tsx@@ -27,33 +27,32 @@ const statusConfig: Record<> = {[AutomationRunStatus.COMPLETED]: {label: I18nKey.AUTOMATIONS$DETAIL$SUCCESSFUL,- style:- "border-[var(--oh-success)]/50 bg-[var(--oh-success)]/10 text-[var(--oh-success)]",+ style: "bg-[var(--oh-success)]/10 text-[var(--oh-success)]",iconTone: "text-[var(--oh-success)]",},[AutomationRunStatus.FAILED]: {label: I18nKey.AUTOMATIONS$DETAIL$FAILED,- style: "border-[var(--oh-danger)]/50 bg-[var(--oh-danger)]/10 text-danger",+ style: "bg-[var(--oh-danger)]/10 text-danger",iconTone: "text-danger",},[AutomationRunStatus.PENDING]: {label: I18nKey.AUTOMATIONS$DETAIL$PENDING,- style: "border-[var(--oh-border)] bg-surface-raised text-muted",+ style: "bg-surface-raised text-muted",iconTone: "text-muted",},[AutomationRunStatus.RUNNING]: {label: I18nKey.AUTOMATIONS$DETAIL$RUNNING,- style: "border-[var(--oh-border)] bg-surface-raised text-muted",+ style: "bg-surface-raised text-muted",iconTone: "text-muted",},[AutomationRunStatus.CANCELLED]: {label: I18nKey.AUTOMATIONS$DETAIL$CANCELLED,- style: "border-[var(--oh-border)] bg-surface-raised text-muted",+ style: "bg-surface-raised text-muted",iconTone: "text-muted",},[AutomationRunStatus.SKIPPED]: {label: I18nKey.AUTOMATIONS$DETAIL$SKIPPED,- style: "border-[var(--oh-border)] bg-surface-raised text-muted",+ style: "bg-surface-raised text-muted",iconTone: "text-muted",},};@@ -147,10 +146,10 @@ export function RunStatusBadge({return (<spanclassName={cn(- "inline-flex items-center rounded-full border font-medium",+ "inline-flex items-center rounded-full font-medium",compact- ? "gap-1 px-1.5 py-0 text-[10px] leading-4"- : "gap-1.5 px-2.5 py-1 text-xs",+ ? "gap-1 pl-1 pr-1.5 py-0 text-[10px] leading-4"+ : "gap-1.5 pl-2 pr-2.5 py-1 text-xs",config.style,)}>diff --git a/src/components/features/automations/empty-state.tsx b/src/components/features/automations/empty-state.tsxindex a9850b34e0..66baaf7810 100644--- a/src/components/features/automations/empty-state.tsx+++ b/src/components/features/automations/empty-state.tsx@@ -2,6 +2,7 @@ import { useTranslation } from "react-i18next";import { I18nKey } from "#/i18n/declaration";import { extensionModuleEmptyStateClassName } from "#/utils/extension-module-card-classes";import { CreateInstructions } from "./create-instructions";+import { RecommendedAutomationsLauncher } from "./recommended-automations-launcher";export function EmptyState() {const { t } = useTranslation("openhands");@@ -12,13 +13,14 @@ export function EmptyState() {className={extensionModuleEmptyStateClassName}><p className="text-sm text-white">{t(I18nKey.AUTOMATIONS$EMPTY)}</p>- <p className="mt-1 text-xs text-tertiary-light">- {t(I18nKey.AUTOMATIONS$EMPTY_HINT)}- </p>- <div className="mt-8 flex justify-center border-t border-[var(--oh-border)] pt-8">+ <div className="mt-4 flex justify-center"><CreateInstructions /></div>++ <div className="mt-8 w-full text-left">+ <RecommendedAutomationsLauncher className="pb-0" variant="rail" />+ </div></div>);}diff --git a/src/components/features/automations/import-automation-modal.test.tsx b/src/components/features/automations/import-automation-modal.test.tsxindex 205eccc042..15c74ee91f 100644--- a/src/components/features/automations/import-automation-modal.test.tsx+++ b/src/components/features/automations/import-automation-modal.test.tsx@@ -1,7 +1,9 @@+import { fireEvent, render, screen } from "@testing-library/react";import { renderToStaticMarkup } from "react-dom/server";import { describe, expect, it, vi } from "vitest";import type { AutomationSpec } from "#/types/automation";import { I18nKey } from "#/i18n/declaration";+import { AUTOMATION_FILE_FORMAT_DOCS_URL } from "#/manifests/automation-interface";import { ImportAutomationModal } from "./import-automation-modal";vi.mock("react-i18next", () => ({@@ -34,6 +36,57 @@ const spec: AutomationSpec = {};describe("ImportAutomationModal", () => {+ it("explains import and offers a drop zone or file picker", () => {+ render(+ <ImportAutomationModal+ isOpen+ spec={null}+ isImporting={false}+ onClose={vi.fn()}+ onImport={vi.fn()}+ onFile={vi.fn()}+ />,+ );++ const modal = screen.getByTestId("import-automation-modal");+ expect(modal).toHaveAttribute("data-view", "picker");+ expect(modal).toHaveTextContent(I18nKey.AUTOMATIONS$IMPORT_EXPLAIN);+ expect(modal).toHaveTextContent(I18nKey.AUTOMATIONS$IMPORT_DISABLED_NOTICE);+ expect(+ screen.getByTestId("import-automation-dropzone"),+ ).toBeInTheDocument();+ expect(+ screen.getByTestId("import-automation-choose-file"),+ ).toBeInTheDocument();+ expect(screen.getByTestId("automations-import-file")).toBeInTheDocument();+ const docsLink = screen.getByTestId("import-automation-format-docs");+ expect(docsLink).toHaveAttribute("href", AUTOMATION_FILE_FORMAT_DOCS_URL);+ expect(docsLink).toHaveTextContent(I18nKey.AUTOMATIONS$IMPORT_FORMAT_DOCS);+ });++ it("passes a dropped file to onFile", () => {+ const onFile = vi.fn();+ render(+ <ImportAutomationModal+ isOpen+ spec={null}+ isImporting={false}+ onClose={vi.fn()}+ onImport={vi.fn()}+ onFile={onFile}+ />,+ );++ const file = new File(['{"name":"x"}'], "automation.json", {+ type: "application/json",+ });+ fireEvent.drop(screen.getByTestId("import-automation-dropzone"), {+ dataTransfer: { files: [file] },+ });++ expect(onFile).toHaveBeenCalledWith(file);+ });+it("previews the parsed automation before import", () => {const markup = renderToStaticMarkup(<ImportAutomationModal@@ -42,10 +95,12 @@ describe("ImportAutomationModal", () => {isImporting={false}onClose={vi.fn()}onImport={vi.fn()}+ onFile={vi.fn()}/>,);expect(markup).toContain('data-testid="import-automation-modal"');+ expect(markup).toContain('data-view="preview"');expect(markup).toContain(spec.name);expect(markup).toContain("github: pull_request.opened");expect(markup).toContain(spec.prompt!);@@ -54,14 +109,15 @@ describe("ImportAutomationModal", () => {expect(markup).toContain('data-testid="import-automation-confirm"');});- it("does not render without a parsed spec", () => {+ it("does not render when closed", () => {const markup = renderToStaticMarkup(<ImportAutomationModal- isOpen+ isOpen={false}spec={null}isImporting={false}onClose={vi.fn()}onImport={vi.fn()}+ onFile={vi.fn()}/>,);diff --git a/src/components/features/automations/import-automation-modal.tsx b/src/components/features/automations/import-automation-modal.tsxindex 50232ffd91..12357cc327 100644--- a/src/components/features/automations/import-automation-modal.tsx+++ b/src/components/features/automations/import-automation-modal.tsx@@ -1,5 +1,8 @@+import { useRef, useState, type DragEvent } from "react";+import { FileUp } from "lucide-react";import { useTranslation } from "react-i18next";import { I18nKey } from "#/i18n/declaration";+import { AUTOMATION_FILE_FORMAT_DOCS_URL } from "#/manifests/automation-interface";import type { AutomationSpec } from "#/types/automation";import { formatEventOn } from "#/utils/automation-schedule";import { cn } from "#/utils/utils";@@ -14,6 +17,7 @@ interface ImportAutomationModalProps {isImporting: boolean;onClose: () => void;onImport: () => void;+ onFile: (file: File) => void;}function PreviewField({ label, value }: { label: string; value: string }) {@@ -29,19 +33,120 @@ function PreviewField({ label, value }: { label: string; value: string }) {);}+function takeDroppedFile(event: DragEvent<HTMLElement>): File | null {+ const files = event.dataTransfer?.files;+ return files && files.length > 0 ? files[0]! : null;+}++function ImportAutomationPicker({ onFile }: { onFile: (file: File) => void }) {+ const { t } = useTranslation("openhands");+ const inputRef = useRef<HTMLInputElement>(null);+ const [isDragging, setIsDragging] = useState(false);++ const openFinder = () => inputRef.current?.click();++ return (+ <div className="flex flex-col gap-5 px-6 pb-6">+ <p className="text-sm leading-relaxed text-tertiary-light">+ {t(I18nKey.AUTOMATIONS$IMPORT_EXPLAIN)}{" "}+ <a+ href={AUTOMATION_FILE_FORMAT_DOCS_URL}+ target="_blank"+ rel="noopener noreferrer"+ data-testid="import-automation-format-docs"+ className="text-white no-underline transition-colors hover:text-white"+ >+ {t(I18nKey.AUTOMATIONS$IMPORT_FORMAT_DOCS)}+ </a>+ </p>+ <p className="text-sm text-tertiary-light">+ {t(I18nKey.AUTOMATIONS$IMPORT_DISABLED_NOTICE)}+ </p>++ <input+ ref={inputRef}+ type="file"+ accept="application/json,.json"+ className="hidden"+ data-testid="automations-import-file"+ onChange={() => {+ const input = inputRef.current;+ const file = input?.files?.[0];+ if (input) {+ input.value = "";+ }+ if (file) onFile(file);+ }}+ />++ <div+ data-testid="import-automation-dropzone"+ data-active={isDragging ? "true" : "false"}+ onClick={openFinder}+ onDragEnter={(event) => {+ event.preventDefault();+ setIsDragging(true);+ }}+ onDragOver={(event) => {+ event.preventDefault();+ setIsDragging(true);+ }}+ onDragLeave={(event) => {+ if (event.currentTarget.contains(event.relatedTarget as Node)) {+ return;+ }+ setIsDragging(false);+ }}+ onDrop={(event) => {+ event.preventDefault();+ setIsDragging(false);+ const file = takeDroppedFile(event);+ if (file) onFile(file);+ }}+ className={cn(+ "flex cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border border-dashed px-6 py-10 text-center",+ isDragging+ ? "border-[var(--oh-focus)] bg-[var(--oh-interactive-hover)]"+ : "border-[var(--oh-border)] bg-[var(--oh-surface)]",+ )}+ >+ <FileUp className="size-8 text-[var(--oh-muted)]" aria-hidden />+ <p className="text-sm font-medium text-content">+ {t(I18nKey.AUTOMATIONS$IMPORT_DROPZONE)}+ </p>+ <p className="text-xs text-tertiary-light">+ {t(I18nKey.AUTOMATIONS$IMPORT_OR)}+ </p>+ <BrandButton+ testId="import-automation-choose-file"+ type="button"+ variant="secondary"+ onClick={(event) => {+ event?.stopPropagation();+ openFinder();+ }}+ >+ {t(I18nKey.AUTOMATIONS$IMPORT_CHOOSE_FILE)}+ </BrandButton>+ </div>+ </div>+ );+}+export function ImportAutomationModal({isOpen,spec,isImporting,onClose,onImport,+ onFile,}: ImportAutomationModalProps) {const { t } = useTranslation("openhands");- if (!isOpen || !spec) return null;+ if (!isOpen) return null;- const trigger =- spec.trigger.type === "event"+ const trigger = spec+ ? spec.trigger.type === "event"? [spec.trigger.source, formatEventOn(spec.trigger.on)].filter(Boolean).join(": ")@@ -50,7 +155,8 @@ export function ImportAutomationModal({spec.timezone ?? spec.trigger.timezone,].filter(Boolean)- .join(" · ");+ .join(" · ")+ : "";return (<ModalBackdrop@@ -61,6 +167,7 @@ export function ImportAutomationModal({><divdata-testid="import-automation-modal"+ data-view={spec ? "preview" : "picker"}className="relative flex max-h-[85vh] w-[min(36rem,calc(100vw-2rem))] flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary"><ModalCloseButton@@ -72,57 +179,68 @@ export function ImportAutomationModal({<h2 className={cn("pr-6", modalTitleLgClassName)}>{t(I18nKey.AUTOMATIONS$IMPORT)}</h2>- <p className="mt-2 text-sm text-tertiary-light">- {t(I18nKey.AUTOMATIONS$IMPORT_PREVIEW_DESCRIPTION)}- </p>+ {spec ? (+ <p className="mt-2 text-sm text-tertiary-light">+ {t(I18nKey.AUTOMATIONS$IMPORT_PREVIEW_DESCRIPTION)}+ </p>+ ) : null}</header>- <dl className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto border-y border-[var(--oh-border)] px-6 py-5">- <PreviewField label={t(I18nKey.AUTOMATIONS$NAME)} value={spec.name} />- <PreviewField- label={t(I18nKey.AUTOMATIONS$DETAIL$TRIGGER)}- value={trigger}- />- <PreviewField- label={t(I18nKey.AUTOMATIONS$PROMPT)}- value={spec.prompt ?? ""}- />- {spec.plugins && spec.plugins.length > 0 ? (- <PreviewField- label={t(I18nKey.AUTOMATIONS$DETAIL$PLUGINS)}- value={spec.plugins.join(", ")}- />- ) : null}- </dl>+ {spec ? (+ <>+ <dl className="mx-6 flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface)] px-4 py-4">+ <PreviewField+ label={t(I18nKey.AUTOMATIONS$NAME)}+ value={spec.name}+ />+ <PreviewField+ label={t(I18nKey.AUTOMATIONS$DETAIL$TRIGGER)}+ value={trigger}+ />+ <PreviewField+ label={t(I18nKey.AUTOMATIONS$PROMPT)}+ value={spec.prompt ?? ""}+ />+ {spec.plugins && spec.plugins.length > 0 ? (+ <PreviewField+ label={t(I18nKey.AUTOMATIONS$DETAIL$PLUGINS)}+ value={spec.plugins.join(", ")}+ />+ ) : null}+ </dl>- <footer className="px-6 py-5">- <p className="mb-4 text-sm text-tertiary-light">- {t(I18nKey.AUTOMATIONS$IMPORT_DISABLED_NOTICE)}- </p>- <div className="flex justify-end gap-3">- <BrandButton- testId="import-automation-cancel"- type="button"- variant="secondary"- onClick={onClose}- isDisabled={isImporting}- >- {t(I18nKey.AUTOMATIONS$CANCEL)}- </BrandButton>- <BrandButton- testId="import-automation-confirm"- type="button"- variant="primary"- onClick={onImport}- isDisabled={isImporting}- aria-busy={isImporting}- >- {isImporting- ? t(I18nKey.AUTOMATIONS$IMPORTING)- : t(I18nKey.AUTOMATIONS$IMPORT)}- </BrandButton>- </div>- </footer>+ <footer className="px-6 py-5">+ <p className="mb-4 text-sm text-tertiary-light">+ {t(I18nKey.AUTOMATIONS$IMPORT_DISABLED_NOTICE)}+ </p>+ <div className="flex justify-end gap-3">+ <BrandButton+ testId="import-automation-cancel"+ type="button"+ variant="secondary"+ onClick={onClose}+ isDisabled={isImporting}+ >+ {t(I18nKey.AUTOMATIONS$CANCEL)}+ </BrandButton>+ <BrandButton+ testId="import-automation-confirm"+ type="button"+ variant="primary"+ onClick={onImport}+ isDisabled={isImporting}+ aria-busy={isImporting}+ >+ {isImporting+ ? t(I18nKey.AUTOMATIONS$IMPORTING)+ : t(I18nKey.AUTOMATIONS$IMPORT)}+ </BrandButton>+ </div>+ </footer>+ </>+ ) : (+ <ImportAutomationPicker onFile={onFile} />+ )}</div></ModalBackdrop>);diff --git a/src/components/features/automations/kebab-menu.tsx b/src/components/features/automations/kebab-menu.tsxindex 9a5e29c1e5..a9f015b756 100644--- a/src/components/features/automations/kebab-menu.tsx+++ b/src/components/features/automations/kebab-menu.tsx@@ -5,6 +5,7 @@ import KebabVerticalIcon from "#/icons/kebab-vertical.svg?react";import { ContextMenuListItem } from "#/components/features/context-menu/context-menu-list-item";import { I18nKey } from "#/i18n/declaration";import { ContextMenu } from "#/ui/context-menu";+import { cn } from "#/utils/utils";import { automationIconActionButtonClassName } from "./automation-action-button-classes";import { KebabMenuItemContent } from "./kebab-menu-item-content";@@ -17,9 +18,10 @@ export interface KebabMenuItem {interface KebabMenuProps {items: KebabMenuItem[];+ triggerClassName?: string;}-export function KebabMenu({ items }: KebabMenuProps) {+export function KebabMenu({ items, triggerClassName }: KebabMenuProps) {const { t } = useTranslation("openhands");const [open, setOpen] = useState(false);const [portalStyle, setPortalStyle] = useState<React.CSSProperties>();@@ -109,7 +111,7 @@ export function KebabMenu({ items }: KebabMenuProps) {e.stopPropagation();setOpen((current) => !current);}}- className={automationIconActionButtonClassName}+ className={cn(automationIconActionButtonClassName, triggerClassName)}aria-label={t(I18nKey.AUTOMATIONS$ACTIONS_MENU)}aria-expanded={open}aria-haspopup="menu"diff --git a/src/components/features/automations/recommended-automations-launcher.tsx b/src/components/features/automations/recommended-automations-launcher.tsxindex 57f753dbfb..c5e75dc1cc 100644--- a/src/components/features/automations/recommended-automations-launcher.tsx+++ b/src/components/features/automations/recommended-automations-launcher.tsx@@ -24,13 +24,18 @@ import {} from "#/utils/mcp-marketplace-utils";import { InstallServerModal } from "#/components/features/mcp-page/install-server-modal";import { useTracking } from "#/hooks/use-tracking";-import { automationSetupPath } from "#/manifests/automation-interface";+import {+ automationSetupPath,+ hasAutomationInterface,+} from "#/manifests/automation-interface";import { SETUP_REGISTRY } from "#/manifests/manifest-sources";import {getAutomationLaunchPrompt,getRequiredIntegrationIds,} from "#/utils/automation-catalog";import { isResponderAutomation } from "#/utils/responder-deployment";+import { useAutomations } from "#/hooks/query/use-automations";+import { RecommendedAutomationsRail } from "./recommended-automations-rail";import { RecommendedAutomationsSection } from "./recommended-automations-section";import { ResponderDeploymentModal } from "./responder-deployment-modal";@@ -39,6 +44,12 @@ interface RecommendedAutomationsLauncherProps {onLaunched?: () => void;/** When true, only the automation card grid scrolls inside its section. */scrollableGrid?: boolean;+ /**+ * Compact discovery rail for New Chat and the automations dashboard.+ * The templates page keeps the full catalog section.+ */+ variant?: "catalog" | "rail";+ className?: string;}/**@@ -62,6 +73,8 @@ export function RecommendedAutomationsLauncher({query,onLaunched,scrollableGrid = false,+ variant = "catalog",+ className,}: RecommendedAutomationsLauncherProps) {const activeBackend = useActiveBackend();const { navigate } = useNavigation();@@ -83,6 +96,11 @@ export function RecommendedAutomationsLauncher({const localSetupInFlightRef = useRef(false);const [isPreparingLocalResponder, setIsPreparingLocalResponder] =useState(false);+ const isRail = variant === "rail";+ const { data: automationsData, isLoading: isAutomationsLoading } =+ useAutomations({+ enabled: isRail && activeBackend.backend.kind === "local",+ });const installedMcpConfig = useMemo(() =>@@ -251,19 +269,33 @@ export function RecommendedAutomationsLauncher({const installEntry = installQueue[0] ?? null;+ // Like every automation surface, the launcher renders only behind the+ // interface-manifest gate; New Chat mounts it outside the gated routes.+ if (!hasAutomationInterface()) return null;+// Recommended automations are a local-backend-only feature; cloud// automations are managed elsewhere.if (activeBackend.backend.kind === "cloud") return null;+ if (isRail && isAutomationsLoading) return null;+return (<>- <RecommendedAutomationsSection- backendKind={activeBackend.backend.kind}- installedServers={installedMcpConfig}- query={query}- onSelect={handleSelectAutomation}- scrollableGrid={scrollableGrid}- />+ {isRail ? (+ <RecommendedAutomationsRail+ className={className}+ installedAutomations={automationsData?.automations ?? []}+ onSelect={handleSelectAutomation}+ />+ ) : (+ <RecommendedAutomationsSection+ backendKind={activeBackend.backend.kind}+ installedServers={installedMcpConfig}+ query={query}+ onSelect={handleSelectAutomation}+ scrollableGrid={scrollableGrid}+ />+ )}{installEntry && (<InstallServerModaldiff --git a/src/components/features/automations/recommended-automations-rail.tsx b/src/components/features/automations/recommended-automations-rail.tsxnew file mode 100644index 0000000000..8ebe3acc2f--- /dev/null+++ b/src/components/features/automations/recommended-automations-rail.tsx@@ -0,0 +1,193 @@+import { useCallback, useLayoutEffect, useRef, useState } from "react";+import { useTranslation } from "react-i18next";+import type { RecommendedAutomation } from "@openhands/extensions/automations";+import {+ INTEGRATION_CATALOG as MCP_MARKETPLACE,+ type IntegrationCatalogEntry as MarketplaceEntry,+} from "@openhands/extensions/integrations";+import { I18nKey } from "#/i18n/declaration";+import { McpLogoBadge } from "#/components/features/mcp-logo-badge";+import { getMarketplaceEntryById } from "#/utils/mcp-marketplace-utils";+import { getIntegrationIds } from "#/utils/automation-catalog";+import {+ flattenRecommendedRailGroups,+ getRecommendedRailGroups,+} from "#/utils/recommended-automation-rail";+import { readScrollFadeState } from "#/utils/scroll-fade-state";+import type { Automation } from "#/types/automation";+import { AUTOMATION_STACK_SECTION_BOTTOM_CLASS } from "#/utils/automation-stack-section";+import { cn } from "#/utils/utils";+import {+ extensionModuleCardInteractiveClassName,+ extensionModuleCardSurfaceClassName,+} from "#/utils/extension-module-card-classes";++interface RecommendedAutomationsRailProps {+ installedAutomations: readonly Pick<Automation, "name">[];+ onSelect: (automation: RecommendedAutomation) => void;+ className?: string;+}++/** Current catalog tiles reserve 40px for the icon; keep that row height. */+const RAIL_ICON_ROW_CLASS_NAME = "flex h-10 items-start";++function integrationEntries(+ automation: RecommendedAutomation,+): MarketplaceEntry[] {+ return getIntegrationIds(automation).flatMap((id) => {+ const entry = getMarketplaceEntryById(id, MCP_MARKETPLACE);+ return entry ? [entry] : [];+ });+}++function RailIntegrationIcons({+ entries,+ testId,+}: {+ entries: MarketplaceEntry[];+ testId: string;+}) {+ const visibleEntries = entries.slice(0, 4);+ const isOverlap = visibleEntries.length > 1;++ return (+ <span+ aria-hidden="true"+ data-testid={testId}+ data-layout={isOverlap ? "overlap" : undefined}+ className={cn(RAIL_ICON_ROW_CLASS_NAME, isOverlap && "-space-x-2")}+ >+ {visibleEntries.length === 0 ? (+ <McpLogoBadge entry={null} size="base" />+ ) : (+ visibleEntries.map((entry) => (+ <McpLogoBadge+ key={entry.id}+ entry={entry}+ size="base"+ className={+ isOverlap+ ? "ring-2 ring-[var(--oh-color-base-secondary)]"+ : undefined+ }+ />+ ))+ )}+ </span>+ );+}++export function RecommendedAutomationsRail({+ installedAutomations,+ onSelect,+ className,+}: RecommendedAutomationsRailProps) {+ const { t } = useTranslation("openhands");+ const items = flattenRecommendedRailGroups(+ getRecommendedRailGroups(installedAutomations),+ );+ const scrollRef = useRef<HTMLDivElement>(null);+ const [fadeState, setFadeState] = useState({ left: false, right: false });++ const updateFadeState = useCallback(() => {+ const element = scrollRef.current;+ if (!element) return;+ const next = readScrollFadeState(element);+ setFadeState((current) =>+ current.left === next.left && current.right === next.right+ ? current+ : next,+ );+ }, []);++ const itemIds = items.map((item) => item.id).join(",");++ useLayoutEffect(() => {+ updateFadeState();++ const element = scrollRef.current;+ if (!element) return undefined;++ const resizeObserver = new ResizeObserver(updateFadeState);+ resizeObserver.observe(element);+ Array.from(element.children).forEach((child) => {+ resizeObserver.observe(child);+ });++ return () => resizeObserver.disconnect();+ }, [updateFadeState, itemIds]);++ if (items.length === 0) return null;++ return (+ <section+ data-testid="recommended-automations-rail"+ aria-label={t(I18nKey.RECOMMENDED_AUTOMATIONS$SECTION_LABEL)}+ className={cn("w-full", AUTOMATION_STACK_SECTION_BOTTOM_CLASS, className)}+ >+ <h2 className="mb-2 text-sm font-medium text-[var(--oh-foreground)]">+ {t(I18nKey.RECOMMENDED_AUTOMATIONS$SECTION_LABEL)}+ </h2>++ <div className="relative">+ <div+ ref={scrollRef}+ role="list"+ data-testid="recommended-automations-rail-scroll"+ onScroll={updateFadeState}+ className="flex flex-nowrap gap-3 overflow-x-auto scrollbar-hide"+ >+ {items.map((automation) => (+ <div key={automation.id} role="listitem">+ <button+ type="button"+ data-testid={`recommended-automation-rail-card-${automation.id}`}+ onClick={() => onSelect(automation)}+ className={cn(+ "flex w-[220px] shrink-0 flex-col gap-3 p-3 text-left",+ extensionModuleCardSurfaceClassName,+ extensionModuleCardInteractiveClassName,+ )}+ >+ <RailIntegrationIcons+ entries={integrationEntries(automation)}+ testId={`recommended-automation-rail-icon-${automation.id}`}+ />+ <div className="min-w-0">+ <h3 className="truncate text-sm font-semibold text-white">+ {automation.name}+ </h3>+ <p className="mt-0.5 line-clamp-2 text-xs leading-relaxed text-tertiary-light">+ {automation.description}+ </p>+ </div>+ </button>+ </div>+ ))}+ </div>+ <div+ aria-hidden+ data-testid="recommended-automations-rail-fade-left"+ data-visible={fadeState.left ? "true" : "false"}+ className={cn(+ "pointer-events-none absolute inset-y-0 left-0 z-10 w-10",+ "bg-gradient-to-r from-[var(--oh-scroll-fade-from,var(--oh-color-base))] to-transparent",+ "transition-opacity duration-300 ease-out motion-reduce:transition-none",+ fadeState.left ? "opacity-100" : "opacity-0",+ )}+ />+ <div+ aria-hidden+ data-testid="recommended-automations-rail-fade-right"+ data-visible={fadeState.right ? "true" : "false"}+ className={cn(+ "pointer-events-none absolute inset-y-0 right-0 z-10 w-10",+ "bg-gradient-to-l from-[var(--oh-scroll-fade-from,var(--oh-color-base))] to-transparent",+ "transition-opacity duration-300 ease-out motion-reduce:transition-none",+ fadeState.right ? "opacity-100" : "opacity-0",+ )}+ />+ </div>+ </section>+ );+}diff --git a/src/components/features/automations/recommended-automations-section.tsx b/src/components/features/automations/recommended-automations-section.tsxindex 0fbc6b2642..a5a6e4f2e5 100644--- a/src/components/features/automations/recommended-automations-section.tsx+++ b/src/components/features/automations/recommended-automations-section.tsx@@ -27,12 +27,14 @@ import {getAutomationLaunchPrompt,getIntegrationIds,} from "#/utils/automation-catalog";+import { getAutomationsByPopularity } from "#/utils/recommended-automation-rail";import { cn } from "#/utils/utils";import {extensionModuleCardInteractiveClassName,extensionModuleCardGridClassName,extensionModuleCardGridContainerClassName,extensionModuleCardPillClassName,+ extensionModuleCardSurfaceClassName,} from "#/utils/extension-module-card-classes";import { StatusBadge } from "./status-badge";@@ -45,18 +47,7 @@ interface RecommendedAutomationsSectionProps {scrollableGrid?: boolean;}-export function getAutomationsByPopularity(- catalog: RecommendedAutomation[],-): RecommendedAutomation[] {- return catalog- .map((automation, index) => ({ automation, index }))- .sort((a, b) => {- const byPopularity =- (b.automation.popularityRank ?? 0) - (a.automation.popularityRank ?? 0);- return byPopularity || a.index - b.index;- })- .map(({ automation }) => automation);-}+export { getAutomationsByPopularity };const RECOMMENDED_AUTOMATIONS = getAutomationsByPopularity(AUTOMATION_CATALOG);@@ -220,7 +211,8 @@ function AutomationCardGrid({data-testid={`recommended-automation-card-${automation.id}`}onClick={() => onSelect(automation)}className={cn(- "flex min-w-0 overflow-hidden p-4 text-left rounded-xl bg-surface-raised",+ "flex min-w-0 overflow-hidden p-4 text-left",+ extensionModuleCardSurfaceClassName,extensionModuleCardInteractiveClassName,)}>diff --git a/src/components/features/automations/to-latest-run-state.ts b/src/components/features/automations/to-latest-run-state.tsnew file mode 100644index 0000000000..68d41e26cf--- /dev/null+++ b/src/components/features/automations/to-latest-run-state.ts@@ -0,0 +1,47 @@+import type { LatestAutomationRunState } from "#/hooks/query/use-latest-automation-runs";+import {+ summarizeAutomationRuns,+ type RunSummaryState,+} from "#/manifests/automation-insights";++const EMPTY_RUN_STATE: LatestAutomationRunState = {+ latestRun: null,+ recentRuns: [],+ isLoading: false,+ isError: false,+};++/** Maps dashboard run-summary query state onto the home card/row run shape. */+export function toLatestRunState(+ state: RunSummaryState | undefined,+): LatestAutomationRunState {+ if (!state) return EMPTY_RUN_STATE;+ return {+ latestRun: state.summary?.latestRun ?? null,+ recentRuns: state.summary?.recentRuns ?? [],+ total: state.summary?.total,+ isLoading: state.isLoading,+ isError: state.isError,+ };+}++/** Maps home run state onto the dashboard stats footer shape. */+export function toRunSummaryState(+ state: LatestAutomationRunState,+): RunSummaryState {+ if (state.recentRuns.length === 0 && (state.isLoading || state.isError)) {+ return {+ summary: null,+ isLoading: state.isLoading,+ isError: state.isError,+ };+ }+ return {+ summary: summarizeAutomationRuns({+ runs: state.recentRuns,+ total: state.total ?? state.recentRuns.length,+ }),+ isLoading: state.isLoading,+ isError: state.isError,+ };+}diff --git a/src/components/features/home/featured-automations/pinned-automation-card.tsx b/src/components/features/home/featured-automations/pinned-automation-card.tsxindex 34dcb52864..2090335f7e 100644--- a/src/components/features/home/featured-automations/pinned-automation-card.tsx+++ b/src/components/features/home/featured-automations/pinned-automation-card.tsx@@ -1,30 +1,34 @@import { Tooltip } from "@heroui/react";-import { ExternalLink, Zap } from "lucide-react";-import { useRef } from "react";+import { ExternalLink } from "lucide-react";+import { useMemo, useRef } from "react";import { useTranslation } from "react-i18next";+import { buildAutomationMetadataPills } from "#/components/features/automations/build-automation-pills";import { EditAutomationModal } from "#/components/features/automations/detail/edit-automation-modal";import { RunStatusBadge } from "#/components/features/automations/detail/run-status-badge";+import { AutomationRunStats } from "#/components/features/automations/automation-run-insights";+import { toRunSummaryState } from "#/components/features/automations/to-latest-run-state";import { TurnOffConfirmationModal } from "#/components/features/automations/turn-off-confirmation-modal";+import { getDashboardSpec } from "#/manifests/automation-interface";+import { SkillCardPillRow } from "#/components/features/skills/skill-card-pill-row";import { NavigationLink } from "#/components/shared/navigation-link";import type { LatestAutomationRunState } from "#/hooks/query/use-latest-automation-runs";import { useHomeAutomationActions } from "#/hooks/use-home-automation-actions";import { getDemoConversationTitle } from "#/fixtures/home-automations-demo";import { useUserConversation } from "#/hooks/query/use-user-conversation";import { I18nKey } from "#/i18n/declaration";-import ClockIcon from "#/icons/clock.svg?react";import { AutomationRunStatus, type Automation } from "#/types/automation";-import { extensionModuleCardPillClassName } from "#/utils/extension-module-card-classes";import { formatRelativeTime } from "#/utils/format-relative-time";import { cn } from "#/utils/utils";+import { automationCardStatusStripClassName } from "#/components/features/automations/automation-view-mode";+import {+ extensionModuleCardInteractiveClassName,+ extensionModuleCardSurfaceClassName,+} from "#/utils/extension-module-card-classes";import { AutomationRunActivitySparkline } from "./automation-run-activity-sparkline";import { buildPinnedAutomationMenuItems } from "./build-pinned-automation-menu-items";import { HomeAutomationMenu } from "./home-automation-menu";import {- formatTriggerSourceLabel,getLastRunTimestamp,- getTriggerEventLabel,- getTriggerScheduleLabel,- getTriggerSource,shortenAutomationErrorDetail,shouldShowAutomationErrorHovercard,} from "./automation-run-health";@@ -43,9 +47,9 @@ interface PinnedAutomationCardProps {}/**- * Expanded pinned-automation card: status badge, trigger meta,- * loading/empty/error copy, failure detail, and conversation title link.- * Quick actions + unpin live in the card's three-dot menu.+ * Home pinned card. Shares the Automations dashboard tile chrome (surface,+ * header, pills, status strip) and keeps pin-only extras: drag-to-reorder,+ * conversation title, and unpin.*/export function PinnedAutomationCard({automation,@@ -78,11 +82,12 @@ export function PinnedAutomationCard({const isTerminal =latestRun?.status === AutomationRunStatus.COMPLETED ||latestRun?.status === AutomationRunStatus.FAILED;- const isEventTrigger = automation.trigger.type === "event";- const TriggerIcon = isEventTrigger ? Zap : ClockIcon;- const triggerEventLabel = getTriggerEventLabel(automation);- const triggerScheduleLabel = getTriggerScheduleLabel(automation);- const triggerSource = getTriggerSource(automation);+ const scheduleLabel =+ automation.trigger.schedule_human || automation.trigger.type;+ const pills = useMemo(+ () => buildAutomationMetadataPills(automation, scheduleLabel),+ [automation, scheduleLabel],+ );const errorDetail =latestRun?.status === AutomationRunStatus.FAILED? latestRun.error_detail?.trim() || null@@ -96,6 +101,7 @@ export function PinnedAutomationCard({shouldShowAutomationErrorHovercard(errorDetail, shortErrorDetail);const disableAnimation = import.meta.env.MODE === "test";const cardRef = useRef<HTMLElement>(null);+ const insights = getDashboardSpec()?.insights;const menuItems = buildPinnedAutomationMenuItems({automation,@@ -143,7 +149,9 @@ export function PinnedAutomationCard({}}onDragEnd={onDragEnd}className={cn(- "group relative flex flex-col rounded-xl border border-[var(--oh-border)] bg-[var(--oh-surface-raised)] p-4",+ "group relative flex min-w-0 flex-col overflow-hidden p-4 text-left",+ extensionModuleCardSurfaceClassName,+ extensionModuleCardInteractiveClassName,isDragging && "opacity-50",isDropTarget &&dropPosition === "before" &&@@ -154,92 +162,95 @@ export function PinnedAutomationCard({)}>{/*- Full top chrome (padding above the title + title row) is the drag- surface. Title is not an <a> so browsers don't steal the gesture;- click still opens details. Menu is opted out via data-no-drag.+ Top padding + title row is the drag surface. Title is not an <a> so+ browsers don't steal the gesture; click still opens details. The+ menu is opted out via data-no-drag.*/}- <div- draggable- data-testid={`pinned-automation-drag-${automation.id}`}- aria-label={t(I18nKey.FEATURED_AUTOMATIONS$REORDER_HANDLE, {- name: automation.name,- })}- className="-mx-4 -mt-4 mb-0 flex cursor-grab items-start justify-between gap-3 rounded-t-xl px-4 pb-1 pt-4 active:cursor-grabbing"- onDragStart={(event) => {- const target = event.target as HTMLElement | null;- if (target?.closest("[data-no-drag]")) {- event.preventDefault();- return;- }- const { dataTransfer } = event;- dataTransfer.effectAllowed = "move";- dataTransfer.setData("text/plain", automation.id);- if (cardRef.current) {- dataTransfer.setDragImage(cardRef.current, 24, 24);- }- onDragStart(automation.id);- }}- onDragEnd={onDragEnd}- >- <span- role="link"- tabIndex={0}- title={t(I18nKey.FEATURED_AUTOMATIONS$VIEW_DETAILS)}- className="min-w-0 flex-1 cursor-pointer truncate font-medium text-[var(--oh-foreground)] hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--oh-focus)]"- onClick={() => actions.viewDetails()}- onKeyDown={(event) => {- if (event.key === "Enter" || event.key === " ") {+ <header className="flex flex-col gap-1.5">+ <div+ draggable+ data-testid={`pinned-automation-drag-${automation.id}`}+ aria-label={t(I18nKey.FEATURED_AUTOMATIONS$REORDER_HANDLE, {+ name: automation.name,+ })}+ className="-mx-4 -mt-4 flex cursor-grab items-center justify-between gap-3 px-4 pt-4 active:cursor-grabbing"+ onDragStart={(event) => {+ const target = event.target as HTMLElement | null;+ if (target?.closest("[data-no-drag]")) {event.preventDefault();- actions.viewDetails();+ return;+ }+ const { dataTransfer } = event;+ dataTransfer.effectAllowed = "move";+ dataTransfer.setData("text/plain", automation.id);+ if (cardRef.current) {+ dataTransfer.setDragImage(cardRef.current, 24, 24);}+ onDragStart(automation.id);}}+ onDragEnd={onDragEnd}>- {automation.name}- </span>+ <span+ role="link"+ tabIndex={0}+ title={t(I18nKey.FEATURED_AUTOMATIONS$VIEW_DETAILS)}+ className="h-8 min-w-0 flex-1 cursor-pointer truncate text-sm font-semibold leading-8 text-[var(--oh-foreground)] hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--oh-focus)]"+ onClick={() => actions.viewDetails()}+ onKeyDown={(event) => {+ if (event.key === "Enter" || event.key === " ") {+ event.preventDefault();+ actions.viewDetails();+ }+ }}+ >+ {automation.name}+ </span>- <div data-no-drag className="shrink-0">- <HomeAutomationMenu- testId={`pinned-automation-menu-${automation.id}`}- panelTestId={`pinned-automation-menu-panel-${automation.id}`}- ariaLabel={t(I18nKey.FEATURED_AUTOMATIONS$ROW_MENU_LABEL, {- name: automation.name,- })}- triggerClassName="opacity-70 group-hover:opacity-100"- items={menuItems}- />+ <div data-no-drag className="flex h-8 shrink-0 items-center">+ <HomeAutomationMenu+ testId={`pinned-automation-menu-${automation.id}`}+ panelTestId={`pinned-automation-menu-panel-${automation.id}`}+ ariaLabel={t(I18nKey.FEATURED_AUTOMATIONS$ROW_MENU_LABEL, {+ name: automation.name,+ })}+ triggerClassName="opacity-70 group-hover:opacity-100"+ items={menuItems}+ />+ </div></div>- </div>+ {automation.prompt ? (+ <p className="line-clamp-2 text-xs leading-relaxed text-[var(--oh-text-secondary)]">+ {automation.prompt}+ </p>+ ) : null}+ </header>- <div className="mt-2 flex items-center justify-between gap-3 text-xs text-[var(--oh-text-secondary)]">- <span className="flex min-w-0 items-center gap-1.5">- <TriggerIcon className="size-3 shrink-0" aria-hidden="true" />- {triggerEventLabel ? (- <span className="truncate">{triggerEventLabel}</span>- ) : null}- {triggerScheduleLabel ? (- <span className="truncate">{triggerScheduleLabel}</span>+ {pills.length > 0 || recentRuns.length > 0 ? (+ <div+ className={cn(+ "mt-3 flex items-center gap-3",+ pills.length > 0 ? "justify-between" : "justify-end",+ )}+ >+ {pills.length > 0 ? (+ <div className="min-w-0 flex-1 overflow-hidden">+ <SkillCardPillRow+ pills={pills}+ testId={`pinned-automation-pills-${automation.id}`}+ />+ </div>) : null}- {triggerSource ? (- <span- className={cn(- extensionModuleCardPillClassName,- "px-1.5 py-0 text-[var(--oh-text-secondary)]",- )}- >- {formatTriggerSourceLabel(triggerSource)}- </span>+ {recentRuns.length > 0 ? (+ <AutomationRunActivitySparkline+ automationId={automation.id}+ runs={recentRuns}+ testId={`pinned-automation-activity-${automation.id}`}+ />) : null}- </span>- {recentRuns.length > 0 ? (- <AutomationRunActivitySparkline- automationId={automation.id}- runs={recentRuns}- testId={`pinned-automation-activity-${automation.id}`}- />- ) : null}- </div>+ </div>+ ) : null}- <div className="mt-3 flex min-h-9 items-center justify-between gap-2 overflow-hidden rounded-md border border-[var(--oh-border-subtle)] bg-[var(--oh-surface)] px-3 py-2 text-xs">+ <div className={automationCardStatusStripClassName}><div className="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">{isLoading ? (<div@@ -328,6 +339,15 @@ export function PinnedAutomationCard({) : null}</div>+ {insights ? (+ <div className="mt-3">+ <AutomationRunStats+ state={toRunSummaryState(runState)}+ copy={insights.stats}+ />+ </div>+ ) : null}+{actions.editOpen ? (<EditAutomationModalautomation={automation}diff --git a/src/components/features/home/featured-automations/pinned-automations-dashboard.tsx b/src/components/features/home/featured-automations/pinned-automations-dashboard.tsxindex 52aaaa142a..8b105e5974 100644--- a/src/components/features/home/featured-automations/pinned-automations-dashboard.tsx+++ b/src/components/features/home/featured-automations/pinned-automations-dashboard.tsx@@ -10,6 +10,8 @@ import {} from "#/hooks/use-home-pinned-automations";import { I18nKey } from "#/i18n/declaration";import type { Automation } from "#/types/automation";+import { AUTOMATION_STACK_SECTION_BOTTOM_CLASS } from "#/utils/automation-stack-section";+import { cn } from "#/utils/utils";import { PinnedAutomationCard } from "./pinned-automation-card";/**@@ -70,7 +72,7 @@ export function PinnedAutomationsDashboard() {<sectiondata-testid="pinned-automations-dashboard"aria-label={t(I18nKey.FEATURED_AUTOMATIONS$PINNED_DASHBOARD_LABEL)}- className="w-full"+ className={cn("w-full", AUTOMATION_STACK_SECTION_BOTTOM_CLASS)}><h2 className="mb-2 text-sm font-medium text-[var(--oh-foreground)]">{t(I18nKey.FEATURED_AUTOMATIONS$PINNED_TITLE)}diff --git a/src/components/features/home/featured-automations/running-automations-list.tsx b/src/components/features/home/featured-automations/running-automations-list.tsxindex 23652ba556..5059ae94f9 100644--- a/src/components/features/home/featured-automations/running-automations-list.tsx+++ b/src/components/features/home/featured-automations/running-automations-list.tsx@@ -32,6 +32,10 @@ import {getTriggerScheduleLabel,getTriggerSource,} from "./automation-run-health";+import {+ automationActivityListClassName,+ automationActivityRowClassName,+} from "#/components/features/automations/automation-view-mode";import {buildHomeAutomationActivityItems,hrefForActivityItem,@@ -93,7 +97,7 @@ function RunningAutomationRow({return (<lidata-testid={`running-automation-row-${item.id}`}- className="group relative flex items-stretch transition-colors hover:bg-[var(--oh-interactive-hover)] has-[:focus-visible]:bg-[var(--oh-interactive-hover)]"+ className={automationActivityRowClassName}><Tooltipcontent={@@ -256,7 +260,7 @@ export function RunningAutomationsList() {<sectionaria-labelledby="running-automations-heading"data-testid="running-automations-list"- className="mt-8 w-full"+ className="w-full"><div className="mb-2 flex items-center justify-between gap-2"><h2@@ -291,7 +295,7 @@ export function RunningAutomationsList() {) : (<ularia-label={t(I18nKey.FEATURED_AUTOMATIONS$RECENT_GROUP_LABEL)}- className="divide-y divide-[var(--oh-border-subtle)] overflow-hidden rounded-xl border border-[var(--oh-border-subtle)] bg-[var(--oh-surface)]"+ className={automationActivityListClassName}>{visibleItems.map((item) => {const automation = automationById.get(item.id);diff --git a/src/components/features/home/home-chat-launcher.tsx b/src/components/features/home/home-chat-launcher.tsxindex 2c7496f7b2..2fb04b4fb2 100644--- a/src/components/features/home/home-chat-launcher.tsx+++ b/src/components/features/home/home-chat-launcher.tsx@@ -28,6 +28,7 @@ import { getWorkspacesUnsupportedMessage } from "#/utils/workspaces-compatibilitimport type { PluginSpec } from "#/api/conversation-service/agent-server-conversation-service.types";import { PluginPickerModal } from "#/components/features/plugins/plugin-picker-modal";import { PluginPickerTrigger } from "#/components/features/plugins/plugin-picker-trigger";+import { RecommendedAutomationsLauncher } from "#/components/features/automations/recommended-automations-launcher";import { PinnedAutomationsDashboard } from "./featured-automations/pinned-automations-dashboard";import { RunningAutomationsList } from "./featured-automations/running-automations-list";import { HomeHeaderTitle } from "./home-header/home-header-title";@@ -262,6 +263,7 @@ export function HomeChatLauncher() {</div><div className="mt-8 flex w-full flex-col gap-8">+ <RecommendedAutomationsLauncher variant="rail" /><PinnedAutomationsDashboard /><RunningAutomationsList /></div>diff --git a/src/components/features/manifest/manifest-icons.ts b/src/components/features/manifest/manifest-icons.tsindex 1422f65b04..2b146e5b60 100644--- a/src/components/features/manifest/manifest-icons.ts+++ b/src/components/features/manifest/manifest-icons.ts@@ -3,6 +3,7 @@ import {Bot,CircleAlert,LayoutDashboard,+ Library,Sparkles,Timer,type LucideIcon,@@ -17,6 +18,7 @@ import type { InterfaceIconSlug } from "#/manifests/types";export const MANIFEST_ICON_BY_SLUG = {"layout-dashboard": LayoutDashboard,sparkles: Sparkles,+ library: Library,bot: Bot,"circle-alert": CircleAlert,activity: Activity,diff --git a/src/components/features/markdown/markdown-table-scroll.tsx b/src/components/features/markdown/markdown-table-scroll.tsxindex 44a527ae1c..a33411e2e8 100644--- a/src/components/features/markdown/markdown-table-scroll.tsx+++ b/src/components/features/markdown/markdown-table-scroll.tsx@@ -1,29 +1,18 @@import React from "react";import { cn } from "#/utils/utils";+import {+ readScrollFadeState,+ type ScrollFadeState,+} from "#/utils/scroll-fade-state";++export { readScrollFadeState };-const SCROLL_EDGE_THRESHOLD_PX = 1;const FADE_WIDTH_CLASS = "w-10";interface MarkdownTableScrollProps {children: React.ReactNode;}-interface ScrollFadeState {- left: boolean;- right: boolean;-}--export function readScrollFadeState(element: HTMLDivElement): ScrollFadeState {- const { scrollLeft, scrollWidth, clientWidth } = element;- const maxScroll = scrollWidth - clientWidth;- const hasOverflow = maxScroll > SCROLL_EDGE_THRESHOLD_PX;-- return {- left: hasOverflow && scrollLeft > SCROLL_EDGE_THRESHOLD_PX,- right: hasOverflow && scrollLeft < maxScroll - SCROLL_EDGE_THRESHOLD_PX,- };-}-export function MarkdownTableScroll({ children }: MarkdownTableScrollProps) {const scrollRef = React.useRef<HTMLDivElement>(null);const [fadeState, setFadeState] = React.useState<ScrollFadeState>({diff --git a/src/components/features/mcp-logo-badge.tsx b/src/components/features/mcp-logo-badge.tsxindex 3fa4b45d52..302fa54c38 100644--- a/src/components/features/mcp-logo-badge.tsx+++ b/src/components/features/mcp-logo-badge.tsx@@ -13,7 +13,7 @@ export type { McpLogoEntry };interface McpLogoBadgeProps {entry?: McpLogoEntry | null;- size?: "xs" | "sm" | "md";+ size?: "xs" | "sm" | "base" | "md";className?: string;fallback?: ReactNode;testId?: string;@@ -22,6 +22,7 @@ interface McpLogoBadgeProps {const sizeClassNames = {xs: "h-4 w-4 rounded [&>svg]:h-2.5 [&>svg]:w-2.5",sm: "h-5 w-5 rounded-md [&>svg]:h-3 [&>svg]:w-3",+ base: "h-7 w-7 rounded-lg [&>svg]:h-3.5 [&>svg]:w-3.5",md: "h-10 w-10 rounded-lg [&>svg]:h-5 [&>svg]:w-5",};diff --git a/src/components/features/settings/brand-button.tsx b/src/components/features/settings/brand-button.tsxindex 70abdf6c4e..ec5a4550b6 100644--- a/src/components/features/settings/brand-button.tsx+++ b/src/components/features/settings/brand-button.tsx@@ -15,6 +15,8 @@ interface BrandButtonProps {ariaLabel?: string;/** Indicates busy/loading state for screen readers */"aria-busy"?: boolean;+ "aria-haspopup"?: React.AriaAttributes["aria-haspopup"];+ "aria-expanded"?: boolean;}export const BrandButton = forwardRef<@@ -33,6 +35,8 @@ export const BrandButton = forwardRef<startContent,ariaLabel,"aria-busy": ariaBusy,+ "aria-haspopup": ariaHasPopup,+ "aria-expanded": ariaExpanded,},ref,) {@@ -48,6 +52,8 @@ export const BrandButton = forwardRef<onClick={onClick}aria-label={ariaLabel}aria-busy={ariaBusy}+ aria-haspopup={ariaHasPopup}+ aria-expanded={ariaExpanded}className={cn(formControlButtonClassName,variant === "primary" &&diff --git a/src/components/features/skills/skill-card-pill-row.tsx b/src/components/features/skills/skill-card-pill-row.tsxindex a1bb3a83b8..7a3841b66d 100644--- a/src/components/features/skills/skill-card-pill-row.tsx+++ b/src/components/features/skills/skill-card-pill-row.tsx@@ -1,4 +1,5 @@import React from "react";+import { createPortal } from "react-dom";import { useTranslation } from "react-i18next";import { I18nKey } from "#/i18n/declaration";import { cn } from "#/utils/utils";@@ -9,6 +10,24 @@ export const SKILL_CARD_PILL_CLASS = extensionModuleCardPillClassName;const PILL_GAP_PX = 6;const OVERFLOW_PILL_WIDTH_PX = 40;+const OVERFLOW_POPOVER_GUTTER_PX = 8;+const OVERFLOW_POPOVER_OFFSET_PX = 4;++function placePopoverByTrigger(+ trigger: DOMRect,+ popoverWidth: number,+): { top: number; left: number } {+ const maxLeft = window.innerWidth - OVERFLOW_POPOVER_GUTTER_PX - popoverWidth;+ let left = trigger.left;+ if (left > maxLeft) {+ left = trigger.right - popoverWidth;+ }+ left = Math.min(+ Math.max(OVERFLOW_POPOVER_GUTTER_PX, left),+ Math.max(OVERFLOW_POPOVER_GUTTER_PX, maxLeft),+ );+ return { top: trigger.bottom + OVERFLOW_POPOVER_OFFSET_PX, left };+}export interface SkillCardPill {id: string;@@ -44,7 +63,14 @@ export function SkillCardPillRow({ pills, testId }: SkillCardPillRowProps) {const { t } = useTranslation("openhands");const containerRef = React.useRef<HTMLDivElement>(null);const measureRef = React.useRef<HTMLDivElement>(null);+ const triggerRef = React.useRef<HTMLButtonElement>(null);+ const popoverRef = React.useRef<HTMLDivElement>(null);const [visibleCount, setVisibleCount] = React.useState(pills.length);+ const [isOverflowOpen, setIsOverflowOpen] = React.useState(false);+ const [popoverBox, setPopoverBox] = React.useState<{+ top: number;+ left: number;+ } | null>(null);const recomputeVisibleCount = React.useCallback(() => {const container = containerRef.current;@@ -57,9 +83,19 @@ export function SkillCardPillRow({ pills, testId }: SkillCardPillRowProps) {setVisibleCount(computeVisiblePillCount(widths, container.clientWidth));}, []);+ // Recommended cards rebuild the pills array every render; compare ids so an+ // open +N popover is not slammed shut under the cursor.+ const pillsKey = pills.map((pill) => pill.id).join("\u001f");+ const lastPillsKeyRef = React.useRef<string | null>(null);+React.useLayoutEffect(() => {+ if (lastPillsKeyRef.current === pillsKey) {+ return;+ }+ lastPillsKeyRef.current = pillsKey;+ setIsOverflowOpen(false);recomputeVisibleCount();- }, [pills, recomputeVisibleCount]);+ }, [pillsKey, recomputeVisibleCount]);React.useEffect(() => {const container = containerRef.current;@@ -70,12 +106,86 @@ export function SkillCardPillRow({ pills, testId }: SkillCardPillRowProps) {return () => observer.disconnect();}, [recomputeVisibleCount]);+ const measurePopover = React.useCallback(() => {+ const trigger = triggerRef.current;+ if (!trigger) {+ return;+ }+ const next = placePopoverByTrigger(+ trigger.getBoundingClientRect(),+ popoverRef.current?.offsetWidth ?? trigger.offsetWidth,+ );+ setPopoverBox((prev) =>+ prev?.top === next.top && prev?.left === next.left ? prev : next,+ );+ }, []);++ React.useLayoutEffect(() => {+ if (!isOverflowOpen) {+ setPopoverBox(null);+ return undefined;+ }+ measurePopover();+ window.addEventListener("resize", measurePopover);+ window.addEventListener("scroll", measurePopover, true);+ return () => {+ window.removeEventListener("resize", measurePopover);+ window.removeEventListener("scroll", measurePopover, true);+ };+ }, [isOverflowOpen, measurePopover]);++ React.useLayoutEffect(() => {+ if (isOverflowOpen && popoverBox && popoverRef.current) {+ measurePopover();+ }+ }, [isOverflowOpen, measurePopover, popoverBox]);++ React.useEffect(() => {+ if (!isOverflowOpen) {+ return undefined;+ }+ const onPointerDown = (event: MouseEvent) => {+ const target = event.target as Node;+ if (triggerRef.current?.contains(target)) {+ return;+ }+ if (popoverRef.current?.contains(target)) {+ return;+ }+ setIsOverflowOpen(false);+ };+ const onKeyDown = (event: KeyboardEvent) => {+ if (event.key === "Escape") {+ setIsOverflowOpen(false);+ }+ };+ // mousedown (not click) so the opening click cannot race-close the panel,+ // and so wrapping card/link activation is easier to cancel on the trigger.+ document.addEventListener("mousedown", onPointerDown);+ document.addEventListener("keydown", onKeyDown);+ return () => {+ document.removeEventListener("mousedown", onPointerDown);+ document.removeEventListener("keydown", onKeyDown);+ };+ }, [isOverflowOpen]);+if (pills.length === 0) return null;const hiddenCount = Math.max(0, pills.length - visibleCount);+ const overflowPills = pills.slice(visibleCount);++ const stopCardActivation = (event: React.SyntheticEvent) => {+ event.stopPropagation();+ };++ const activateOverflow = (event: React.MouseEvent<HTMLButtonElement>) => {+ event.preventDefault();+ event.stopPropagation();+ setIsOverflowOpen((open) => !open);+ };return (- <div className="min-w-0 overflow-hidden">+ <div data-testid={`${testId}-wrap`} className="min-w-0 overflow-hidden"><divref={measureRef}aria-hidden@@ -98,21 +208,66 @@ export function SkillCardPillRow({ pills, testId }: SkillCardPillRowProps) {</span>))}{hiddenCount > 0 ? (- <span+ <button+ ref={triggerRef}+ type="button"data-testid={`${testId}-overflow`}+ aria-expanded={isOverflowOpen}+ aria-haspopup="dialog"+ aria-label={t(I18nKey.SETTINGS$SKILLS_PILLS_OVERFLOW_ARIA, {+ count: hiddenCount,+ })}+ onMouseDown={stopCardActivation}+ onClick={activateOverflow}+ onKeyDown={stopCardActivation}className={cn(extensionModuleCardPillClassName,- "font-medium text-tertiary-alt",+ "cursor-pointer font-medium text-tertiary-alt hover:text-white",)}- title={pills- .slice(visibleCount)- .map((pill) => pill.id)- .join(", ")}>{t(I18nKey.SETTINGS$SKILLS_PILLS_MORE, { count: hiddenCount })}- </span>+ </button>) : null}</div>++ {isOverflowOpen &&+ popoverBox &&+ typeof document !== "undefined" &&+ createPortal(+ // Stop card-level click activation when interacting with the list.+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- dialog surface must swallow clicks+ <div+ ref={popoverRef}+ role="dialog"+ data-testid={`${testId}-overflow-popover`}+ className={cn(+ "z-[9999] flex w-max max-w-[20rem] flex-col gap-1.5",+ "rounded-md border border-[var(--oh-border-subtle)]",+ "bg-[var(--oh-surface)] p-2 shadow-lg",+ )}+ style={{+ position: "fixed",+ top: popoverBox.top,+ left: popoverBox.left,+ }}+ onMouseDown={stopCardActivation}+ onClick={(event) => {+ event.preventDefault();+ event.stopPropagation();+ }}+ >+ {overflowPills.map((pill) => (+ <div+ key={pill.id}+ data-testid={`${testId}-overflow-item`}+ className="min-w-0"+ >+ {pill.node}+ </div>+ ))}+ </div>,+ document.body,+ )}</div>);}diff --git a/src/components/shared/filters/enum-filter-dropdown.tsx b/src/components/shared/filters/enum-filter-dropdown.tsxindex d7598f3c54..018f6688b9 100644--- a/src/components/shared/filters/enum-filter-dropdown.tsx+++ b/src/components/shared/filters/enum-filter-dropdown.tsx@@ -19,6 +19,9 @@ interface EnumFilterDropdownProps<T extends string> {/** Plain-string labels, e.g. manifest-supplied copy. Wins over the keys. */labelByValue?: Record<T, string>;ariaLabel?: string;+ className?: string;+ /** Stretch the trigger to the container width, e.g. inside a parent menu. */+ fullWidth?: boolean;}export function EnumFilterDropdown<T extends string>({@@ -29,6 +32,8 @@ export function EnumFilterDropdown<T extends string>({labelKeyByValue,labelByValue,ariaLabel,+ className,+ fullWidth = false,}: EnumFilterDropdownProps<T>) {const { t } = useTranslation("openhands");const [open, setOpen] = React.useState(false);@@ -48,7 +53,11 @@ export function EnumFilterDropdown<T extends string>({return (<divref={containerRef}- className="relative shrink-0 w-auto"+ className={cn(+ "relative shrink-0",+ fullWidth ? "w-full" : "w-auto",+ className,+ )}data-testid={testId}><button@@ -60,6 +69,7 @@ export function EnumFilterDropdown<T extends string>({onClick={() => setOpen((prev) => !prev)}className={cn(dropdownFilterTriggerClassName,+ fullWidth && "w-full justify-between",defaultOption &&value !== defaultOption &&"border-white/60 bg-white/10",diff --git a/src/fixtures/home-automations-demo.ts b/src/fixtures/home-automations-demo.tsindex 1285512a53..9ad98cb36e 100644--- a/src/fixtures/home-automations-demo.ts+++ b/src/fixtures/home-automations-demo.ts@@ -28,10 +28,8 @@ const DEMO_HISTORY_PATTERN: AutomationRunStatus[] = [/*** Local preview of every pinned-card + activity-list state.*- * Enable with any of:+ * Enable with either:* - `HOME_AUTOMATIONS_FORCE_DEMO = true` below- * - `localStorage.setItem("oh:home-automations-demo", "1")`- * - `?demoAutomations=1` in the URL* - `VITE_HOME_AUTOMATIONS_DEMO=true`*/export const HOME_AUTOMATIONS_FORCE_DEMO = false;@@ -40,18 +38,7 @@ export const HOME_AUTOMATIONS_DEMO_KEY = "oh:home-automations-demo";export function isHomeAutomationsDemoEnabled(): boolean {if (HOME_AUTOMATIONS_FORCE_DEMO) return true;- if (import.meta.env.VITE_HOME_AUTOMATIONS_DEMO === "true") return true;- if (typeof window === "undefined") return false;- if (window.localStorage.getItem(HOME_AUTOMATIONS_DEMO_KEY) === "1") {- return true;- }- try {- return (- new URLSearchParams(window.location.search).get("demoAutomations") === "1"- );- } catch {- return false;- }+ return import.meta.env.VITE_HOME_AUTOMATIONS_DEMO === "true";}const DEMO_CONVERSATION_TITLES: Record<string, string | null> = {diff --git a/src/hooks/query/use-latest-automation-runs.ts b/src/hooks/query/use-latest-automation-runs.tsindex bafab6645e..f67718bf1e 100644--- a/src/hooks/query/use-latest-automation-runs.ts+++ b/src/hooks/query/use-latest-automation-runs.ts@@ -26,6 +26,8 @@ export interface LatestAutomationRunState {latestRun: AutomationRun | null;/** Newest-first recent runs for the activity sparkline (may be empty). */recentRuns: AutomationRun[];+ /** Lifetime run count from the runs response, when known. */+ total?: number;isLoading: boolean;isError: boolean;}@@ -85,6 +87,7 @@ export function useLatestAutomationRuns(runStates.set(automation.id, {latestRun: recentRuns[0] ?? null,recentRuns,+ total: result?.data?.total,isLoading: result?.isPending ?? true,isError: result?.isError ?? false,});diff --git a/src/i18n/translation.json b/src/i18n/translation.jsonindex e6e6d77eb0..02b084568c 100644--- a/src/i18n/translation.json+++ b/src/i18n/translation.json@@ -12392,6 +12392,91 @@"uk": "Експортувати","ca": "Exporta"},+ "AUTOMATIONS$IMPORT_EXPLAIN": {+ "en": "Import a JSON file exported from OpenHands. We'll add it as a disabled automation so you can review the trigger, prompt, and plugins before turning it on.",+ "ja": "OpenHands からエクスポートした JSON ファイルをインポートします。トリガー、プロンプト、プラグインを確認して有効化するまで、無効な状態で追加されます。",+ "zh-CN": "导入从 OpenHands 导出的 JSON 文件。我们会以禁用状态添加该自动化,便于你在启用前检查触发器、提示词和插件。",+ "zh-TW": "匯入從 OpenHands 匯出的 JSON 檔案。我們會以停用狀態新增該自動化,方便你在啟用前檢查觸發條件、提示詞與外掛。",+ "ko-KR": "OpenHands에서 내보낸 JSON 파일을 가져옵니다. 트리거, 프롬프트, 플러그인을 검토한 뒤 켜기 전까지 비활성 상태로 추가됩니다.",+ "no": "Importer en JSON-fil eksportert fra OpenHands. Vi legger den til som deaktivert, slik at du kan se gjennom utløser, prompt og plugins før du slår den på.",+ "it": "Importa un file JSON esportato da OpenHands. Lo aggiungeremo come automazione disattivata, così potrai controllare trigger, prompt e plugin prima di attivarla.",+ "pt": "Importe um arquivo JSON exportado do OpenHands. Vamos adicioná-lo como uma automação desativada para você revisar o gatilho, o prompt e os plugins antes de ativá-la.",+ "es": "Importe un archivo JSON exportado de OpenHands. Lo añadiremos como una automatización desactivada para que revise el disparador, el prompt y los plugins antes de activarla.",+ "ar": "استورد ملف JSON مُصدَّرًا من OpenHands. سنضيفه كأتمتة معطّلة حتى تراجع المشغّل والموجّه والإضافات قبل تشغيلها.",+ "fr": "Importez un fichier JSON exporté depuis OpenHands. Nous l'ajouterons comme automatisation désactivée afin que vous puissiez vérifier le déclencheur, le prompt et les plugins avant de l'activer.",+ "tr": "OpenHands'tan dışa aktarılmış bir JSON dosyasını içe aktarın. Tetikleyiciyi, komutu ve eklentileri açmadan önce incelemeniz için devre dışı bir otomasyon olarak ekleriz.",+ "de": "Importieren Sie eine aus OpenHands exportierte JSON-Datei. Wir fügen sie als deaktivierte Automatisierung hinzu, damit Sie Auslöser, Prompt und Plugins prüfen können, bevor Sie sie einschalten.",+ "uk": "Імпортуйте JSON-файл, експортований з OpenHands. Ми додамо його як вимкнену автоматизацію, щоб ви могли перевірити тригер, підказку та плагіни перед увімкненням.",+ "ca": "Importeu un fitxer JSON exportat d'OpenHands. L'afegirem com a automatització desactivada perquè en reviseu el disparador, el prompt i els connectors abans d'activar-la."+ },+ "AUTOMATIONS$IMPORT_DROPZONE": {+ "en": "Drop a .json file here",+ "ja": "ここに .json ファイルをドロップ",+ "zh-CN": "将 .json 文件拖到此处",+ "zh-TW": "將 .json 檔案拖到這裡",+ "ko-KR": ".json 파일을 여기에 놓으세요",+ "no": "Slipp en .json-fil her",+ "it": "Trascina qui un file .json",+ "pt": "Solte um arquivo .json aqui",+ "es": "Suelta un archivo .json aquí",+ "ar": "أسقط ملف .json هنا",+ "fr": "Déposez un fichier .json ici",+ "tr": "Buraya bir .json dosyası bırakın",+ "de": "Legen Sie hier eine .json-Datei ab",+ "uk": "Перетягніть сюди файл .json",+ "ca": "Deixeu un fitxer .json aquí"+ },+ "AUTOMATIONS$IMPORT_OR": {+ "en": "or",+ "ja": "または",+ "zh-CN": "或",+ "zh-TW": "或",+ "ko-KR": "또는",+ "no": "eller",+ "it": "oppure",+ "pt": "ou",+ "es": "o",+ "ar": "أو",+ "fr": "ou",+ "tr": "veya",+ "de": "oder",+ "uk": "або",+ "ca": "o"+ },+ "AUTOMATIONS$IMPORT_CHOOSE_FILE": {+ "en": "Choose file",+ "ja": "ファイルを選択",+ "zh-CN": "选择文件",+ "zh-TW": "選擇檔案",+ "ko-KR": "파일 선택",+ "no": "Velg fil",+ "it": "Scegli file",+ "pt": "Escolher arquivo",+ "es": "Elegir archivo",+ "ar": "اختيار ملف",+ "fr": "Choisir un fichier",+ "tr": "Dosya seç",+ "de": "Datei wählen",+ "uk": "Вибрати файл",+ "ca": "Tria un fitxer"+ },+ "AUTOMATIONS$IMPORT_FORMAT_DOCS": {+ "en": "File format documentation",+ "ja": "ファイル形式のドキュメント",+ "zh-CN": "文件格式文档",+ "zh-TW": "檔案格式說明",+ "ko-KR": "파일 형식 문서",+ "no": "Dokumentasjon for filformatet",+ "it": "Documentazione sul formato del file",+ "pt": "Documentação do formato do arquivo",+ "es": "Documentación del formato de archivo",+ "ar": "وثائق تنسيق الملف",+ "fr": "Documentation du format de fichier",+ "tr": "Dosya biçimi belgelendirmesi",+ "de": "Dokumentation zum Dateiformat",+ "uk": "Документація про формат файлу",+ "ca": "Documentació del format de fitxer"+ },"AUTOMATIONS$IMPORT_PREVIEW_DESCRIPTION": {"en": "Review the automation details before importing.","ja": "インポートする前にオートメーションの詳細を確認してください。",@@ -12766,6 +12851,40 @@"uk": "Очистити фільтри","ca": "Esborra els filtres"},+ "AUTOMATIONS$FILTERS": {+ "en": "Filters",+ "ja": "フィルター",+ "zh-CN": "筛选",+ "zh-TW": "篩選",+ "ko-KR": "필터",+ "no": "Filtre",+ "it": "Filtri",+ "pt": "Filtros",+ "es": "Filtros",+ "ar": "عوامل التصفية",+ "fr": "Filtres",+ "tr": "Filtreler",+ "de": "Filter",+ "uk": "Фільтри",+ "ca": "Filtres"+ },+ "AUTOMATIONS$RESET_ALL": {+ "en": "Reset all",+ "ja": "すべてリセット",+ "zh-CN": "全部重置",+ "zh-TW": "全部重設",+ "ko-KR": "모두 재설정",+ "no": "Tilbakestill alle",+ "it": "Reimposta tutto",+ "pt": "Redefinir tudo",+ "es": "Restablecer todo",+ "ar": "إعادة تعيين الكل",+ "fr": "Tout réinitialiser",+ "tr": "Tümünü sıfırla",+ "de": "Alle zurücksetzen",+ "uk": "Скинути все",+ "ca": "Restableix-ho tot"+ },"AUTOMATIONS$VIEW_MODE": {"en": "View mode","ja": "表示モード",@@ -26927,6 +27046,23 @@"uk": "+{{count}}","ca": "+{{count}}"},+ "SETTINGS$SKILLS_PILLS_OVERFLOW_ARIA": {+ "en": "Show {{count}} more",+ "ja": "他に{{count}}件を表示",+ "zh-CN": "显示另外 {{count}} 项",+ "zh-TW": "顯示另外 {{count}} 項",+ "ko-KR": "{{count}}개 더 보기",+ "no": "Vis {{count}} flere",+ "ar": "عرض {{count}} إضافية",+ "de": "{{count}} weitere anzeigen",+ "fr": "Afficher {{count}} de plus",+ "it": "Mostra altri {{count}}",+ "pt": "Mostrar mais {{count}}",+ "es": "Mostrar {{count}} más",+ "tr": "{{count}} tane daha göster",+ "uk": "Показати ще {{count}}",+ "ca": "Mostra {{count}} més"+ },"SETTINGS$SKILLS_SHOW_LESS": {"en": "Show less","ja": "折りたたむ",diff --git a/src/icons/play.svg b/src/icons/play.svgindex 47fa9fbda2..1bad9d88ae 100644--- a/src/icons/play.svg+++ b/src/icons/play.svg@@ -1,12 +1,5 @@<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">- <g clip-path="url(#clip0_8467_30872)">- <path- d="M6.26693 21.4874L6.25583 21.4951L6.24514 21.5033C5.95991 21.7227 5.5 21.5308 5.5 21.0996V2.89961C5.5 2.4684 5.95991 2.2765 6.24514 2.49592L6.25634 2.50452L6.26799 2.51249L19.518 11.5625L19.518 11.5625L19.5226 11.5656C19.8258 11.7677 19.8258 12.1815 19.5226 12.3836L19.5226 12.3835L19.5169 12.3874L6.26693 21.4874Z"- fill="currentColor" stroke="currentColor" />- </g>- <defs>- <clipPath id="clip0_8467_30872">- <rect width="24" height="24" fill="white" />- </clipPath>- </defs>+ <path+ d="M8.4 3.9c-1.1-.66-2.5.13-2.5 1.4v13.4c0 1.27 1.4 2.06 2.5 1.4l11.2-6.7c1.06-.64 1.06-2.16 0-2.8L8.4 3.9Z"+ fill="currentColor" /></svg>diff --git a/src/manifests/automation-insights.ts b/src/manifests/automation-insights.tsindex ed19b0dece..55a3dee8ae 100644--- a/src/manifests/automation-insights.ts+++ b/src/manifests/automation-insights.ts@@ -52,6 +52,8 @@ export interface AutomationRunSummary {/** Lifetime run count, from the response — not the sample's length. */total: number;latestRun: AutomationRun | null;+ /** Newest-first sample used by the list sparkline (same page as the summary). */+ recentRuns: AutomationRun[];/** COMPLETED over COMPLETED+FAILED in the sample. Null with no terminal runs. */recentSuccessRate: number | null;/** Mean completed_at − started_at over the sample's terminal runs. */@@ -92,6 +94,7 @@ export function summarizeAutomationRuns(return {total: response.total,latestRun: response.runs[0] ?? null,+ recentRuns: response.runs,recentSuccessRate:terminal.length === 0 ? null : completed / terminal.length,averageDurationMs:diff --git a/src/manifests/automation-interface.ts b/src/manifests/automation-interface.tsindex 23f3500c36..cce175f13f 100644--- a/src/manifests/automation-interface.ts+++ b/src/manifests/automation-interface.ts@@ -42,6 +42,14 @@ const MOUNTED_ROUTES = {templates: "/automations/templates",} satisfies InterfaceRoutes;+/**+ * File-format section for portable `.automation.json` export/import. A docs+ * pointer for the host's import picker, not interface data — the manifest's+ * `importExport` block has no docs field.+ */+export const AUTOMATION_FILE_FORMAT_DOCS_URL =+ "https://docs.openhands.dev/openhands/usage/agent-canvas/managing-automations#exported-file-format";+function isRecord(value: unknown): value is Record<string, unknown> {return typeof value === "object" && value !== null && !Array.isArray(value);}diff --git a/src/manifests/types.ts b/src/manifests/types.tsindex 3a6c1d954e..5b744cb66b 100644--- a/src/manifests/types.ts+++ b/src/manifests/types.ts@@ -313,6 +313,7 @@ export type InterfaceSubPageId = (typeof INTERFACE_SUB_PAGE_IDS)[number];export const INTERFACE_ICON_SLUGS = ["layout-dashboard","sparkles",+ "library","bot","circle-alert","activity",diff --git a/src/routes/automation-templates.tsx b/src/routes/automation-templates.tsxindex 51fea81ce6..c80312f096 100644--- a/src/routes/automation-templates.tsx+++ b/src/routes/automation-templates.tsx@@ -34,7 +34,7 @@ export default function AutomationTemplates() {<h1 className="text-xl font-semibold text-content">{spec.title}</h1><p className="mt-1 text-sm text-muted">{spec.description}</p></div>- <div className="flex max-w-xl items-stretch">+ <div className="w-full"><SearchInput value={searchQuery} onChange={setSearchQuery} /></div><RecommendedAutomationsLauncher query={searchQuery} />diff --git a/src/routes/automations-list.tsx b/src/routes/automations-list.tsxindex 367d71d7c8..ec275c358b 100644--- a/src/routes/automations-list.tsx+++ b/src/routes/automations-list.tsx@@ -1,12 +1,5 @@-import {- useState,- useMemo,- useCallback,- useRef,- type ChangeEvent,- type ReactNode,-} from "react";-import { FileUp, RefreshCw } from "lucide-react";+import { useState, useMemo, useCallback, type ReactNode } from "react";+import { RefreshCw } from "lucide-react";import { useTranslation } from "react-i18next";import { I18nKey } from "#/i18n/declaration";import {@@ -39,6 +32,7 @@ import { ErrorState } from "#/components/features/automations/error-state";import { BackendNotConfigured } from "#/components/features/automations/backend-not-configured";import { DeleteConfirmationModal } from "#/components/features/automations/delete-confirmation-modal";import { EditAutomationModal } from "#/components/features/automations/detail/edit-automation-modal";+import { AddAutomationMenu } from "#/components/features/automations/add-automation-menu";import { AddAutomationModal } from "#/components/features/automations/add-automation-modal";import { ImportAutomationModal } from "#/components/features/automations/import-automation-modal";import { RecommendedAutomationsLauncher } from "#/components/features/automations/recommended-automations-launcher";@@ -120,7 +114,7 @@ export default function AutomationsList() {const [editTarget, setEditTarget] = useState<Automation | null>(null);const [isAddAutomationOpen, setIsAddAutomationOpen] = useState(false);const [importSpec, setImportSpec] = useState<AutomationSpec | null>(null);- const importInputRef = useRef<HTMLInputElement>(null);+ const [isImportOpen, setIsImportOpen] = useState(false);const active = useActiveBackend();const { navigate } = useNavigation();@@ -234,12 +228,7 @@ export default function AutomationsList() {trackAutomationExported({ backendKind: active.backend.kind });};- const handleImportFile = async (event: ChangeEvent<HTMLInputElement>) => {- const input = event.currentTarget;- const file = input.files?.[0];- input.value = "";- if (!file) return;-+ const handleImportFile = async (file: File) => {try {let parsed: unknown;try {@@ -263,6 +252,7 @@ export default function AutomationsList() {{ ...importSpec, enabled: false },{onSuccess: (created) => {+ setIsImportOpen(false);setImportSpec(null);displaySuccessToastWithLink(t(I18nKey.AUTOMATIONS$IMPORT_SUCCESS, { name: created.name }),@@ -395,33 +385,10 @@ export default function AutomationsList() {{t(I18nKey.AUTOMATIONS$GIT_SYNC$NAV_BUTTON)}</BrandButton>)}- <BrandButton- type="button"- variant="secondary"- testId="automations-import-automation"- className="whitespace-nowrap"- onClick={() => importInputRef.current?.click()}- startContent={<FileUp className="size-4" aria-hidden />}- >- {t(I18nKey.AUTOMATIONS$IMPORT)}- </BrandButton>- <input- ref={importInputRef}- type="file"- accept="application/json,.json"- className="hidden"- data-testid="automations-import-file"- onChange={handleImportFile}+ <AddAutomationMenu+ onAdd={() => setIsAddAutomationOpen(true)}+ onImport={() => setIsImportOpen(true)}/>- <BrandButton- type="button"- variant="secondary"- testId="automations-add-automation"- className="whitespace-nowrap"- onClick={() => setIsAddAutomationOpen(true)}- >- {t(I18nKey.AUTOMATIONS$ADD_AUTOMATION)}- </BrandButton></div></div>@@ -559,11 +526,15 @@ export default function AutomationsList() {/><ImportAutomationModal- isOpen={importSpec !== null}+ isOpen={isImportOpen}spec={importSpec}isImporting={importMutation.isPending}- onClose={() => setImportSpec(null)}+ onClose={() => {+ setIsImportOpen(false);+ setImportSpec(null);+ }}onImport={handleImportConfirm}+ onFile={handleImportFile}/></>,);diff --git a/src/utils/automation-stack-section.ts b/src/utils/automation-stack-section.tsnew file mode 100644index 0000000000..7daa6f4ac8--- /dev/null+++ b/src/utils/automation-stack-section.ts@@ -0,0 +1,2 @@+/** Shared bottom inset for stacked home sections (recommended rail, pinned). */+export const AUTOMATION_STACK_SECTION_BOTTOM_CLASS = "pb-12";diff --git a/src/utils/extension-module-card-classes.ts b/src/utils/extension-module-card-classes.tsindex b4fc3dcf1e..19914261c6 100644--- a/src/utils/extension-module-card-classes.ts+++ b/src/utils/extension-module-card-classes.ts@@ -11,7 +11,7 @@ export const extensionModuleCardInteractiveClassName =/** Shared pill chrome for Skills, automation cards, and related modals. */export const extensionModuleCardPillClassName =- "inline-flex max-w-full shrink-0 items-center whitespace-nowrap rounded-full border border-[var(--oh-border)] bg-[rgba(255,255,255,0.04)] px-2 py-0.5 text-[11px] leading-4 text-tertiary-light";+ "inline-flex max-w-full shrink-0 items-center whitespace-nowrap rounded-full bg-[rgba(255,255,255,0.04)] px-2 py-0.5 text-[11px] leading-4 text-tertiary-light";/** Two-column card grids switch back to one column at or below this width (px). */export const EXTENSION_MODULE_CARD_GRID_SINGLE_COLUMN_MAX_PX = 599;diff --git a/src/utils/recommended-automation-rail.ts b/src/utils/recommended-automation-rail.tsnew file mode 100644index 0000000000..edd781a700--- /dev/null+++ b/src/utils/recommended-automation-rail.ts@@ -0,0 +1,99 @@+import {+ AUTOMATION_CATALOG,+ type RecommendedAutomation,+} from "@openhands/extensions/automations";+import { getFeaturedAutomationIds } from "#/manifests/automation-interface";+import { SETUP_REGISTRY } from "#/manifests/manifest-sources";+import type { Automation } from "#/types/automation";+import { getIntegrationIds } from "#/utils/automation-catalog";++export function getAutomationsByPopularity(+ catalog: RecommendedAutomation[],+): RecommendedAutomation[] {+ return catalog+ .map((automation, index) => ({ automation, index }))+ .sort((a, b) => {+ const byPopularity =+ (b.automation.popularityRank ?? 0) - (a.automation.popularityRank ?? 0);+ return byPopularity || a.index - b.index;+ })+ .map(({ automation }) => automation);+}++/**+ * Slug used to match a catalog entry against an installed automation name.+ * Catalog ids are already kebab-case; installed names are human titles.+ */+export function normalizeAutomationKey(value: string): string {+ return value+ .trim()+ .toLowerCase()+ .replace(/&/g, "and")+ .replace(/[^a-z0-9]+/g, "-")+ .replace(/^-+|-+$/g, "");+}++function catalogMatchKeys(entry: RecommendedAutomation): string[] {+ return [entry.id, entry.name, entry.skill]+ .filter((value): value is string => Boolean(value))+ .map(normalizeAutomationKey);+}++export function isCatalogAutomationAdded(+ entry: RecommendedAutomation,+ installed: readonly Pick<Automation, "name">[],+): boolean {+ const installedKeys = new Set(+ installed.map((automation) => normalizeAutomationKey(automation.name)),+ );+ return catalogMatchKeys(entry).some((key) => installedKeys.has(key));+}++function isAvailableCatalogEntry(entry: RecommendedAutomation): boolean {+ return getIntegrationIds(entry).length > 0;+}++function isProvenAutomation(entry: RecommendedAutomation): boolean {+ return getFeaturedAutomationIds().includes(entry.id);+}++/** Catalog cards that launch a conversation instead of a host setup form. */+export function isConversationLaunchAutomation(+ entry: RecommendedAutomation,+): boolean {+ return SETUP_REGISTRY.findById(entry.id) == null;+}++export interface RecommendedRailGroups {+ proven: RecommendedAutomation[];+ conversation: RecommendedAutomation[];+}++/**+ * Home / dashboard rail: remaining proven workflows, then other useful+ * automations that open in a new conversation. Already-created automations+ * are dropped from both groups.+ */+export function getRecommendedRailGroups(+ installed: readonly Pick<Automation, "name">[],+): RecommendedRailGroups {+ const available = getAutomationsByPopularity(AUTOMATION_CATALOG).filter(+ (entry) =>+ isAvailableCatalogEntry(entry) &&+ !isCatalogAutomationAdded(entry, installed),+ );++ return {+ proven: available.filter(isProvenAutomation),+ conversation: available.filter(+ (entry) =>+ !isProvenAutomation(entry) && isConversationLaunchAutomation(entry),+ ),+ };+}++export function flattenRecommendedRailGroups(+ groups: RecommendedRailGroups,+): RecommendedAutomation[] {+ return [...groups.proven, ...groups.conversation];+}diff --git a/src/utils/scroll-fade-state.ts b/src/utils/scroll-fade-state.tsnew file mode 100644index 0000000000..795996f479--- /dev/null+++ b/src/utils/scroll-fade-state.ts@@ -0,0 +1,18 @@+const SCROLL_EDGE_THRESHOLD_PX = 1;++export interface ScrollFadeState {+ left: boolean;+ right: boolean;+}++/** Whether a horizontal scroller is clipped on each edge. */+export function readScrollFadeState(element: HTMLElement): ScrollFadeState {+ const { scrollLeft, scrollWidth, clientWidth } = element;+ const maxScroll = scrollWidth - clientWidth;+ const hasOverflow = maxScroll > SCROLL_EDGE_THRESHOLD_PX;++ return {+ left: hasOverflow && scrollLeft > SCROLL_EDGE_THRESHOLD_PX,+ right: hasOverflow && scrollLeft < maxScroll - SCROLL_EDGE_THRESHOLD_PX,+ };+}