Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
Downloads-only CDP interception when the egress monitor is unenrolled (SKY-14066) (#8208)
Shuchang Zheng8d6418564a62
diff --git a/skyvern-frontend/src/routes/workflows/copilot/CopilotWorkingStatus.test.tsx b/skyvern-frontend/src/routes/workflows/copilot/CopilotWorkingStatus.test.tsxnew file mode 100644index 000000000..47b777ac3--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/copilot/CopilotWorkingStatus.test.tsx@@ -0,0 +1,36 @@+// @vitest-environment jsdom++import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { afterEach, describe, expect, it, vi } from "vitest";++import { CopilotWorkingStatus } from "./CopilotWorkingStatus";++afterEach(() => {+ cleanup();+});++describe("CopilotWorkingStatus", () => {+ it("announces the state once, without the cycling verb", () => {+ const { rerender } = render(+ <CopilotWorkingStatus queued={false} onDismissQueued={() => {}} />,+ );+ expect(screen.getByText("Working")).toBeTruthy();++ rerender(<CopilotWorkingStatus queued onDismissQueued={() => {}} />);+ expect(screen.getByText("Message queued")).toBeTruthy();+ // The verb re-renders every few seconds, so it must stay out of the+ // announcement or a screen reader repeats it forever.+ const verb = screen.getByTestId("copilot-working-status").firstElementChild;+ expect(verb?.getAttribute("aria-hidden")).toBe("true");+ });++ it("hands the queued message back when the pill is dismissed", () => {+ const onDismissQueued = vi.fn();+ render(<CopilotWorkingStatus queued onDismissQueued={onDismissQueued} />);++ fireEvent.click(+ screen.getByRole("button", { name: "Edit queued message" }),+ );+ expect(onDismissQueued).toHaveBeenCalledTimes(1);+ });+});diff --git a/skyvern-frontend/src/routes/workflows/copilot/CopilotWorkingStatus.tsx b/skyvern-frontend/src/routes/workflows/copilot/CopilotWorkingStatus.tsxnew file mode 100644index 000000000..2b71c2382--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/copilot/CopilotWorkingStatus.tsx@@ -0,0 +1,55 @@+import { Cross2Icon } from "@radix-ui/react-icons";+import { useEffect, useState } from "react";++import { VERB_CYCLE_MS, pickWorkingVerb } from "./workingVerbs";++type Props = {+ queued: boolean;+ onDismissQueued: () => void;+};++export function CopilotWorkingStatus({ queued, onDismissQueued }: Props) {+ const [verb, setVerb] = useState(() => pickWorkingVerb());++ useEffect(() => {+ const timer = setInterval(+ () => setVerb((previous) => pickWorkingVerb(previous)),+ VERB_CYCLE_MS,+ );+ return () => clearInterval(timer);+ }, []);++ return (+ <div+ className="mb-[9px] flex items-center gap-2 pl-[2px]"+ data-testid="copilot-working-status"+ >+ <span+ key={verb}+ aria-hidden+ className="min-w-0 truncate duration-150 animate-in fade-in"+ >+ <span className="animate-copilot-verb-shimmer bg-[linear-gradient(90deg,#6B7688_0%,#EAF3FF_50%,#6B7688_100%)] bg-[length:220%_100%] bg-clip-text text-[13.5px] font-semibold text-transparent motion-reduce:animate-none motion-reduce:bg-none motion-reduce:text-[#9AA5B6]">+ {verb}…+ </span>+ </span>+ <span className="sr-only" aria-live="polite">+ {queued ? "Message queued" : "Working"}+ </span>+ {queued ? (+ <div className="ml-auto flex shrink-0 items-center gap-1 whitespace-nowrap rounded-full bg-slate-400/[0.12] py-[3px] pl-[10px] pr-[5px] text-xs text-muted-foreground">+ 1 message queued+ <button+ type="button"+ onClick={onDismissQueued}+ title="Edit queued message"+ aria-label="Edit queued message"+ className="rounded px-[3px] hover:text-accent-foreground"+ >+ <Cross2Icon className="h-3 w-3" />+ </button>+ </div>+ ) : null}+ </div>+ );+}diff --git a/skyvern-frontend/src/routes/workflows/copilot/NarrativeView.tsx b/skyvern-frontend/src/routes/workflows/copilot/NarrativeView.tsxindex ddceb9921..d54427195 100644--- a/skyvern-frontend/src/routes/workflows/copilot/NarrativeView.tsx+++ b/skyvern-frontend/src/routes/workflows/copilot/NarrativeView.tsx@@ -1283,6 +1283,7 @@ interface DetailViewProps {onCollapse: (() => void) | null;onBlockSelect?: (label: string) => void;uxV1?: boolean;+ workingRowActive?: boolean;}function DetailView({@@ -1290,6 +1291,7 @@ function DetailView({onCollapse,onBlockSelect,uxV1,+ workingRowActive,}: DetailViewProps) {const collapsedOutcomeReason = notConfirmedDisplayReason(turn);const hasBlocks = turn.blocks.length > 0;@@ -1360,7 +1362,7 @@ function DetailView({</div>) : null}- {!hasBlocks && !designStarted && !turn.terminal ? (+ {!hasBlocks && !designStarted && !turn.terminal && !workingRowActive ? (<div className="pl-9 text-[12px] italic text-muted-foreground dark:text-slate-500">Working…</div>@@ -1381,12 +1383,14 @@ interface NarrativeViewProps {turn: TurnNarrativeState;onBlockSelect?: (blockLabel: string) => void;uxV1?: boolean;+ workingRowActive?: boolean;}export function NarrativeView({turn,onBlockSelect,uxV1,+ workingRowActive,}: NarrativeViewProps) {const summary = useMemo(() => computeTurnSummary(turn, { uxV1 }),@@ -1415,6 +1419,7 @@ export function NarrativeView({onCollapse={isComplete ? () => setUserRolled(true) : null}onBlockSelect={onBlockSelect}uxV1={uxV1}+ workingRowActive={workingRowActive}/>);}diff --git a/skyvern-frontend/src/routes/workflows/copilot/NarrativeView.workingLine.test.tsx b/skyvern-frontend/src/routes/workflows/copilot/NarrativeView.workingLine.test.tsxnew file mode 100644index 000000000..2740716a4--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/copilot/NarrativeView.workingLine.test.tsx@@ -0,0 +1,29 @@+// @vitest-environment jsdom++import { cleanup, render, screen } from "@testing-library/react";+import { afterEach, describe, expect, it } from "vitest";++import { NarrativeView } from "./NarrativeView";+import { EMPTY_NARRATIVE, TurnNarrativeState } from "./narrativeState";++const exploringTurn = (): TurnNarrativeState => ({+ ...EMPTY_NARRATIVE,+ turnId: "turn-1",+ turnIndex: 0,+});++afterEach(() => {+ cleanup();+});++describe("NarrativeView — transcript working line", () => {+ it("keeps the line when the composer's verb row is not showing", () => {+ render(<NarrativeView turn={exploringTurn()} uxV1 />);+ expect(screen.getByText("Working…")).toBeTruthy();+ });++ it("drops the line once the composer's verb row carries the state", () => {+ render(<NarrativeView turn={exploringTurn()} uxV1 workingRowActive />);+ expect(screen.queryByText("Working…")).toBeNull();+ });+});diff --git a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.composerControls.test.tsx b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.composerControls.test.tsxindex 838680959..7cea32c4e 100644--- a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.composerControls.test.tsx+++ b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.composerControls.test.tsx@@ -7,6 +7,7 @@ import {waitFor,} from "@testing-library/react";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { COPILOT_WORKING_VERBS } from "./workingVerbs";import {FeatureFlagContext,@@ -285,13 +286,31 @@ describe("WorkflowCopilotChat — S4 composer, copilot_ux_v1 on", () => {// Queued, not sent as a second concurrent turn.expect(postStreaming).toHaveBeenCalledTimes(1);- expect(screen.getByText("Queued")).toBeTruthy();- // Exactly one status line — the Queued chip, not also the legacy- // aria-live text line (browserStatusText is suppressed under S4 so the- // two don't announce the same status twice).+ // The queue now rides in the working row's pill; the standalone chip and+ // the legacy prose status line are both gone, so the state is stated once.+ expect(screen.getByText(/1 message queued/)).toBeTruthy();+ expect(screen.queryByText("Queued")).toBeNull();expect(- screen.getAllByText("Queued — sends when this turn finishes."),- ).toHaveLength(1);+ screen.queryByText("Queued — sends when this turn finishes."),+ ).toBeNull();+ });++ it("shows a cycling Skyvern verb instead of the prose working line", async () => {+ await renderChat({ copilotV2: true, codeBlockMode: true });+ await submit("build me a workflow");+ await waitFor(() => expect(postStreaming).toHaveBeenCalledTimes(1));++ const row = screen.getByTestId("copilot-working-status");+ expect(+ COPILOT_WORKING_VERBS.some((verb) =>+ row.textContent?.includes(`${verb}…`),+ ),+ ).toBe(true);+ expect(+ screen.queryByText(+ "Copilot is working. Your next send will wait for the next turn.",+ ),+ ).toBeNull();});it("disables the morph button (not a dead-looking Send) while a prompt waits on the live browser", async () => {diff --git a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsxindex 085166bfb..6ae4db33a 100644--- a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx+++ b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx@@ -73,6 +73,7 @@ import {import { shouldAutoApplyWorkflowResponse } from "./proposalDisposition";import { shouldArmDraftingGapTimer } from "./copilotPhases";import { InstantAckPlaceholder, NarrativeView } from "./NarrativeView";+import { CopilotWorkingStatus } from "./CopilotWorkingStatus";import { useRunLifecycleAnnouncements } from "./useRunLifecycleAnnouncements";import { ConfirmCard, shouldShowConfirmCard } from "./cards/ConfirmCard";import { DiffCard, shouldShowDiffCard } from "./cards/DiffCard";@@ -2952,7 +2953,9 @@ export function WorkflowCopilotChat({? null: queuedPromptWaitingStatus: isLoading- ? "Copilot is working. Your next send will wait for the next turn."+ ? copilotUxV1Enabled && copilotV2Enabled+ ? null+ : "Copilot is working. Your next send will wait for the next turn.": isWaitingForLiveBrowser? "Live browser is starting. Your next send will wait until it connects.": null;@@ -2973,6 +2976,11 @@ export function WorkflowCopilotChat({const gateActionable =Boolean(proposedWorkflow) && !isLoading && !isLoadingHistory;const hasComposerText = inputValue.trim().length > 0;+ // The cycling verb row plus the stop button's orbiting ring carry the+ // working state, so the prose status line and the queued chip stand down.+ const showWorkingRow = Boolean(+ copilotUxV1Enabled && copilotV2Enabled && isLoading,+ );// A live_browser-reason queued prompt parks with no active turn to stop, so// an empty composer's morph button would render as a guaranteed no-op "Send".// With text typed it does act — it rewrites the parked prompt.@@ -3217,6 +3225,7 @@ export function WorkflowCopilotChat({turn={message.narrative}onBlockSelect={onBlockSelect}uxV1={copilotUxV1Enabled}+ workingRowActive={showWorkingRow}/>{showReviewGate ? (<ReviewGateCard@@ -3542,6 +3551,7 @@ export function WorkflowCopilotChat({turn={narrative}onBlockSelect={onBlockSelect}uxV1={copilotUxV1Enabled}+ workingRowActive={showWorkingRow}/>{copilotUxV1Enabled &&!isLoadingHistory &&@@ -3654,7 +3664,14 @@ export function WorkflowCopilotChat({pending · Review</button>) : null}- {copilotUxV1Enabled &&+ {showWorkingRow ? (+ <CopilotWorkingStatus+ queued={Boolean(queuedPrompt)}+ onDismissQueued={restoreQueuedPromptToComposer}+ />+ ) : null}+ {!showWorkingRow &&+ copilotUxV1Enabled &&copilotV2Enabled &&queuedPrompt &&(queuedPrompt.reason === "working" || queuedBubbleOrphaned) ? (@@ -3673,7 +3690,7 @@ export function WorkflowCopilotChat({</button></div>) : null}- {inputStatusText ? (+ {inputStatusText && !showWorkingRow ? (<divclassName="mb-2 text-xs text-muted-foreground"aria-live="polite"diff --git a/skyvern-frontend/src/routes/workflows/copilot/workingVerbs.test.ts b/skyvern-frontend/src/routes/workflows/copilot/workingVerbs.test.tsnew file mode 100644index 000000000..26462f4d1--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/copilot/workingVerbs.test.ts@@ -0,0 +1,15 @@+import { describe, expect, it } from "vitest";++import { COPILOT_WORKING_VERBS, pickWorkingVerb } from "./workingVerbs";++describe("pickWorkingVerb", () => {+ it("never repeats the verb it just showed", () => {+ let previous = pickWorkingVerb();+ for (let i = 0; i < 500; i += 1) {+ const next = pickWorkingVerb(previous);+ expect(next).not.toBe(previous);+ expect(COPILOT_WORKING_VERBS).toContain(next);+ previous = next;+ }+ });+});diff --git a/skyvern-frontend/src/routes/workflows/copilot/workingVerbs.ts b/skyvern-frontend/src/routes/workflows/copilot/workingVerbs.tsnew file mode 100644index 000000000..e076dbc1e--- /dev/null+++ b/skyvern-frontend/src/routes/workflows/copilot/workingVerbs.ts@@ -0,0 +1,29 @@+export const COPILOT_WORKING_VERBS = [+ "Gliding through the DOM",+ "Nesting the selectors",+ "Perching above the fold",+ "Riding the event loop",+ "Migrating between tabs",+ "Skimming the scroll",+ "Threading the iframe",+ "Scanning the waterfall",+ "Quartering the viewport",+ "Guarding the cache",+ "Hoarding the cookies",+ "Riding the thermals",+ "Scouting the skies",+ "Unfurling wings",+ "Hatching your agent",+ "Kindling the fire",+ "Banking left",+ "Cresting the clouds",+ "Diving in",+ "Scanning the horizon",+];++export const VERB_CYCLE_MS = 3000;++export function pickWorkingVerb(previous?: string): string {+ const pool = COPILOT_WORKING_VERBS.filter((verb) => verb !== previous);+ return pool[Math.floor(Math.random() * pool.length)]!;+}diff --git a/skyvern-frontend/tailwind.config.js b/skyvern-frontend/tailwind.config.jsindex e463a9622..3a4c58d3e 100644--- a/skyvern-frontend/tailwind.config.js+++ b/skyvern-frontend/tailwind.config.js@@ -141,6 +141,10 @@ export default {"copilot-stop-orbit": {to: { transform: "rotate(1turn)" },},+ "copilot-verb-shimmer": {+ from: { backgroundPosition: "180% 0" },+ to: { backgroundPosition: "-80% 0" },+ },glow: {"0%, 100%": { boxShadow: "0 0 8px 2px rgba(234, 179, 8, 0.3)" },"50%": { boxShadow: "0 0 24px 8px rgba(234, 179, 8, 0.6)" },@@ -169,6 +173,7 @@ export default {"collapsible-up-fade":"collapsible-up-fade 0.22s cubic-bezier(0.22, 1, 0.36, 1)","copilot-stop-orbit": "copilot-stop-orbit 3s linear infinite",+ "copilot-verb-shimmer": "copilot-verb-shimmer 2.4s linear infinite",glow: "glow 2.5s ease-in-out infinite","analytics-pulse": "analytics-pulse-ring 0.6s ease-out 1","copilot-row-flash-success": "copilot-row-flash-success 0.6s ease-out",