YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
refactor(pipes): master-detail scheduled tasks list
Louis Beaumontdcffc2950ddd
diff --git a/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx b/apps/screenpipe-app-tauri/components/settings/pipes-section.tsxindex a128d15fe..953b4263d 100644--- a/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx+++ b/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx@@ -1043,6 +1043,9 @@ export function PipesSection() {const [pipes, setPipes] = useState<PipeStatus[]>([]);const [expanded, setExpanded] = useState<string | null>(null);+ // Creating takes over the detail pane instead of living as a permanent form+ // under the list — you only see the composer when you ask for it.+ const [creating, setCreating] = useState(false);const expandedRef = useRef<string | null>(null);const [logs, setLogs] = useState<PipeRunLog[]>([]);const [executions, setExecutions] = useState<PipeExecution[]>([]);@@ -2117,6 +2120,15 @@ export function PipesSection() {}};+ // Master-detail selection. The old accordion toggled a row open and closed;+ // a detail pane must not blank out when you click the row you are already+ // reading, so re-selecting the current pipe is a no-op.+ const selectPipe = (name: string) => {+ setCreating(false);+ if (expanded === name) return;+ toggleExpand(name);+ };+const savePipeContent = useCallback(async (name: string, content: string) => {const pipe = pipes.find((candidate) => candidate.config.name === name);if (pipe && parseEnterpriseManagedVersion(pipe.raw_content) !== null) return;@@ -2367,6 +2379,20 @@ export function PipesSection() {}}>{refreshing ? <Loader2 className="h-3.5 w-3.5 animate-spin text-muted-foreground" /> : <RefreshCw className="h-3.5 w-3.5" />}</Button>+ {/* Creating is an action you take, not a form that sits on the page.+ Only offered when the two-pane list exists to open it into. */}+ {filteredPipes.length > 0 && (+ <Button+ variant="outline"+ size="sm"+ className="h-8 shrink-0 gap-1.5 text-xs"+ onClick={() => setCreating(true)}+ data-testid="pipe-create-open"+ >+ <Plus className="h-3.5 w-3.5" />+ NEW+ </Button>+ )}</div>)}@@ -2490,380 +2516,457 @@ export function PipesSection() {</CardContent></Card>) : (- <div className="flex flex-col gap-2">- {filteredPipes.map((pipe) => {- const recentExecs = pipeExecutions[pipe.config.name] || [];- const isRunning = pipe.is_running || runningPipe === pipe.config.name;- const runningExec = recentExecs.find((e) => e.status === "running");- const lastExec = recentExecs[0];- const runningLabel = runningExec?.started_at- ? formatPipeElapsed(runningExec.started_at)- : runningPipe === pipe.config.name- ? "starting"- : "now";- const hasMissingConnections = (pipe.config.connections ?? []).some((id) => {- // support instance keys like "notion:crm" — match on base id- const baseId = pipeConnectionLookupKey(id);- const conn = availableConnections.find((c) => c.id === baseId);- return !conn || !conn.connected;- });- const lastStatus = isRunning- ? "running"- : pipe.last_success === false- ? "error"- : lastExec?.status === "completed"- ? "ok"- : lastExec?.status === "failed"- ? "error"- : "idle";- const enterpriseManaged = isEnterpriseManagedPipe(pipe);-- return (- <div- key={pipe.config.name}- data-pipe-row={pipe.config.name}- data-testid={`pipe-row-${pipe.config.name}`}- className={cn(- "group border border-border hover:bg-accent/40 transition-colors",- !pipe.config.enabled && "opacity-60",- )}- >- {/* Card top line — the whole row is the expand affordance:- click anywhere (except the star / badges) to open runs,- config and logs. Keyboard-operable via role=button. */}- <div- role="button"- tabIndex={0}- aria-expanded={expanded === pipe.config.name}- onClick={() => toggleExpand(pipe.config.name)}- onKeyDown={(e) => {- if (e.key === "Enter" || e.key === " ") {+ <div className="flex min-h-[28rem] items-stretch border border-border">+ {(() => {+ // Master-detail. The left column stays scannable — name plus one+ // line of schedule and last run — and everything heavier (badges,+ // actions, config, runs, logs) opens in the detail pane. Rows and+ // the detail are built in a single pass so the per-pipe derived+ // state below is computed once and both halves keep this+ // component's scope instead of needing ~40 props threaded out.+ const rows: React.ReactNode[] = [];+ let detail: React.ReactNode = null;++ for (let rowIndex = 0; rowIndex < filteredPipes.length; rowIndex++) {+ const pipe = filteredPipes[rowIndex];+ const recentExecs = pipeExecutions[pipe.config.name] || [];+ const isRunning = pipe.is_running || runningPipe === pipe.config.name;+ const runningExec = recentExecs.find((e) => e.status === "running");+ const lastExec = recentExecs[0];+ const runningLabel = runningExec?.started_at+ ? formatPipeElapsed(runningExec.started_at)+ : runningPipe === pipe.config.name+ ? "starting"+ : "now";+ const hasMissingConnections = (pipe.config.connections ?? []).some((id) => {+ // support instance keys like "notion:crm" — match on base id+ const baseId = pipeConnectionLookupKey(id);+ const conn = availableConnections.find((c) => c.id === baseId);+ return !conn || !conn.connected;+ });+ const lastStatus = isRunning+ ? "running"+ : pipe.last_success === false+ ? "error"+ : lastExec?.status === "completed"+ ? "ok"+ : lastExec?.status === "failed"+ ? "error"+ : "idle";+ const enterpriseManaged = isEnterpriseManagedPipe(pipe);++ const isSelected = expanded === pipe.config.name;+ const triggerCount =+ (pipe.config.trigger?.events?.length || 0) ++ (pipe.config.trigger?.custom?.length || 0);+ const scheduleSummary =+ triggerCount > 0+ ? `${triggerCount} trigger${triggerCount > 1 ? "s" : ""}${+ pipeHasSchedule(pipe.config) ? ` + ${pipeScheduleLabel(pipe.config)}` : ""+ }`+ : pipeHasSchedule(pipe.config)+ ? pipeScheduleLabel(pipe.config)+ : "manual";+ // What actually happened last, spelled out rather than left to+ // colour alone. The detail pane shows this as-is — it has an+ // explicit auto-run control right below, so it doesn't need the+ // paused token.+ const lastRunFact =+ lastStatus === "error"+ ? lastExec?.started_at+ ? `failed ${relativeTime(lastExec.started_at)}`+ : "failed"+ : lastExec?.started_at+ ? `ran ${relativeTime(lastExec.started_at)}`+ : "never run";+ // The row gets exactly one status token, in priority order —+ // never stacked. "paused" outranks the last run because the+ // schedule beside it ("hourly", "daily · 5 PM") otherwise+ // promises runs that will never happen: auto-run is off.+ const lastRunSummary = isRunning+ ? `running ${runningLabel ?? "now"}`+ : !pipe.config.enabled+ ? "paused"+ : lastRunFact;+ const description =+ typeof pipe.config.description === "string" &&+ (pipe.config.description as string).trim()+ ? (pipe.config.description as string).trim()+ : null;+ const isFavorite = pipeFavorites.isFavorite(pipe.config.name);++ rows.push(+ <div+ key={pipe.config.name}+ data-pipe-row={pipe.config.name}+ data-testid={`pipe-row-${pipe.config.name}`}+ role="button"+ tabIndex={0}+ aria-current={isSelected}+ title={`${pipe.config.name} — ${scheduleSummary} · ${lastRunSummary}`}+ onClick={() => selectPipe(pipe.config.name)}+ onKeyDown={(e) => {+ if (e.key === "Enter" || e.key === " ") {+ e.preventDefault();+ selectPipe(pipe.config.name);+ return;+ }+ if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;e.preventDefault();- toggleExpand(pipe.config.name);- }- }}- title={expanded === pipe.config.name ? "collapse" : "open — runs, config, logs"}- className="flex items-center gap-2.5 px-4 pt-3 pb-1 cursor-pointer select-none focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"- >- {/* In select mode, show a checkbox instead of the chevron */}- {selectMode && !enterpriseManaged ? (- <Checkbox- checked={selectedPipes.has(pipe.config.name)}- onCheckedChange={() => toggleSelectPipe(pipe.config.name)}- onClick={(e) => e.stopPropagation()}- className="shrink-0 h-4 w-4"- />- ) : enterpriseManaged ? (- <Lock className="h-4 w-4 shrink-0 text-muted-foreground" />- ) : expanded === pipe.config.name ? (- <ChevronDown className="h-4 w-4 shrink-0 text-muted-foreground transition-colors" />- ) : (- <ChevronRight- className={cn(- "h-4 w-4 shrink-0 text-muted-foreground/50 group-hover:text-foreground transition-colors",- lastStatus === "error" && "text-destructive group-hover:text-destructive",- lastStatus === "running" && "text-foreground animate-pulse",- )}- />- )}-- {/* Favorite toggle — per-machine preference persisted via /pipes/favorites */}- <button- type="button"- onClick={(e) => {- e.stopPropagation();- pipeFavorites.toggle(pipe.config.name);+ const next = filteredPipes[rowIndex + (e.key === "ArrowDown" ? 1 : -1)];+ if (!next) return;+ selectPipe(next.config.name);+ document+ .querySelector<HTMLElement>(+ `[data-pipe-row="${CSS.escape(next.config.name)}"]`,+ )+ ?.focus();}}className={cn(- "shrink-0 p-0.5 rounded hover:bg-accent/60 transition-colors",- pipeFavorites.isFavorite(pipe.config.name)- ? "text-foreground"- : "text-muted-foreground/40 hover:text-muted-foreground"+ "group flex cursor-pointer select-none items-center gap-2.5 border-l-2 px-3 py-2.5 transition-colors duration-150 focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",+ isSelected+ ? "border-l-foreground bg-accent/60"+ : "border-l-transparent hover:bg-accent/30",+ !pipe.config.enabled && !isSelected && "opacity-60",)}- title={pipeFavorites.isFavorite(pipe.config.name) ? "unstar" : "star this scheduled task"}- aria-pressed={pipeFavorites.isFavorite(pipe.config.name)}>- <Star- className={cn(- "h-3.5 w-3.5",- pipeFavorites.isFavorite(pipe.config.name) && "fill-foreground"- )}- />- </button>-- {/* Pipe name + description */}- <div className="flex flex-col min-w-0 flex-1 gap-0.5">- <span className="text-sm font-medium truncate" title={pipe.config.name}>- {pipe.config.name}- </span>- {typeof pipe.config.description === "string" &&- (pipe.config.description as string).trim() && (- <span className="text-xs text-muted-foreground truncate">- {(pipe.config.description as string).trim()}- </span>- )}- </div>-- {/* Team sharing badges */}- {enterpriseManaged && (- <Badge- variant="outline"- className="h-5 shrink-0 gap-1 rounded-none text-[10px]"- title={`organization managed v${parseEnterpriseManagedVersion(pipe.raw_content)} — configuration is enforced by your administrator`}- >- <Lock className="h-2.5 w-2.5" /> managed- </Badge>- )}- {sharedByMe.has(pipe.config.name) && (- <Badge- variant="outline"- className="text-[10px] h-5 shrink-0 gap-1"- title={`shared with your team (v${- (sharedByMe.get(pipe.config.name)?.value as Partial<TeamPipePayload>)- ?.version ?? "?"- })`}- >- <Share2 className="h-2.5 w-2.5" /> shared- </Badge>- )}- {isReceivedTeamPipe(pipe) && !isUnsharedLeftover(pipe) && (- <Badge- variant="secondary"- className="text-[10px] h-5 shrink-0"- title={`team scheduled task v${parseTeamVersion(pipe.raw_content)} — read-only, updates automatically when the author re-shares`}- >- {sharerNameForPipe(pipe.config.name)- ? `team v${parseTeamVersion(pipe.raw_content)} · ${sharerNameForPipe(pipe.config.name)}`- : `team v${parseTeamVersion(pipe.raw_content)}`}- </Badge>- )}- {isUnsharedLeftover(pipe) && (- <Badge- variant="outline"- className="text-[10px] h-5 shrink-0 text-muted-foreground"- title="no longer shared with the team — auto-run was disabled; fork to keep it or delete it"- >- no longer shared- </Badge>- )}- {pipe.config.history && (- <Badge- variant="outline"- className="h-5 shrink-0 rounded-none text-[10px] text-muted-foreground"- title="future runs remember prior context and update one chat"- >- one chat- </Badge>- )}+ {/* In select mode the status dot gives way to a checkbox. */}+ {selectMode && !enterpriseManaged ? (+ <Checkbox+ checked={selectedPipes.has(pipe.config.name)}+ onCheckedChange={() => toggleSelectPipe(pipe.config.name)}+ onClick={(e) => e.stopPropagation()}+ className="h-4 w-4 shrink-0"+ />+ ) : (+ <span+ aria-hidden+ className={cn(+ "h-2 w-2 shrink-0 border",+ isRunning+ ? "animate-pulse border-foreground bg-foreground"+ : lastStatus === "error"+ ? "border-destructive bg-destructive"+ : pipe.config.enabled+ ? "border-foreground/60 bg-foreground/60"+ : "border-muted-foreground/40 bg-transparent",+ )}+ />+ )}- {/* Update badge */}- {availableUpdates[pipe.config.name] && (- <Badge- variant="outline"- className="text-[10px] shrink-0 cursor-pointer border-foreground/30 text-muted-foreground hover:bg-accent transition-colors"- onClick={(e) => {- e.stopPropagation();- const update = availableUpdates[pipe.config.name];- const slug = (pipe.config as any).config?.source_slug as string || pipe.source_slug || pipe.config.name;- if (update.locally_modified) {- setUpdateDialog({- pipeName: pipe.config.name,- slug,- installedVersion: update.installed_version,- latestVersion: update.latest_version,- });- } else {- updatePipe(pipe.config.name, slug);- }- }}- >- {updatingPipe === pipe.config.name ? (- <Loader2 className="h-3 w-3 mr-1 animate-spin" />- ) : (- <ArrowUpCircle className="h-3 w-3 mr-1" />- )}- v{availableUpdates[pipe.config.name].installed_version} → v{availableUpdates[pipe.config.name].latest_version}- </Badge>- )}+ <div className="flex min-w-0 flex-1 flex-col gap-0.5">+ <div className="flex min-w-0 items-center gap-1.5">+ {enterpriseManaged && (+ <Lock+ className="h-3 w-3 shrink-0 text-muted-foreground"+ aria-label="managed by your organization"+ />+ )}+ <span className="truncate text-sm font-medium">{pipe.config.name}</span>+ {hasMissingConnections && (+ <span+ className="shrink-0 font-mono text-[10px] text-destructive"+ title="required connections are not configured"+ >+ setup+ </span>+ )}+ {availableUpdates[pipe.config.name] && (+ <ArrowUpCircle+ className="h-3 w-3 shrink-0 text-muted-foreground"+ aria-label="update available"+ />+ )}+ </div>+ <span className="truncate font-mono text-xs text-muted-foreground">+ {scheduleSummary} · {lastRunSummary}+ </span>+ </div>- {/* Missing connections badge */}- {hasMissingConnections && (<button- className="text-[10px] text-destructive border border-destructive/40 px-1.5 py-0.5 shrink-0 hover:bg-destructive/10 transition-colors font-mono"+ type="button"onClick={(e) => {e.stopPropagation();- setConnectionModal({ pipeName: pipe.config.name, connections: pipe.config.connections ?? [] });+ pipeFavorites.toggle(pipe.config.name);}}- title="required connections are not configured"+ className={cn(+ "shrink-0 p-0.5 transition-opacity duration-150",+ isFavorite+ ? "text-foreground"+ : "text-muted-foreground/50 opacity-0 hover:text-muted-foreground focus:opacity-100 group-hover:opacity-100",+ )}+ title={isFavorite ? "unstar" : "star this scheduled task"}+ aria-pressed={isFavorite}>- setup+ <Star className={cn("h-3.5 w-3.5", isFavorite && "fill-foreground")} /></button>- )}-- {/* Schedule + triggers — the Clock icon marks this as the- cadence (e.g. "4h" = runs every 4h), so it can't be misread- as the last-run time in the column beside it. */}- <span- className="inline-flex items-center justify-end gap-1 text-xs text-muted-foreground shrink-0 text-right font-mono truncate max-w-[180px]"- title={[- pipe.config.trigger?.events?.length || pipe.config.trigger?.custom?.length- ? `triggers: ${[...(pipe.config.trigger?.events || []), ...(pipe.config.trigger?.custom || [])].join(", ")}`- : "",- pipeHasSchedule(pipe.config) ? `schedule: ${pipeScheduleLabel(pipe.config)}` : "",- ].filter(Boolean).join(" | ") || "manual"}- >- {(pipe.config.trigger?.events?.length || 0) + (pipe.config.trigger?.custom?.length || 0) > 0 ? (- `› ${(pipe.config.trigger?.events?.length || 0) + (pipe.config.trigger?.custom?.length || 0)} trigger${((pipe.config.trigger?.events?.length || 0) + (pipe.config.trigger?.custom?.length || 0)) > 1 ? "s" : ""}`- ) : pipeHasSchedule(pipe.config) ? (- <>- <Clock className="h-3 w-3 shrink-0 text-muted-foreground/60" />- {pipeScheduleLabel(pipe.config)}- </>- ) : (- "manual"- )}- {(pipe.config.trigger?.events?.length || 0) + (pipe.config.trigger?.custom?.length || 0) > 0 && pipeHasSchedule(pipe.config) ? (- <span className="text-muted-foreground/50"> + {pipeScheduleLabel(pipe.config)}</span>- ) : null}- </span>+ </div>,+ );++ if (!isSelected) continue;++ detail = (+ <div key={pipe.config.name} data-testid="pipe-detail" className="flex flex-col">+ <div className="border-b border-border px-5 pb-3 pt-4">+ <h3 className="truncate text-base font-medium" title={pipe.config.name}>+ {pipe.config.name}+ </h3>+ {description && (+ <p className="mt-1 text-xs text-muted-foreground">{description}</p>+ )}+ <div className="mt-2 flex flex-wrap items-center gap-1.5">+ <span className="inline-flex items-center gap-1 font-mono text-xs text-muted-foreground">+ <Clock className="h-3 w-3 shrink-0 text-muted-foreground/60" />+ {scheduleSummary}+ </span>+ <span aria-hidden className="font-mono text-xs text-muted-foreground">+ ·+ </span>+ {isRunning ? (+ <PipeActivityIndicator+ kind="running"+ label={runningLabel}+ ariaLabel={`running ${runningLabel ?? "now"}`}+ />+ ) : lastStatus === "error" ? (+ <PipeActivityIndicator+ kind="error"+ label={+ lastExec?.started_at ? relativeTime(lastExec.started_at) : "failed"+ }+ ariaLabel="last run failed"+ />+ ) : (+ <span className="font-mono text-xs text-muted-foreground">+ {lastRunFact}+ </span>+ )}+ {/* Team sharing badges */}+ {enterpriseManaged && (+ <Badge+ variant="outline"+ className="h-5 shrink-0 gap-1 rounded-none text-[10px]"+ title={`organization managed v${parseEnterpriseManagedVersion(pipe.raw_content)} — configuration is enforced by your administrator`}+ >+ <Lock className="h-2.5 w-2.5" /> managed+ </Badge>+ )}+ {sharedByMe.has(pipe.config.name) && (+ <Badge+ variant="outline"+ className="text-[10px] h-5 shrink-0 gap-1"+ title={`shared with your team (v${+ (sharedByMe.get(pipe.config.name)?.value as Partial<TeamPipePayload>)+ ?.version ?? "?"+ })`}+ >+ <Share2 className="h-2.5 w-2.5" /> shared+ </Badge>+ )}+ {isReceivedTeamPipe(pipe) && !isUnsharedLeftover(pipe) && (+ <Badge+ variant="secondary"+ className="text-[10px] h-5 shrink-0"+ title={`team scheduled task v${parseTeamVersion(pipe.raw_content)} — read-only, updates automatically when the author re-shares`}+ >+ {sharerNameForPipe(pipe.config.name)+ ? `team v${parseTeamVersion(pipe.raw_content)} · ${sharerNameForPipe(pipe.config.name)}`+ : `team v${parseTeamVersion(pipe.raw_content)}`}+ </Badge>+ )}+ {isUnsharedLeftover(pipe) && (+ <Badge+ variant="outline"+ className="text-[10px] h-5 shrink-0 text-muted-foreground"+ title="no longer shared with the team — auto-run was disabled; fork to keep it or delete it"+ >+ no longer shared+ </Badge>+ )}+ {pipe.config.history && (+ <Badge+ variant="outline"+ className="h-5 shrink-0 rounded-none text-[10px] text-muted-foreground"+ title="future runs remember prior context and update one chat"+ >+ one chat+ </Badge>+ )}- {/* Last run time */}- <span className="text-xs text-muted-foreground shrink-0 w-24 text-right font-mono">- {isRunning ? (- <PipeActivityIndicator- kind="running"- label={runningLabel}- className="w-full"- ariaLabel={`running ${runningLabel ?? "now"}`}- />- ) : lastStatus === "error" ? (- <PipeActivityIndicator- kind="error"- label={lastExec?.started_at ? relativeTime(lastExec.started_at) : "failed"}- className="w-full"- ariaLabel="last run failed"- />- ) : lastExec?.started_at ? (- relativeTime(lastExec.started_at)- ) : (- <span className="text-muted-foreground/50">never run</span>- )}- </span>- </div>+ {/* Update badge */}+ {availableUpdates[pipe.config.name] && (+ <Badge+ variant="outline"+ className="text-[10px] shrink-0 cursor-pointer border-foreground/30 text-muted-foreground hover:bg-accent transition-colors"+ onClick={(e) => {+ e.stopPropagation();+ const update = availableUpdates[pipe.config.name];+ const slug = (pipe.config as any).config?.source_slug as string || pipe.source_slug || pipe.config.name;+ if (update.locally_modified) {+ setUpdateDialog({+ pipeName: pipe.config.name,+ slug,+ installedVersion: update.installed_version,+ latestVersion: update.latest_version,+ });+ } else {+ updatePipe(pipe.config.name, slug);+ }+ }}+ >+ {updatingPipe === pipe.config.name ? (+ <Loader2 className="h-3 w-3 mr-1 animate-spin" />+ ) : (+ <ArrowUpCircle className="h-3 w-3 mr-1" />+ )}+ v{availableUpdates[pipe.config.name].installed_version} → v{availableUpdates[pipe.config.name].latest_version}+ </Badge>+ )}- {/* Keep secondary actions out of the default scan path. A short- pointer-hover delay prevents rows from expanding while the- cursor passes over the list; keyboard focus remains immediate. */}- <div- data-testid="pipe-card-actions"- className="max-h-0 overflow-hidden opacity-0 pointer-events-none transition-[max-height,opacity] duration-150 delay-0 group-hover:max-h-16 group-hover:opacity-100 group-hover:pointer-events-auto group-hover:delay-200 group-focus-within:max-h-16 group-focus-within:opacity-100 group-focus-within:pointer-events-auto group-focus-within:delay-0"- >- <div className="flex items-center gap-1 px-3 pb-2.5 pt-0.5">- {/* Run is the primary action: keep it first and visually larger- than the AI editing actions that follow. */}- <div className="flex items-center shrink-0">- {isRunning ? (- <Button- variant="outline"- size="icon"- className="h-9 w-9"- onClick={() => stopPipe(pipe.config.name)}- disabled={stoppingPipe === pipe.config.name}- title="stop scheduled task"- aria-label="stop scheduled task"- >- {stoppingPipe === pipe.config.name ? (- <Loader2 className="h-5 w-5 animate-spin" />+ {/* Missing connections badge */}+ {hasMissingConnections && (+ <button+ className="text-[10px] text-destructive border border-destructive/40 px-1.5 py-0.5 shrink-0 hover:bg-destructive/10 transition-colors font-mono"+ onClick={(e) => {+ e.stopPropagation();+ setConnectionModal({ pipeName: pipe.config.name, connections: pipe.config.connections ?? [] });+ }}+ title="required connections are not configured"+ >+ setup+ </button>+ )}+ </div>+ </div>++ {/* Actions belong to the task you opened, so they live in the+ detail header instead of hiding behind a row hover. */}+ <div data-testid="pipe-card-actions" className="border-b border-border">+ <div className="flex items-center gap-1 px-5 py-2.5">+ {/* Run is the primary action: keep it first and visually larger+ than the AI editing actions that follow. */}+ <div className="flex items-center shrink-0">+ {isRunning ? (+ <Button+ variant="outline"+ size="icon"+ className="h-9 w-9"+ onClick={() => stopPipe(pipe.config.name)}+ disabled={stoppingPipe === pipe.config.name}+ title="stop scheduled task"+ aria-label="stop scheduled task"+ >+ {stoppingPipe === pipe.config.name ? (+ <Loader2 className="h-5 w-5 animate-spin" />+ ) : (+ <Square className="h-5 w-5" />+ )}+ </Button>) : (- <Square className="h-5 w-5" />+ <Button+ variant={hasMissingConnections ? "outline" : "default"}+ size="icon"+ className={cn("h-9 w-9", hasMissingConnections && "text-destructive")}+ onClick={() => {+ if (hasMissingConnections) {+ setConnectionModal({ pipeName: pipe.config.name, connections: pipe.config.connections ?? [] });+ } else {+ runPipe(pipe.config.name);+ }+ }}+ disabled={runningPipe === pipe.config.name}+ title={hasMissingConnections ? "configure required connections first" : "run scheduled task"}+ aria-label={hasMissingConnections ? "configure required connections first" : "run scheduled task"}+ >+ {hasMissingConnections+ ? <AlertCircle className="h-5 w-5" />+ : <Play className="h-5 w-5 fill-current" />}+ </Button>)}- </Button>- ) : (+ </div>++ {/* optimize with ai — opens a chat that reads the pipe's prompt+ + recent run logs and suggests improvements in plain english */}+ {!isReadOnlyPipe(pipe) && (<Button- variant={hasMissingConnections ? "outline" : "default"}- size="icon"- className={cn("h-9 w-9", hasMissingConnections && "text-destructive")}+ variant="ghost"+ size="sm"+ className="h-7 gap-1.5 px-2 shrink-0 text-muted-foreground hover:text-foreground"onClick={() => {- if (hasMissingConnections) {- setConnectionModal({ pipeName: pipe.config.name, connections: pipe.config.connections ?? [] });- } else {- runPipe(pipe.config.name);- }+ posthog.capture("pipe_optimize_started", { source: "row_button" });+ navigateHomeAndPrefill({+ context: "the user wants to optimize their pipe",+ prompt: buildOptimizePrompt(pipe.config.name),+ displayLabel: buildOptimizeDisplayLabel(pipe.config.name),+ autoSend: true,+ });}}- disabled={runningPipe === pipe.config.name}- title={hasMissingConnections ? "configure required connections first" : "run scheduled task"}- aria-label={hasMissingConnections ? "configure required connections first" : "run scheduled task"}+ title="optimize this scheduled task with ai — reads recent runs and improves the prompt">- {hasMissingConnections- ? <AlertCircle className="h-5 w-5" />- : <Play className="h-5 w-5 fill-current" />}+ <Sparkles className="h-3.5 w-3.5" />+ optimize with ai</Button>)}- </div>- {/* optimize with ai — opens a chat that reads the pipe's prompt- + recent run logs and suggests improvements in plain english */}- {!isReadOnlyPipe(pipe) && (- <Button- variant="ghost"- size="sm"- className="h-7 gap-1.5 px-2 shrink-0 text-muted-foreground hover:text-foreground"- onClick={() => {- posthog.capture("pipe_optimize_started", { source: "row_button" });- navigateHomeAndPrefill({- context: "the user wants to optimize their pipe",- prompt: buildOptimizePrompt(pipe.config.name),- displayLabel: buildOptimizeDisplayLabel(pipe.config.name),- autoSend: true,- });- }}- title="optimize this scheduled task with ai — reads recent runs and improves the prompt"- >- <Sparkles className="h-3.5 w-3.5" />- optimize with ai- </Button>- )}+ {/* fork lives in the overflow menu: it creates a *different*+ task, so it isn't part of operating this one. */}++ {/* Overflow menu */}+ <div className="flex items-center shrink-0">+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button variant="ghost" size="icon" className="h-7 w-7 shrink-0">+ <MoreHorizontal className="h-3.5 w-3.5" />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ {/* "optimize with ai" stays a visible button — it edits+ THIS task. Fork spawns a new one, so it lives here. */}+ {!isReadOnlyPipe(pipe) && (+ <DropdownMenuItem+ onClick={() => {+ posthog.capture("pipe_remix_started", { source: "row_button" });+ navigateHomeAndPrefill({+ context: "the user wants to fork their pipe into a new one",+ prompt: buildForkPrompt(pipe.config.name),+ displayLabel: `Fork scheduled task: ${pipe.config.name}`,+ autoSend: true,+ });+ }}+ >+ <GitFork className="h-3.5 w-3.5 mr-2" />+ fork into a new task+ </DropdownMenuItem>+ )}- {/* fork — create a NEW pipe based on this one and customize it */}- {!isReadOnlyPipe(pipe) && (- <Button- variant="ghost"- size="sm"- className="h-7 gap-1.5 px-2 shrink-0 text-muted-foreground hover:text-foreground"- onClick={() => {- posthog.capture("pipe_remix_started", { source: "row_button" });- navigateHomeAndPrefill({- context: "the user wants to fork their pipe into a new one",- prompt: buildForkPrompt(pipe.config.name),- displayLabel: `Fork scheduled task: ${pipe.config.name}`,- autoSend: true,- });- }}- title="fork — create a new scheduled task based on this one and customize it"- >- <GitFork className="h-3.5 w-3.5" />- fork- </Button>- )}-- {/* Overflow menu */}- <div className="flex items-center shrink-0">- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button variant="ghost" size="icon" className="h-7 w-7 shrink-0">- <MoreHorizontal className="h-3.5 w-3.5" />- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- {/* "optimize with ai" lives on the row as a visible button now */}-- {/* Team sharing — own pipes can be shared, updated,- unshared; received team pipes are read-only and can- be forked instead. */}- {canShareToTeam && !isReadOnlyPipe(pipe) && (- sharedByMe.has(pipe.config.name) ? (- <>- {sharedContentDiffers(pipe) && (+ {/* Team sharing — own pipes can be shared, updated,+ unshared; received team pipes are read-only and can+ be forked instead. */}+ {canShareToTeam && !isReadOnlyPipe(pipe) && (+ sharedByMe.has(pipe.config.name) ? (+ <>+ {sharedContentDiffers(pipe) && (+ <DropdownMenuItem+ disabled={sharingPipe === pipe.config.name}+ onClick={() => sharePipeToTeam(pipe)}+ >+ {sharingPipe === pipe.config.name ? (+ <Loader2 className="h-3.5 w-3.5 mr-2 animate-spin" />+ ) : (+ <ArrowUpCircle className="h-3.5 w-3.5 mr-2" />+ )}+ push update to team (v+ {nextShareVersion(sharedByMe.get(pipe.config.name)?.value)})+ </DropdownMenuItem>+ )}+ <DropdownMenuItem+ onClick={() => unsharePipeFromTeam(pipe.config.name)}+ >+ <Share2 className="h-3.5 w-3.5 mr-2" />+ unshare from team+ </DropdownMenuItem>+ </>+ ) : (<DropdownMenuItemdisabled={sharingPipe === pipe.config.name}onClick={() => sharePipeToTeam(pipe)}@@ -2871,155 +2974,136 @@ export function PipesSection() {{sharingPipe === pipe.config.name ? (<Loader2 className="h-3.5 w-3.5 mr-2 animate-spin" />) : (- <ArrowUpCircle className="h-3.5 w-3.5 mr-2" />+ <Share2 className="h-3.5 w-3.5 mr-2" />)}- push update to team (v- {nextShareVersion(sharedByMe.get(pipe.config.name)?.value)})+ share with team</DropdownMenuItem>- )}+ )+ )}+ {isReceivedTeamPipe(pipe) && (+ <DropdownMenuItem onClick={() => forkTeamPipe(pipe)}>+ <Copy className="h-3.5 w-3.5 mr-2" />+ fork to edit+ </DropdownMenuItem>+ )}++ {enterpriseManaged && (+ <DropdownMenuItem disabled>+ <Lock className="h-3.5 w-3.5 mr-2" />+ managed by organization+ </DropdownMenuItem>+ )}++ {!isReadOnlyPipe(pipe) && (<DropdownMenuItem- onClick={() => unsharePipeFromTeam(pipe.config.name)}+ disabled={sharingPublic === pipe.config.name}+ onClick={() => sharePipePublic(pipe)}>- <Share2 className="h-3.5 w-3.5 mr-2" />- unshare from team+ {sharingPublic === pipe.config.name ? (+ <Loader2 className="h-3.5 w-3.5 mr-2 animate-spin" />+ ) : (+ <Link className="h-3.5 w-3.5 mr-2" />+ )}+ copy share link</DropdownMenuItem>- </>- ) : (- <DropdownMenuItem- disabled={sharingPipe === pipe.config.name}- onClick={() => sharePipeToTeam(pipe)}+ )}+ {(pipe.source_slug || (pipe.config as any).config?.source_slug) && (+ <DropdownMenuItem+ onClick={() => {+ checkForUpdates();+ toast({ title: "checking for updates..." });+ }}+ >+ <RefreshCw className="h-3.5 w-3.5 mr-2" />+ check for updates+ </DropdownMenuItem>+ )}+ {!isReadOnlyPipe(pipe) && (+ <DropdownMenuItem+ onClick={() => setPublishPipeName(pipe.config.name)}+ >+ <Upload className="h-3.5 w-3.5 mr-2" />+ publish to store+ </DropdownMenuItem>+ )}+ {!enterpriseManaged && <DropdownMenuSeparator />}+ {!enterpriseManaged && <DropdownMenuItem+ onClick={() => {+ if (selectedPipes.has(pipe.config.name)) {+ toggleSelectPipe(pipe.config.name);+ } else {+ if (!selectMode) setSelectMode(true);+ setSelectedPipes((prev) => {+ const next = new Set(prev);+ next.add(pipe.config.name);+ return next;+ });+ }+ }}>- {sharingPipe === pipe.config.name ? (- <Loader2 className="h-3.5 w-3.5 mr-2 animate-spin" />- ) : (- <Share2 className="h-3.5 w-3.5 mr-2" />- )}- share with team- </DropdownMenuItem>- )- )}- {isReceivedTeamPipe(pipe) && (- <DropdownMenuItem onClick={() => forkTeamPipe(pipe)}>- <Copy className="h-3.5 w-3.5 mr-2" />- fork to edit- </DropdownMenuItem>- )}-- {enterpriseManaged && (- <DropdownMenuItem disabled>- <Lock className="h-3.5 w-3.5 mr-2" />- managed by organization- </DropdownMenuItem>- )}-- {!isReadOnlyPipe(pipe) && (- <DropdownMenuItem- disabled={sharingPublic === pipe.config.name}- onClick={() => sharePipePublic(pipe)}- >- {sharingPublic === pipe.config.name ? (- <Loader2 className="h-3.5 w-3.5 mr-2 animate-spin" />- ) : (- <Link className="h-3.5 w-3.5 mr-2" />+ <CheckSquare className="h-3.5 w-3.5 mr-2" />+ {selectedPipes.has(pipe.config.name) ? "deselect" : "select"}+ </DropdownMenuItem>}+ {/* Delete is hidden while a team share is active (the+ sync would reinstall it) but allowed once unshared. */}+ {!enterpriseManaged && (!isReceivedTeamPipe(pipe) || isUnsharedLeftover(pipe)) && (+ <DropdownMenuItem+ className="text-destructive"+ onClick={() => deletePipe(pipe.config.name)}+ >+ <Trash2 className="h-3.5 w-3.5 mr-2" />+ delete+ </DropdownMenuItem>)}- copy share link- </DropdownMenuItem>- )}- {(pipe.source_slug || (pipe.config as any).config?.source_slug) && (- <DropdownMenuItem- onClick={() => {- checkForUpdates();- toast({ title: "checking for updates..." });- }}- >- <RefreshCw className="h-3.5 w-3.5 mr-2" />- check for updates- </DropdownMenuItem>- )}- {!isReadOnlyPipe(pipe) && (- <DropdownMenuItem- onClick={() => setPublishPipeName(pipe.config.name)}- >- <Upload className="h-3.5 w-3.5 mr-2" />- publish to store- </DropdownMenuItem>- )}- {!enterpriseManaged && <DropdownMenuSeparator />}- {!enterpriseManaged && <DropdownMenuItem- onClick={() => {- if (selectedPipes.has(pipe.config.name)) {- toggleSelectPipe(pipe.config.name);- } else {- if (!selectMode) setSelectMode(true);- setSelectedPipes((prev) => {- const next = new Set(prev);- next.add(pipe.config.name);- return next;- });- }- }}- >- <CheckSquare className="h-3.5 w-3.5 mr-2" />- {selectedPipes.has(pipe.config.name) ? "deselect" : "select"}- </DropdownMenuItem>}- {/* Delete is hidden while a team share is active (the- sync would reinstall it) but allowed once unshared. */}- {!enterpriseManaged && (!isReceivedTeamPipe(pipe) || isUnsharedLeftover(pipe)) && (- <DropdownMenuItem- className="text-destructive"- onClick={() => deletePipe(pipe.config.name)}- >- <Trash2 className="h-3.5 w-3.5 mr-2" />- delete- </DropdownMenuItem>- )}- </DropdownMenuContent>- </DropdownMenu>- </div>-- {/* Enable toggle — always visible, pushed to the far right.- Missing connections block ENABLING (can't run), but never- block DISABLING — a stuck-on pipe with broken deps must- always be turn-off-able. */}- <div- className="ml-auto flex items-center"- title={- enterpriseManaged- ? "managed by your organization"- : hasMissingConnections && !pipe.config.enabled- ? "configure required connections before enabling auto-run"- : pipe.config.enabled- ? "auto-running on schedule — click to disable"- : "auto-run disabled — scheduled task can still be run manually"- }- >- <Switch- checked={pipe.config.enabled}- disabled={enterpriseManaged || (hasMissingConnections && !pipe.config.enabled)}- onCheckedChange={(checked) =>- togglePipe(pipe.config.name, checked)- }- />- </div>- </div>- </div>+ </DropdownMenuContent>+ </DropdownMenu>+ </div>- {/* Error line (inline, below row) */}- {!isRunning && pipe.last_success === false && pipe.last_error && (() => {- const error = parsePipeError(pipe.last_error);- if (error.type === "daily_limit" || error.type === "credits_exhausted") return null;- return (- <div className="px-4 pb-2 -mt-1">- <p className="text-[11px] text-red-500/80 truncate max-w-full pl-5">- {error.message}- </p>+ {/* Enable toggle — always visible, pushed to the far right.+ Missing connections block ENABLING (can't run), but never+ block DISABLING — a stuck-on pipe with broken deps must+ always be turn-off-able. */}+ <div+ className="ml-auto flex items-center gap-2"+ title={+ enterpriseManaged+ ? "managed by your organization"+ : hasMissingConnections && !pipe.config.enabled+ ? "configure required connections before enabling auto-run"+ : pipe.config.enabled+ ? "auto-running on schedule — click to disable"+ : "auto-run disabled — scheduled task can still be run manually"+ }+ >+ {/* A naked switch doesn't say what it controls. Name the+ state so it reads without hovering. */}+ <span className="font-mono text-xs text-muted-foreground">+ {pipe.config.enabled ? "auto-run on" : "auto-run off"}+ </span>+ <Switch+ checked={pipe.config.enabled}+ disabled={enterpriseManaged || (hasMissingConnections && !pipe.config.enabled)}+ onCheckedChange={(checked) =>+ togglePipe(pipe.config.name, checked)+ }+ />+ </div>+ </div></div>- );- })()}-- {/* Expanded detail */}- {expanded === pipe.config.name && (- <div className="border-t px-6 pt-4 pb-6">+ {/* Last failure, surfaced above the tabs so you see why a run+ broke before digging into runs or logs. */}+ {!isRunning && pipe.last_success === false && pipe.last_error && (() => {+ const error = parsePipeError(pipe.last_error);+ if (error.type === "daily_limit" || error.type === "credits_exhausted") return null;+ return (+ <div className="border-b border-border px-5 py-2">+ <p className="text-[11px] text-red-500/80 truncate max-w-full">+ {error.message}+ </p>+ </div>+ );+ })()}+ <div className="px-5 pt-4 pb-6"><Tabs defaultValue="config" className="w-full"><TabsList className="w-full justify-start h-9 bg-transparent border-b rounded-none p-0 gap-4 mb-2"><TabsTrigger value="config" className="rounded-none border-b-2 border-transparent data-[state=active]:border-foreground data-[state=active]:bg-transparent data-[state=active]:shadow-none text-xs uppercase tracking-wider px-3 h-8">@@ -3693,49 +3777,102 @@ export function PipesSection() {</div></div>- )}- </div>+ </div>+ );+ }++ return (+ <>+ <div className="max-h-[70vh] w-[19rem] shrink-0 divide-y divide-border overflow-y-auto border-r border-border">+ {rows}+ </div>+ <div className="max-h-[70vh] min-w-0 flex-1 overflow-y-auto">+ {creating ? (+ <div className="px-5 pb-6 pt-4" data-testid="pipe-create-pane">+ <div className="flex items-start gap-2">+ <div className="min-w-0 flex-1">+ <h3 className="text-base font-medium">new scheduled task</h3>+ <p className="mt-1 text-xs text-muted-foreground">+ describe what you want in plain english — screenpipe builds,+ installs, and schedules it for you.+ </p>+ </div>+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7 shrink-0"+ onClick={() => setCreating(false)}+ title="close"+ aria-label="close"+ >+ <X className="h-3.5 w-3.5" />+ </Button>+ </div>++ <form+ className="mt-4"+ onSubmit={(e) => {+ e.preventDefault();+ const form = e.currentTarget;+ const input = form.querySelector("input") as HTMLInputElement;+ const value = input?.value?.trim();+ if (!value) return;+ input.value = "";+ setCreating(false);+ startPipeGeneration(value, "create_box");+ }}+ >+ <div className="flex items-center gap-2">+ <Input+ autoFocus+ placeholder="e.g. every morning, list the people i still need to reply to"+ className="font-mono text-sm"+ />+ <button+ type="submit"+ aria-label="create scheduled task"+ className="inline-flex h-9 w-9 shrink-0 items-center justify-center border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"+ >+ <ArrowRight className="h-4 w-4" />+ </button>+ </div>+ </form>++ <p className="mt-5 text-xs text-muted-foreground">or start from an example</p>+ <div className="mt-2 flex flex-wrap gap-2">+ {PIPE_EXAMPLES.map((ex) => (+ <button+ key={ex.label}+ onClick={() => {+ setCreating(false);+ startPipeGeneration(ex.prompt, "create_box_example");+ }}+ className="inline-flex items-center gap-1.5 border border-border bg-muted/50 px-2.5 py-1.5 text-xs transition-colors hover:bg-muted"+ >+ {ex.label}+ </button>+ ))}+ </div>+ </div>+ ) : (+ detail ?? (+ <div className="flex h-full min-h-[28rem] items-center justify-center px-8 text-center">+ <div className="max-w-xs space-y-1">+ <p className="text-sm text-foreground">select a scheduled task</p>+ <p className="text-xs text-muted-foreground">+ its schedule, prompt, runs and logs open here.+ </p>+ </div>+ </div>+ )+ )}+ </div>+ </>);- })}+ })()}</div>)}- {/* Create your own pipe — at bottom */}- <div className="space-y-2 pt-2">- <div className="flex items-center gap-2">- <Sparkles className="h-4 w-4 text-muted-foreground shrink-0" />- <p className="text-sm font-medium text-foreground">create your own scheduled task</p>- </div>- <p className="text-xs text-muted-foreground">- describe what you want in plain english — screenpipe builds, installs, and schedules it for you.- </p>- <form- onSubmit={(e) => {- e.preventDefault();- const form = e.currentTarget;- const input = form.querySelector("input") as HTMLInputElement;- const value = input?.value?.trim();- if (!value) return;- input.value = "";- startPipeGeneration(value, "create_box");- }}- >- <div className="flex items-center gap-2">- <Input- placeholder="e.g. every morning, list the people i still need to reply to"- className="font-mono text-sm"- />- <button- type="submit"- aria-label="create scheduled task"- className="shrink-0 inline-flex h-9 w-9 items-center justify-center rounded-md border border-border text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"- >- <ArrowRight className="h-4 w-4" />- </button>- </div>- </form>- </div>-{connectionModal && (<PostInstallConnectionsModalopen={!!connectionModal}diff --git a/apps/screenpipe-app-tauri/e2e/specs/pipe-continuous-chat.spec.ts b/apps/screenpipe-app-tauri/e2e/specs/pipe-continuous-chat.spec.tsindex ea5867242..82a9e8be1 100644--- a/apps/screenpipe-app-tauri/e2e/specs/pipe-continuous-chat.spec.ts+++ b/apps/screenpipe-app-tauri/e2e/specs/pipe-continuous-chat.spec.ts@@ -119,10 +119,13 @@ async function openPipeAdvanced(): Promise<void> {await search.waitForExist({ timeout: t(20_000) });await search.setValue(PIPE_NAME);+ // The list is master-detail: the row selects, the detail pane holds config,+ // runs and advanced. Selecting is idempotent — clicking the already-selected+ // row keeps the pane open.const row = await $(`[data-testid="pipe-row-${PIPE_NAME}"]`);await row.waitForExist({ timeout: t(20_000) });- if ((await row.$('[role="button"]').getAttribute("aria-expanded")) !== "true") {- await row.$('[role="button"]').click();+ if ((await row.getAttribute("aria-current")) !== "true") {+ await row.click();}const advanced = await $(`[data-testid="pipe-advanced-tab-${PIPE_NAME}"]`);await advanced.waitForExist({ timeout: t(10_000) });@@ -322,8 +325,8 @@ describe("Pipes: continue in one chat", function () {});expect(await historySwitch.getAttribute("data-state")).toBe("checked");- const row = await $(`[data-testid="pipe-row-${PIPE_NAME}"]`);- expect((await row.getText()).toLowerCase()).toContain("one chat");+ const detail = await $('[data-testid="pipe-detail"]');+ expect((await detail.getText()).toLowerCase()).toContain("one chat");const screenshot = await saveScreenshot("pipe-continuous-chat-setting");expect(existsSync(screenshot)).toBe(true);});@@ -491,8 +494,8 @@ describe("Pipes: continue in one chat", function () {await piConversation.waitForRequestCount(6, "human reply during reset attempt");await openPipeAdvanced();- const row = await $(`[data-testid="pipe-row-${PIPE_NAME}"]`);- const startFresh = await row.$(`[data-testid="pipe-history-reset-${PIPE_NAME}"]`);+ const detail = await $('[data-testid="pipe-detail"]');+ const startFresh = await detail.$(`[data-testid="pipe-history-reset-${PIPE_NAME}"]`);await startFresh.waitForExist({ timeout: t(10_000) });await startFresh.click();@@ -500,7 +503,7 @@ describe("Pipes: continue in one chat", function () {await confirm.waitForExist({ timeout: t(10_000) });await confirm.click();await browser.waitUntil(- async () => (await row.getText()).toLowerCase().includes("context was not cleared"),+ async () => (await detail.getText()).toLowerCase().includes("context was not cleared"),{timeout: t(10_000),interval: 100,@@ -515,7 +518,7 @@ describe("Pipes: continue in one chat", function () {piConversation.setResponseDelay(0);await confirm.click();await browser.waitUntil(- async () => (await row.getText()).toLowerCase().includes("context cleared"),+ async () => (await detail.getText()).toLowerCase().includes("context cleared"),{timeout: t(10_000),interval: 200,diff --git a/apps/screenpipe-app-tauri/e2e/specs/pipes.spec.ts b/apps/screenpipe-app-tauri/e2e/specs/pipes.spec.tsindex ed0e3ef09..5f0ad52f2 100644--- a/apps/screenpipe-app-tauri/e2e/specs/pipes.spec.ts+++ b/apps/screenpipe-app-tauri/e2e/specs/pipes.spec.ts@@ -473,54 +473,57 @@ describe.skip('Pipes: discover → install → play', function () {expect(existsSync(filepath)).toBe(true);});- // ─── Step 5: hover the row to reveal play button, click it ───────────────+ // ─── Step 5: select the row, then run/stop from the detail pane ──────────+ //+ // The list is master-detail (pipes-section.tsx): the row is a scannable+ // summary and every action lives in the detail pane it opens. Actions are+ // therefore scoped to [data-testid="pipe-detail"], not to the row.it('plays and stops the installed pipe', async function () {if (!installedPipeName) {this.skip();return;}- // Walk visible buttons inside the pipes section and find the row by- // text content, then scroll it into view. wdio's `$('button=NAME')`- // text-match selector is recognised by its own parser but the- // generated DOM call uses CSS — when slugs contain characters that- // make the synthesized expression ambiguous (or when several- // sub-tabs are mounted at once), the lookup intermittently fails.- // In-page iteration is unambiguous.++ const row = await $(`[data-testid="pipe-row-${installedPipeName}"]`);+ await row.waitForExist({ timeout: 10_000 });+ await row.scrollIntoView({ block: 'center' });+ // Selecting is idempotent, so only click when this row isn't already open.+ if ((await row.getAttribute('aria-current')) !== 'true') {+ await row.click();+ }++ const detail = await $('[data-testid="pipe-detail"]');+ await detail.waitForExist({ timeout: 10_000 });await browser.waitUntil(- async () =>- (await browser.execute((name: string) => {- const btn = Array.from(document.querySelectorAll<HTMLElement>('button, span')).find(- (b) => b.textContent?.trim() === name- );- if (!btn) return false;- btn.scrollIntoView({ block: 'center', inline: 'center' });- return true;- }, installedPipeName)) as boolean,- { timeout: 8_000, timeoutMsg: `Pipe name button "${installedPipeName}" not found` }+ async () => (await detail.getText()).includes(installedPipeName),+ {+ timeout: 10_000,+ timeoutMsg: `detail pane did not open for "${installedPipeName}"`,+ });await browser.pause(400);- const actionHierarchy = await browser.execute((name: string) => {- for (const nameEl of Array.from(document.querySelectorAll<HTMLElement>('button, span'))) {- if (nameEl.textContent?.trim() !== name) continue;- const row = nameEl.closest<HTMLElement>('div.group');- if (!row) continue;- const actions = Array.from(row.querySelectorAll<HTMLButtonElement>('[data-testid="pipe-card-actions"] button'));- const runButton = row.querySelector<HTMLButtonElement>('button[title="run scheduled task"]');- const optimizeButton = row.querySelector<HTMLButtonElement>('button[title^="optimize this scheduled task"]');- if (!runButton || !optimizeButton) return null;- return {- runIndex: actions.indexOf(runButton),- optimizeIndex: actions.indexOf(optimizeButton),- runHeight: runButton.getBoundingClientRect().height,- optimizeHeight: optimizeButton.getBoundingClientRect().height,- playIconWidth: runButton.querySelector('svg')?.getBoundingClientRect().width ?? 0,- optimizeIconWidth: optimizeButton.querySelector('svg')?.getBoundingClientRect().width ?? 0,- };- }- return null;- }, installedPipeName);+ // Run stays the first and visually largest action, ahead of the AI editing+ // actions — the hierarchy the detail header is supposed to communicate.+ const actionHierarchy = await browser.execute(() => {+ const pane = document.querySelector<HTMLElement>('[data-testid="pipe-detail"]');+ if (!pane) return null;+ const actions = Array.from(+ pane.querySelectorAll<HTMLButtonElement>('[data-testid="pipe-card-actions"] button')+ );+ const runButton = pane.querySelector<HTMLButtonElement>('button[title="run scheduled task"]');+ const optimizeButton = pane.querySelector<HTMLButtonElement>('button[title^="optimize this scheduled task"]');+ if (!runButton || !optimizeButton) return null;+ return {+ runIndex: actions.indexOf(runButton),+ optimizeIndex: actions.indexOf(optimizeButton),+ runHeight: runButton.getBoundingClientRect().height,+ optimizeHeight: optimizeButton.getBoundingClientRect().height,+ playIconWidth: runButton.querySelector('svg')?.getBoundingClientRect().width ?? 0,+ optimizeIconWidth: optimizeButton.querySelector('svg')?.getBoundingClientRect().width ?? 0,+ };+ });expect(actionHierarchy).not.toBeNull();expect(actionHierarchy!.runIndex).toBe(0);@@ -528,42 +531,32 @@ describe.skip('Pipes: discover → install → play', function () {expect(actionHierarchy!.runHeight).toBeGreaterThan(actionHierarchy!.optimizeHeight);expect(actionHierarchy!.playIconWidth).toBeGreaterThan(actionHierarchy!.optimizeIconWidth);- const played = await browser.execute((name: string) => {- for (const nameBtn of Array.from(document.querySelectorAll<HTMLElement>('button, span'))) {- if (nameBtn.textContent?.trim() !== name) continue;- const row = nameBtn.closest<HTMLElement>('div.group');- if (!row) continue;- const playBtn = row.querySelector<HTMLButtonElement>('button[title="run scheduled task"]');- if (playBtn && !playBtn.disabled) {- playBtn.click();- return true;- }- }- return false;- }, installedPipeName);+ const played = await browser.execute(() => {+ const pane = document.querySelector<HTMLElement>('[data-testid="pipe-detail"]');+ const playBtn = pane?.querySelector<HTMLButtonElement>('button[title="run scheduled task"]');+ if (!playBtn || playBtn.disabled) return false;+ playBtn.click();+ return true;+ });// No fallback — if we can't find the play button for the installed pipe, fail explicitlyexpect(played).toBe(true);- // Wait for THIS pipe's row to actually enter the running state — i.e. its- // own "stop pipe" button renders. A manual run starts a real pi subprocess- // that stays alive for tens of seconds, but runPipe() first awaits any- // pending preset save plus a 2s min-delay before POSTing /run, and the row- // only flips after the UI's next status poll — so this legitimately takes a- // few seconds. Scope strictly to the row (not a global stop-button query or- // page text): the scheduler may be running other pipes concurrently, and a- // loose match would let the test race ahead before this run registers.+ // Wait for THIS pipe to actually enter the running state — i.e. its own+ // "stop pipe" button renders in the open detail pane. A manual run starts a+ // real pi subprocess that stays alive for tens of seconds, but runPipe()+ // first awaits any pending preset save plus a 2s min-delay before POSTing+ // /run, and the UI only flips after its next status poll — so this+ // legitimately takes a few seconds. Scope strictly to the detail pane (not a+ // global stop-button query or page text): the scheduler may be running other+ // pipes concurrently, and a loose match would let the test race ahead before+ // this run registers.await browser.waitUntil(async () =>- (await browser.execute((name: string) => {- for (const nameBtn of Array.from(document.querySelectorAll<HTMLElement>('button, span'))) {- if (nameBtn.textContent?.trim() !== name) continue;- const row = nameBtn.closest<HTMLElement>('div.group');- if (!row) continue;- return !!row.querySelector('button[title="stop scheduled task"]');- }- return false;- }, installedPipeName)) as boolean,+ (await browser.execute(() => {+ const pane = document.querySelector<HTMLElement>('[data-testid="pipe-detail"]');+ return !!pane?.querySelector('button[title="stop scheduled task"]');+ })) as boolean,{timeout: 60_000,timeoutMsg: `Pipe "${installedPipeName}" did not enter running state within timeout`,@@ -573,29 +566,18 @@ describe.skip('Pipes: discover → install → play', function () {const filepath = await saveScreenshot('pipes-running');expect(existsSync(filepath)).toBe(true);- // Click the row's stop button. Poll-and-click so a brief disabled flicker+ // Click the stop button. Poll-and-click so a brief disabled flicker// (stoppingPipe spinner from an earlier interaction) doesn't lose the race;// returns true on the first successful click and stops.await browser.waitUntil(async () =>- (await browser.execute((name: string) => {- // Match the name in a <button> OR <span>. The pipe name renders as a- // <span> (pipes-section.tsx), so a 'button'-only scan never locates- // the row and the stop click times out ("Could not click stop- // button") — even though the running-state wait above, which already- // uses 'button, span', passed. Keep the two locators in sync.- for (const nameEl of Array.from(document.querySelectorAll<HTMLElement>('button, span'))) {- if (nameEl.textContent?.trim() !== name) continue;- const row = nameEl.closest<HTMLElement>('div.group');- if (!row) continue;- const stopBtn = row.querySelector<HTMLButtonElement>('button[title="stop scheduled task"]');- if (stopBtn && !stopBtn.disabled) {- stopBtn.click();- return true;- }- }- return false;- }, installedPipeName)) as boolean,+ (await browser.execute(() => {+ const pane = document.querySelector<HTMLElement>('[data-testid="pipe-detail"]');+ const stopBtn = pane?.querySelector<HTMLButtonElement>('button[title="stop scheduled task"]');+ if (!stopBtn || stopBtn.disabled) return false;+ stopBtn.click();+ return true;+ })) as boolean,{timeout: 10_000,timeoutMsg: `Could not click stop button for "${installedPipeName}"`,@@ -603,21 +585,16 @@ describe.skip('Pipes: discover → install → play', function () {);// Stop is best-effort (SIGTERM then a delayed SIGKILL pass), so give the- // subprocess time to die and the row to flip back to the run button.+ // subprocess time to die and the detail pane to flip back to the run button.await browser.waitUntil(async () =>- (await browser.execute((name: string) => {- // Same 'button, span' locator as above — the name is a <span>.- for (const nameEl of Array.from(document.querySelectorAll<HTMLElement>('button, span'))) {- if (nameEl.textContent?.trim() !== name) continue;- const row = nameEl.closest<HTMLElement>('div.group');- if (!row) continue;- const hasStop = !!row.querySelector('button[title="stop scheduled task"]');- const hasRun = !!row.querySelector('button[title="run scheduled task"]');- return !hasStop && hasRun;- }- return false;- }, installedPipeName)) as boolean,+ (await browser.execute(() => {+ const pane = document.querySelector<HTMLElement>('[data-testid="pipe-detail"]');+ if (!pane) return false;+ const hasStop = !!pane.querySelector('button[title="stop scheduled task"]');+ const hasRun = !!pane.querySelector('button[title="run scheduled task"]');+ return !hasStop && hasRun;+ })) as boolean,{timeout: 60_000,timeoutMsg: 'Pipe did not leave running state after clicking stop',