diff --git a/progress/README.md b/progress/README.md index 6b9685d..48284e8 100644 --- a/progress/README.md +++ b/progress/README.md @@ -9,7 +9,7 @@ A plugin for Paseo 0.13 and later that gives each worktree a live progress dashb The dashboard shows: - the run's title, a headline ("2 of 4 tickets done, 5 questions waiting for you, 1 stuck"), a one-line "now" ticker, and when it was last updated -- a "possibly stale" warning after 15 minutes with no update while tickets remain, unless Paseo shows an agent in the workspace still running, and never once every ticket is done or skipped or the run is finished; working items swap their spinner for a pulsing amber warning +- a "possibly stale" warning after 15 minutes with no update while tickets remain, unless Paseo shows an agent in the workspace still running, and never once every ticket is done or skipped or the run is finished. Working items spin while an agent in the worktree is running, hold still with a dot when it stops, and switch to a pulsing amber warning after 15 minutes with no update - percent of estimated work done, time done of time estimated (like "1h 30m of 2h"; once everything is done, how long it really took), and a bar with one segment per ticket - **Stuck:** blocked tickets, working tickets with no update for longer than their estimate, and blockers the agent flags - **Tickets:** estimate, status, and the working ticket's stage. A ticket that waits for another (`--waits-for T03`) shows "Waits for Ticket 03" under its title until that one is done; waiting is the order of work, so it never counts as stuck, even if the agent also marked it blocked. Press a ticket for its story in a dialog. A summary on top shows its status and stage, time worked against the estimate as a bar that turns red past it, the agent's latest status line while it's working, and the agent on it. Tabs below hold the rest, each only when it has something: the ticket's write-up when it has a `--source` file (the start of it, with the rest a press away), a timeline of its stages and statuses with how long each took, and the activity, questions and deliverables that belong to it. The agent on a ticket shows by its chat title; pressing it opens that chat. Items tagged with `--ticket` belong exactly; older, untagged ones are matched by when they happened and marked "by time" @@ -26,7 +26,7 @@ The panel lives in Explorer, beside the agent chat, so you can watch both. Open On phones, Progress opens in Explorer too. On any phone, the pill stays above the message box while a run is open, so there's always a way in. SVG files, videos and PDFs preview on desktop and in Paseo's web app. On phones, videos and PDFs open on the daemon host, and an SVG file copies its path. A PDF in the Deliverables tab also has a button beside Copy that opens it in a Paseo tab, which is where it shows on an iPhone or iPad. -The first time a run starts in a worktree whose Progress panel has never been opened, the pill shows a spinner and reads **Progress** instead; pressing it opens the panel. Once the panel has been opened there, the plugin writes an empty `progress-panel-opened` file next to the progress file and the nudge never comes back, even for later runs. It doesn't open the panel by itself because Paseo switches to a workspace to open its panel, which would pull you away from whatever you're looking at. +The first time a run starts in a worktree whose Progress panel has never been opened, the pill reads **Progress** instead; pressing it opens the panel. Its icon spins while an agent in the worktree is running and tickets are left, and shows a checklist otherwise. The pill above the message box on phones uses the same icon. Once the panel has been opened there, the plugin writes an empty `progress-panel-opened` file next to the progress file and the nudge never comes back, even for later runs. It doesn't open the panel by itself because Paseo switches to a workspace to open its panel, which would pull you away from whatever you're looking at. ## Install @@ -178,6 +178,11 @@ The progress file, `progress.jsonl`, holds one JSON event per line, each with a ## Changelog +### 1.14.6 + +- [Fixed] **The Progress pill spins only while work is happening.** It used to show a spinner until you first opened the panel, even after every ticket was done or the agent had stopped. Now it spins while an agent in the worktree is running and tickets are left, and shows the checklist icon otherwise. On phones, the pill that stays above the message box follows the same rule. +- [Fixed] **The panel moves only while work is happening.** After the agent stopped, the line under the title, the ticket in progress and its part of the progress bar kept moving for up to 15 minutes. Now they move only while an agent in the worktree is running and hold still when it stops. After 15 minutes with no update, the amber warning appears as before. If the agent finished every ticket but never closed the run, the line under the title kept spinning for good. It now shows a check. + ### 1.14.5 - [Fixed] **Agents record your answer on the first try.** In Claude Code, an agent that hadn't loaded the answer tool guessed its field names, and the call failed once before the agent retried. The skill now has agents load every Progress tool at once, and again after Claude Code compacts a long chat. Asking a question also tells the agent which fields the answer takes. diff --git a/progress/client/dialog-stack.tsx b/progress/client/dialog-stack.tsx index 1993f2f..437e6c8 100644 --- a/progress/client/dialog-stack.tsx +++ b/progress/client/dialog-stack.tsx @@ -2,7 +2,7 @@ import type { PluginWorkspacePanelProps } from "@getpaseo/plugin/client"; import { Icon, Modal } from "@getpaseo/plugin/client/ui"; import React, { useEffect, useRef, useState } from "react"; import { isPage } from "../shared/attachments"; -import type { Dashboard, Question } from "../shared/dashboard"; +import type { Dashboard, Liveness, Question } from "../shared/dashboard"; import { type Attachment, attachmentIcon, useAttachmentOpener } from "./attachments"; import { NarrowProvider } from "./narrow"; import { BackButton, galleryFiles, PreviewContent } from "./preview"; @@ -31,7 +31,7 @@ export function StackedDialog({ questions = [], dashboard, now, - live = true, + liveness = "running", compact = false, context, }: { @@ -42,7 +42,7 @@ export function StackedDialog({ // Needed only when it opens on a ticket. dashboard?: Dashboard; now: number; - live?: boolean; + liveness?: Liveness; // Paseo's phone-sized layout; the ticket's tabs scroll sideways there. compact?: boolean; context: AttachmentContext; @@ -155,7 +155,7 @@ export function StackedDialog({ dashboard={dashboard} ticket={ticket} now={now} - live={live} + liveness={liveness} compact={compact} context={context} onOpenAgent={openAgent} diff --git a/progress/client/i18n.test.ts b/progress/client/i18n.test.ts index 6c6e1c2..c07ca74 100644 --- a/progress/client/i18n.test.ts +++ b/progress/client/i18n.test.ts @@ -213,7 +213,13 @@ test("pending and failed settings reads leave content usable, and a saved overri test("pill icons update same-mode titles and labels without extra polls and ignore late effects after cleanup", async () => { for (const attention of [true, false]) { const { h, effects, cleanups, setLanguage } = languageHarness(); - h.responses["progress.attention"] = { configured: true, questions: attention ? 2 : 0, stuck: attention ? 1 : 0, runOpen: true, panelOpened: attention }; + h.responses["progress.attention"] = { + configured: true, + questions: attention ? 2 : 0, + stuck: attention ? 1 : 0, + run: "ticketsLeft", + panelOpened: attention, + }; const stop = h.load("client/pills.tsx").contributePills(h.client); h.agents.bootstrap([{ agent: { id: "a", workspaceId: "w" } }]); h.workspaces.bootstrap([{ id: "w", workspaceDirectory: "/w", projectRootPath: "/w" }]); diff --git a/progress/client/lifecycle.test.ts b/progress/client/lifecycle.test.ts index b3708a5..fded755 100644 --- a/progress/client/lifecycle.test.ts +++ b/progress/client/lifecycle.test.ts @@ -102,11 +102,11 @@ test("tapping a question reference copies it in the reply format", () => { }); function attentionWith(questions: number, stuck: number, run: { open?: boolean; panelOpened?: boolean } = {}) { - return { configured: true, questions, stuck, runOpen: run.open ?? false, panelOpened: run.panelOpened ?? false }; + return { configured: true, questions, stuck, run: run.open ? "ticketsLeft" : "closed", panelOpened: run.panelOpened ?? false }; } -function report(questions: number, stuck: number, runOpen: boolean, panelOpened: boolean) { - return { configured: true, questions, stuck, runOpen, panelOpened }; +function report(questions: number, stuck: number, run: "closed" | "ticketsLeft" | "ticketsSettled", panelOpened: boolean) { + return { configured: true, questions, stuck, run, panelOpened }; } function openRun(panelOpened: boolean, questions = 0) { @@ -115,25 +115,38 @@ function openRun(panelOpened: boolean, questions = 0) { test("one rule decides what the pill shows, its icon, and whether pressing it opens the popover", () => { const { pillFor, isIdle } = clientHarness(directory).load("client/pill-state.ts"); - const desktop = { phone: false }; - const phone = { phone: true }; - const cases: Array<[string, unknown, { phone: boolean }, unknown]> = [ - ["no progress file", { ...report(2, 1, true, false), configured: false }, desktop, null], - ["questions and stuck", report(2, 1, true, true), desktop, { mode: "attention", label: "2Q · 1 stuck", icon: "stuck" }], - ["questions only keep the full word", report(12, 0, true, true), desktop, { mode: "attention", label: "12 questions", icon: "questions" }], - ["stuck only", report(0, 2, true, true), desktop, { mode: "attention", label: "2 stuck", icon: "stuck" }], - ["one question, even after the run closed", report(1, 0, false, true), desktop, { mode: "attention", label: "1 question", icon: "questions" }], - ["a new run's panel never opened", report(0, 0, true, false), desktop, { mode: "started", label: "Progress", icon: "started" }], - ["panel opened, desktop has Explorer", report(0, 0, true, true), desktop, null], - ["panel opened, a phone needs the way in", report(0, 0, true, true), phone, { mode: "open", label: "Progress", icon: "open" }], - ["a phone after the run finished", report(0, 0, false, true), phone, null], + const desktop = { phone: false, running: true }; + const desktopQuiet = { phone: false, running: false }; + const phone = { phone: true, running: true }; + const phoneQuiet = { phone: true, running: false }; + const cases: Array<[string, unknown, { phone: boolean; running: boolean }, unknown]> = [ + ["no progress file", { ...report(2, 1, "ticketsLeft", false), configured: false }, desktop, null], + ["questions and stuck", report(2, 1, "ticketsLeft", true), desktop, { mode: "attention", label: "2Q · 1 stuck", icon: "stuck" }], + ["questions only keep the full word", report(12, 0, "ticketsLeft", true), desktop, { mode: "attention", label: "12 questions", icon: "questions" }], + ["stuck only", report(0, 2, "ticketsLeft", true), desktop, { mode: "attention", label: "2 stuck", icon: "stuck" }], + ["one question, even after the run closed", report(1, 0, "closed", true), desktop, { mode: "attention", label: "1 question", icon: "questions" }], + ["a new run's panel never opened, agent working", report(0, 0, "ticketsLeft", false), desktop, { mode: "started", label: "Progress", icon: "working" }], + [ + "a new run's panel never opened, agent stopped", + report(0, 0, "ticketsLeft", false), + desktopQuiet, + { mode: "started", label: "Progress", icon: "checklist" }, + ], + ["every ticket settled, agent still running", report(0, 0, "ticketsSettled", false), desktop, { mode: "started", label: "Progress", icon: "checklist" }], + ["a finished run never nudges", report(0, 0, "closed", false), desktop, null], + ["panel opened, desktop has Explorer", report(0, 0, "ticketsLeft", true), desktop, null], + ["panel opened, a phone needs the way in", report(0, 0, "ticketsLeft", true), phone, { mode: "open", label: "Progress", icon: "working" }], + ["a phone while the agent is stopped", report(0, 0, "ticketsLeft", true), phoneQuiet, { mode: "open", label: "Progress", icon: "checklist" }], + ["a phone once every ticket is settled", report(0, 0, "ticketsSettled", true), phone, { mode: "open", label: "Progress", icon: "checklist" }], + ["a phone after the run finished", report(0, 0, "closed", true), phone, null], ]; - for (const [name, input, where, expected] of cases) { - assert.deepEqual(JSON.parse(JSON.stringify(pillFor(input, where))), expected, name); + for (const [name, input, workspace, expected] of cases) { + assert.deepEqual(JSON.parse(JSON.stringify(pillFor(input, workspace))), expected, name); } assert.equal(pillFor(undefined, desktop), null, "not read yet"); - assert.equal(isIdle(report(0, 0, false, true)), true); - assert.equal(isIdle(report(1, 0, false, true)), false, "a question left on a closed run still counts"); + assert.equal(isIdle(report(0, 0, "closed", true)), true); + assert.equal(isIdle(report(0, 0, "ticketsSettled", true)), false, "a settled run isn't finished yet"); + assert.equal(isIdle(report(1, 0, "closed", true)), false, "a question left on a closed run still counts"); }); test("an agent's composer shows a pill while its workspace has questions waiting or something stuck", async () => { @@ -178,7 +191,7 @@ test("an agent's composer shows a pill while its workspace has questions waiting test("a workspace without a progress file never shows a pill", async () => { const h = clientHarness(directory); - h.responses["progress.attention"] = { configured: false, questions: 0, stuck: 0, runOpen: false, panelOpened: false }; + h.responses["progress.attention"] = { configured: false, questions: 0, stuck: 0, run: "closed", panelOpened: false }; const stop = h.load("client/pills.tsx").contributePills(h.client); h.agents.bootstrap([{ agent: { id: "a", workspaceId: "w" } }]); h.workspaces.bootstrap([{ id: "w", workspaceDirectory: "/w", projectRootPath: "/w" }]); @@ -190,7 +203,7 @@ test("a workspace without a progress file never shows a pill", async () => { test("a worktree with nothing going on is checked every 30 seconds instead of every 5", async () => { const h = clientHarness(directory); const { contributePills, PILL_POLL_MS, IDLE_POLL_EVERY } = h.load("client/pills.tsx"); - h.responses["progress.attention"] = { configured: false, questions: 0, stuck: 0, runOpen: false, panelOpened: false }; + h.responses["progress.attention"] = { configured: false, questions: 0, stuck: 0, run: "closed", panelOpened: false }; const stop = contributePills(h.client); h.agents.bootstrap([{ agent: { id: "a", workspaceId: "w" } }]); h.workspaces.bootstrap([{ id: "w", workspaceDirectory: "/w", projectRootPath: "/w" }]); diff --git a/progress/client/locales/en.ts b/progress/client/locales/en.ts index be83175..5bb8f19 100644 --- a/progress/client/locales/en.ts +++ b/progress/client/locales/en.ts @@ -71,6 +71,7 @@ export const messages: ProgressMessages = { workDoneLong: "of estimated work done", stuck: "Stuck", possiblyStalled: "Possibly stalled", + paused: "Paused", waiting: "Waiting", workingSince: "Working since ", startedWorking: "Started working ", diff --git a/progress/client/locales/zh-CN.ts b/progress/client/locales/zh-CN.ts index 7ddbe3f..07da328 100644 --- a/progress/client/locales/zh-CN.ts +++ b/progress/client/locales/zh-CN.ts @@ -70,6 +70,7 @@ export const messages: ProgressMessages = { workDoneLong: "的预计工作已完成", stuck: "卡住", possiblyStalled: "可能已停滞", + paused: "已暂停", waiting: "等待中", workingSince: "开始工作于 ", startedWorking: "开始工作于 ", diff --git a/progress/client/messages.ts b/progress/client/messages.ts index 799b2f2..e8f9a93 100644 --- a/progress/client/messages.ts +++ b/progress/client/messages.ts @@ -43,6 +43,7 @@ export interface ProgressMessages { stuck: string; waiting: string; possiblyStalled: string; + paused: string; workingSince: string; startedWorking: string; flagged: string; diff --git a/progress/client/panel.tsx b/progress/client/panel.tsx index e7c8579..ca35bc7 100644 --- a/progress/client/panel.tsx +++ b/progress/client/panel.tsx @@ -5,7 +5,7 @@ import { LauncherBanner, SkillBanner, useToolsState } from "./launcher"; import { WhatsNewBanner } from "./whats-new"; import { HistoryRow } from "./history"; import { AnsweredQuestionsList, QuestionsSection } from "./questions"; -import { Spinner, StalledPulse, WaitingDot } from "./spinner"; +import { StillDot, WorkingIcon } from "./spinner"; import { IconSwap, PressScale, Presence, StaggerRoot, nativeDriver } from "./motion"; import { SectionTitle } from "./section-title"; import { raised } from "./surfaces"; @@ -16,9 +16,12 @@ import { finishedToFold, isFinished, shortTitle, + livenessOf, + statusLineState, type Activity, type Dashboard, type FileIssue, + type Liveness, type ProgressSegment, type StuckItem, type Ticket, @@ -229,10 +232,9 @@ function DashboardView({ const { messages: m, locale } = useProgressLanguage(); const headline = clientHeadline(locale, dashboard); const now = useNow(15_000); - // Quiet isn't stale while an agent in the workspace is still running. - const stale = dashboard.stale && !agentRunning; const hasHistory = dashboard.activity.length + dashboard.questions.answered.length + dashboard.deliverables.length > 0; - const live = !stale; + const liveness = livenessOf(dashboard, agentRunning); + const statusLine = statusLineState(dashboard, liveness); // Two columns when opened as a wide tab; one in the narrow Explorer pane. const [wide, setWide] = useState(false); const attachmentContext = { workspaceId, workspaceDirectory, navigation }; @@ -258,17 +260,14 @@ function DashboardView({ ))} ) : null} - {/* One status slot: the icon morphs from spinner (or stalled pulse) to the check on finish. */} {dashboard.run?.finished || dashboard.ticker ? ( - {dashboard.run?.finished ? ( + + {statusLine === "finished" || statusLine === "settled" ? ( - ) : live ? ( - ) : ( - + )} } @@ -299,8 +298,8 @@ function DashboardView({ ) : null} - - {stale && dashboard.updatedAt ? ( + + {liveness === "stalled" && dashboard.updatedAt ? ( : null} 0)} order={2}> - {dashboard.progress.totalMin > 0 ? : null} + {dashboard.progress.totalMin > 0 ? : null} setWide(event.nativeEvent.layout.width >= WIDE_MIN)} @@ -366,7 +365,7 @@ function DashboardView({ {m.noItems(dashboard.run?.itemLabel ?? "Ticket")} ) : ( - + )} @@ -522,7 +521,7 @@ function Card({ colors, icon, title, children }: { colors: Colors; icon: string; ); } -function ProgressBar({ colors, progress, live }: { colors: Colors; progress: Dashboard["progress"]; live: boolean }) { +function ProgressBar({ colors, progress, liveness }: { colors: Colors; progress: Dashboard["progress"]; liveness: Liveness }) { const { messages: m, locale } = useProgressLanguage(); const narrow = useNarrow(); return ( @@ -541,14 +540,14 @@ function ProgressBar({ colors, progress, live }: { colors: Colors; progress: Das style={{ flexDirection: "row", gap: 2, height: 8, borderRadius: 4, overflow: "hidden" }} > {progress.segments.map((segment) => ( - + ))} ); } -function Segment({ colors, segment, live }: { colors: Colors; segment: ProgressSegment; live: boolean }) { +function Segment({ colors, segment, liveness }: { colors: Colors; segment: ProgressSegment; liveness: Liveness }) { const working = segment.status === "working"; const color = segment.status === "done" @@ -560,13 +559,11 @@ function Segment({ colors, segment, live }: { colors: Colors; segment: ProgressS : colors.surface2; return ( - {working && live ? : null} + {working && liveness === "running" ? : null} ); } -// A soft pulse on the working segment. Stops when the dashboard is stale so a -// stalled run never looks live. function Shimmer() { const value = useRef(new Animated.Value(0)).current; useEffect(() => { @@ -629,14 +626,14 @@ const finishedShown = new Map(); function TicketList({ colors, dashboard, - live, + liveness, now, workspaceId, onOpen, }: { colors: Colors; dashboard: Dashboard; - live: boolean; + liveness: Liveness; now: number; workspaceId: string; onOpen(id: string): void; @@ -652,7 +649,7 @@ function TicketList({ key={ticket.id} colors={colors} ticket={ticket} - live={live} + liveness={liveness} now={now} onOpen={() => onOpen(ticket.id)} deliverables={dashboard.deliverables.filter((deliverable) => deliverable.ticketId === ticket.id).length} @@ -733,14 +730,14 @@ function FinishedRow({ colors, tickets, shown, onPress }: { colors: Colors; tick function TicketRow({ colors, ticket, - live, + liveness, now, onOpen, deliverables, }: { colors: Colors; ticket: Ticket; - live: boolean; + liveness: Liveness; now: number; onOpen(): void; deliverables: number; @@ -775,10 +772,10 @@ function TicketRow({ style={{ width: 16, paddingTop: 2, alignItems: "center", marginRight: narrow ? 2 : 0 }} > - + @@ -827,19 +824,20 @@ function TicketRow({ ); } -function StatusIcon({ colors, status, live, waiting }: { colors: Colors; status: TicketStatus; live: boolean; waiting: boolean }) { - if (waiting) return ; +function StatusIcon({ colors, status, liveness, waiting }: { colors: Colors; status: TicketStatus; liveness: Liveness; waiting: boolean }) { + const { messages: m } = useProgressLanguage(); + if (waiting) return ; switch (status) { case "done": return ; case "working": - return live ? : ; + return ; case "blocked": return ; case "skipped": return ; default: // Every step still ahead gets the same dot; "Waits for" says which ones are held up. - return ; + return ; } } diff --git a/progress/client/pill-state.ts b/progress/client/pill-state.ts index d093463..1189955 100644 --- a/progress/client/pill-state.ts +++ b/progress/client/pill-state.ts @@ -8,12 +8,15 @@ import type { AttentionResult } from "../shared/rpc"; // - "open": on a phone, a one-tap way into the panel while a run is open. export type Pill = | { mode: "attention"; label: string; icon: "stuck" | "questions" } - | { mode: "started"; label: "Progress"; icon: "started" } - | { mode: "open"; label: "Progress"; icon: "open" }; + | { mode: "started" | "open"; label: "Progress"; icon: "working" | "checklist" }; // What needs the user first, else the nudge, else (on a phone) the way in. // Null when there's no pill. -export function pillFor(report: AttentionResult | undefined, where: { phone: boolean }, m: ProgressMessages = messagesFor("en")): Pill | null { +export function pillFor( + report: AttentionResult | undefined, + workspace: { phone: boolean; running: boolean }, + m: ProgressMessages = messagesFor("en"), +): Pill | null { if (!report?.configured) return null; const { questions, stuck } = report; if (questions || stuck) { @@ -24,13 +27,15 @@ export function pillFor(report: AttentionResult | undefined, where: { phone: boo if (stuck) parts.push(m.stuckCount(stuck)); return { mode: "attention", label: parts.join(" · "), icon: stuck ? "stuck" : "questions" }; } - if (report.runOpen && !report.panelOpened) return { mode: "started", label: "Progress", icon: "started" }; - if (report.runOpen && where.phone) return { mode: "open", label: "Progress", icon: "open" }; + if (report.run === "closed") return null; + const icon = report.run === "ticketsLeft" && workspace.running ? "working" : "checklist"; + if (!report.panelOpened) return { mode: "started", label: "Progress", icon }; + if (workspace.phone) return { mode: "open", label: "Progress", icon }; return null; } // A worktree with nothing going on (no file, or a closed run with nothing // waiting), which the pill checks less often. export function isIdle(report: AttentionResult): boolean { - return !report.runOpen && !report.questions && !report.stuck; + return report.run === "closed" && !report.questions && !report.stuck; } diff --git a/progress/client/pills.tsx b/progress/client/pills.tsx index cdb9fe9..07a2f06 100644 --- a/progress/client/pills.tsx +++ b/progress/client/pills.tsx @@ -22,7 +22,7 @@ export function progressPanel(): { id: "progress"; location: "explorer" } { return { id: "progress", location: "explorer" }; } -type Workspace = { id: string; workspaceDirectory?: string; projectRootPath: string }; +type Workspace = { id: string; workspaceDirectory?: string; projectRootPath: string; status?: string }; function directoryOf(workspace: Workspace): string { return workspace.workspaceDirectory ?? workspace.projectRootPath; @@ -38,9 +38,10 @@ export function contributePills(client: PluginClientContext) { const workspaces = new Map(); // The last report per workspace; pillFor turns it into what the pill shows. const reports = new Map(); + const running = new Set(); let locale = resolveLocale("system"); - const where = { phone: Platform.OS !== "web" }; - const pillOf = (workspaceId: string) => pillFor(reports.get(workspaceId), where, messagesFor(locale)); + const phone = Platform.OS !== "web"; + const pillOf = (workspaceId: string) => pillFor(reports.get(workspaceId), { phone, running: running.has(workspaceId) }, messagesFor(locale)); // Bumped on each report so a poll that was already in flight can't bring the pill back. let openedReports = 0; const listeners = new Set<() => void>(); @@ -77,7 +78,7 @@ export function contributePills(client: PluginClientContext) { listeners.delete(listener); }; }, - () => pillOf(props.workspaceId)?.icon ?? "open", + () => pillOf(props.workspaceId)?.icon ?? "checklist", ); return ( @@ -85,7 +86,7 @@ export function contributePills(client: PluginClientContext) { ) : icon === "questions" ? ( - ) : icon === "started" ? ( + ) : icon === "working" ? ( ) : ( @@ -148,11 +149,20 @@ export function contributePills(client: PluginClientContext) { } }; - // Every change goes through here, so the icons redraw whenever a pill could change. + const redrawIcons = () => { + for (const listener of listeners) listener(); + }; const setReport = (workspaceId: string, next: AttentionResult | undefined) => { if (next) reports.set(workspaceId, next); else reports.delete(workspaceId); - for (const listener of listeners) listener(); + redrawIcons(); + }; + const setRunning = (workspace: Workspace) => { + const isRunning = workspace.status === "running"; + if (running.has(workspace.id) === isRunning) return; + if (isRunning) running.add(workspace.id); + else running.delete(workspace.id); + redrawIcons(); }; // Only workspaces with an agent can show a pill, so only those are read. @@ -197,6 +207,7 @@ export function contributePills(client: PluginClientContext) { workspaces.delete(workspaceId); idleWait.delete(workspaceId); checkedAt.delete(workspaceId); + running.delete(workspaceId); setReport(workspaceId, undefined); }; @@ -206,6 +217,7 @@ export function contributePills(client: PluginClientContext) { snapshot: (entries) => { const next = new Map((entries as Workspace[]).map((workspace) => [workspace.id, directoryOf(workspace)])); for (const id of Array.from(workspaces.keys())) if (!next.has(id)) forget(id); + for (const workspace of entries as Workspace[]) setRunning(workspace); const hasAgent = new Set(agents.map((agent) => agent.workspaceId)); for (const [id, directory] of next) { if (workspaces.get(id) !== directory) { @@ -218,6 +230,7 @@ export function contributePills(client: PluginClientContext) { update: (update: PaseoWorkspaceUpdate) => { if (update.kind === "remove") forget(update.id); else { + setRunning(update.workspace as Workspace); const directory = directoryOf(update.workspace as Workspace); if (workspaces.get(update.workspace.id) !== directory) { workspaces.set(update.workspace.id, directory); diff --git a/progress/client/spinner.tsx b/progress/client/spinner.tsx index e657491..e76b79e 100644 --- a/progress/client/spinner.tsx +++ b/progress/client/spinner.tsx @@ -3,6 +3,7 @@ import React, { useEffect, useRef } from "react"; import { ActivityIndicator, Animated, Easing, Platform, View } from "react-native"; import { useProgressLanguage } from "./language"; import { nativeDriver } from "./motion"; +import type { Liveness } from "../shared/dashboard"; // The system spinner, sized to sit beside a line of text. iOS draws it only // at 20pt, so it's scaled into the slot there. @@ -19,8 +20,6 @@ export function Spinner({ color, size = 12 }: { color: string; size?: number }) ); } -// Shown in place of the spinner once the dashboard is stale: the work may have -// stopped, so the icon asks for attention instead of looking busy. export function StalledPulse({ color, size = 12 }: { color: string; size?: number }) { const { messages: m } = useProgressLanguage(); const opacity = useRef(new Animated.Value(1)).current; @@ -41,14 +40,23 @@ export function StalledPulse({ color, size = 12 }: { color: string; size?: numbe ); } -// A ticket not started yet, or waiting on another one: a still, faded dot, so it -// reads as parked rather than busy. Centered in the same slot an icon would take. -export function WaitingDot({ color, size = 12 }: { color: string; size?: number }) { - const { messages: m } = useProgressLanguage(); +export function StillDot({ color, label, size = 12 }: { color: string; label: string; size?: number }) { const dot = Math.round(size / 2); return ( - + ); } + +export function WorkingIcon({ liveness, accent, warning, size = 12 }: { liveness: Liveness; accent: string; warning: string; size?: number }) { + const { messages: m } = useProgressLanguage(); + switch (liveness) { + case "running": + return ; + case "paused": + return ; + case "stalled": + return ; + } +} diff --git a/progress/client/ticket-dialog.tsx b/progress/client/ticket-dialog.tsx index 1ab0e2b..0bf274b 100644 --- a/progress/client/ticket-dialog.tsx +++ b/progress/client/ticket-dialog.tsx @@ -2,7 +2,7 @@ import { type PluginWorkspacePanelProps, useAgent } from "@getpaseo/plugin/clien import { Icon } from "@getpaseo/plugin/client/ui"; import React, { useState } from "react"; import { Text, View } from "react-native"; -import type { Dashboard, Ticket } from "../shared/dashboard"; +import type { Dashboard, Liveness, Ticket } from "../shared/dashboard"; import { formatClientMinutes, formatClientTimeOfDay, formatClientWorkDone, timelineLabel } from "./i18n"; import { type Link, ticketStory, type TimelineStep } from "../shared/ticket-story"; import { type Attachment, AttachmentList, deliverableAttachment, ticketSourceAttachment } from "./attachments"; @@ -10,7 +10,7 @@ import { StackedDialog } from "./dialog-stack"; import { IconSwap } from "./motion"; import { QuestionState } from "./questions"; import { PressableRow } from "./row"; -import { Spinner, StalledPulse, WaitingDot } from "./spinner"; +import { StillDot, WorkingIcon } from "./spinner"; import { StatusBadge } from "./status-badge"; import { type TabEntry, TabStrip } from "./tabs"; import { TimeBar } from "./time-bar"; @@ -28,7 +28,7 @@ export function TicketDialogs({ openId, setOpenId, now, - live, + liveness, compact, context, }: { @@ -37,7 +37,7 @@ export function TicketDialogs({ openId: string | null; setOpenId(id: string | null): void; now: number; - live: boolean; + liveness: Liveness; compact: boolean; context: AttachmentContext; }) { @@ -49,7 +49,7 @@ export function TicketDialogs({ questions={[...dashboard.questions.open, ...dashboard.questions.answered]} dashboard={dashboard} now={now} - live={live} + liveness={liveness} compact={compact} context={context} /> @@ -61,7 +61,7 @@ export function TicketStoryView({ dashboard, ticket, now, - live, + liveness, compact, context, onOpenAttachment, @@ -72,7 +72,7 @@ export function TicketStoryView({ dashboard: Dashboard; ticket: Ticket; now: number; - live: boolean; + liveness: Liveness; // Paseo's phone-sized layout. compact: boolean; context: AttachmentContext; @@ -109,7 +109,7 @@ export function TicketStoryView({ // A current "Blocked" that's only waiting on another ticket reads as waiting, in the calm color. const shown = last && ticket.waitingFor && step.status === "blocked" ? { ...step, label: { kind: "waiting" as const, id: ticket.waitingFor.id }, waiting: true } : step; - return ; + return ; }); // Only tabs with something in them; the write-up leads when there is one. const tabs: Array & { content: React.ReactNode }> = [ @@ -338,7 +338,8 @@ function LinkNote({ colors, link }: { colors: Colors; link: Link }) { // The same icons as the ticket rows, so a step reads like the status it was. // Past stage steps get an accent ringed dot: work that happened, now over. function Marker({ colors, step }: { colors: Colors; step: TimelineStep & { waiting?: boolean } }) { - if (step.waiting || (step.status === "not_started" && step.label.kind !== "added")) return ; + const { messages: m } = useProgressLanguage(); + if (step.waiting || (step.status === "not_started" && step.label.kind !== "added")) return ; const icon = step.label.kind === "added" ? { name: "CirclePlus", color: colors.foregroundMuted } @@ -353,19 +354,19 @@ function Marker({ colors, step }: { colors: Colors; step: TimelineStep & { waiti } // One line per step: its status icon, what it was, when it began and how long -// it took. The step still going shows the live spinner. +// it took. function TimelineRow({ colors, step, last, now, - live, + liveness, }: { colors: Colors; step: TimelineStep & { waiting?: boolean }; last: boolean; now: number; - live: boolean; + liveness: Liveness; }) { const { messages: m, locale } = useProgressLanguage(); const current = last && step.minutes !== null; @@ -375,8 +376,8 @@ function TimelineRow({ {/* Same 14px slot and gap as attachment rows, so text lines up across sections. */} - - {working ? live ? : : } + + {working ? : } diff --git a/progress/package-lock.json b/progress/package-lock.json index 4398fd8..546d469 100644 --- a/progress/package-lock.json +++ b/progress/package-lock.json @@ -1,12 +1,12 @@ { "name": "@stevecastaneda/paseo-progress", - "version": "1.14.5", + "version": "1.14.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@stevecastaneda/paseo-progress", - "version": "1.14.5", + "version": "1.14.6", "license": "MIT", "devDependencies": { "@getpaseo/client": "0.14.0", diff --git a/progress/package.json b/progress/package.json index 1fd9005..8215e0f 100644 --- a/progress/package.json +++ b/progress/package.json @@ -1,6 +1,6 @@ { "name": "@stevecastaneda/paseo-progress", - "version": "1.14.5", + "version": "1.14.6", "description": "A live progress dashboard per worktree for Paseo, drawn from a file agents write with the Progress tools or the paseo-progress command.", "keywords": [ "coding-agents", diff --git a/progress/server/dashboard.ts b/progress/server/dashboard.ts index 8962ee1..b6a0fe8 100644 --- a/progress/server/dashboard.ts +++ b/progress/server/dashboard.ts @@ -1,9 +1,9 @@ import type { PluginHandlerContext } from "@getpaseo/plugin/server"; import { createHash } from "node:crypto"; import { join } from "node:path"; -import type { Dashboard } from "../shared/dashboard.ts"; +import { hasTicketsAndAllSettled, type Dashboard } from "../shared/dashboard.ts"; import { PROGRESS_FILE_NAME } from "../shared/events.ts"; -import type { AttentionResult, DashboardResult } from "../shared/rpc.ts"; +import type { AttentionResult, DashboardResult, RunState } from "../shared/rpc.ts"; import { markPanelOpened, readProgress } from "./progress-file.ts"; import { findRoot } from "./paths.ts"; import { findStore, historyFolder, inGitRepo, listFolders, setHistoryFolder } from "./store.ts"; @@ -49,11 +49,16 @@ export async function handleGetAttention(input: { workspaceId: string; workspace configured, questions: dashboard.questions.open.length, stuck: dashboard.stuck.length, - runOpen: Boolean(dashboard.run && !dashboard.run.finished), + run: runState(dashboard), panelOpened, }; } +function runState(dashboard: Dashboard): RunState { + if (!dashboard.run || dashboard.run.finished) return "closed"; + return hasTicketsAndAllSettled(dashboard.tickets) ? "ticketsSettled" : "ticketsLeft"; +} + export async function handleListFolders(input: { workspaceId: string; workspaceDirectory: string; folder: string }, _context: PluginHandlerContext) { return listFolders(findRoot(input.workspaceDirectory), input.folder); } diff --git a/progress/server/progress.test.ts b/progress/server/progress.test.ts index d59005e..78f2d59 100644 --- a/progress/server/progress.test.ts +++ b/progress/server/progress.test.ts @@ -13,7 +13,7 @@ import { runCli } from "./cli.ts"; import { handleGetAttention, handleGetDashboard, handleListFolders, handleMarkPanelOpened, handleSetHistoryFolder } from "./dashboard.ts"; import { markPanelOpened, readProgress } from "./progress-file.ts"; import { formatMinutes, formatTimeOfDay, formatWorkDone } from "../shared/format.ts"; -import { finishedToFold, headlineText, type Ticket } from "../shared/dashboard.ts"; +import { finishedToFold, headlineText, livenessOf, statusLineState, type Ticket } from "../shared/dashboard.ts"; import { defaultLauncherPath, installLauncher, launcherStatus, paseoCommands } from "./launcher.ts"; import { defaultSkillPaths, installSkill, relinkSkill, skillDocument, skillSource, skillStatus } from "./skill.ts"; import { @@ -349,6 +349,25 @@ test("the panel folds every finished ticket, and only two or more", () => { assert.deepEqual(folded(), []); }); +test("working items move only while an agent is running, hold still when it stops, and warn once the run goes stale", () => { + assert.equal(livenessOf({ stale: true }, true), "running", "a running agent beats a stale dashboard"); + assert.equal(livenessOf({ stale: false }, true), "running"); + assert.equal(livenessOf({ stale: false }, false), "paused", "idle with a fresh update holds still"); + assert.equal(livenessOf({ stale: true }, false), "stalled"); +}); + +test("the status line shows the liveness until every ticket is done, and a check after", () => { + const finished = { title: "Run", itemLabel: "ticket", startedAt: "", finished: { at: "", outcome: "Shipped" } }; + const open = { title: "Run", itemLabel: "ticket", startedAt: "" }; + for (const state of ["running", "paused", "stalled"] as const) { + assert.equal(statusLineState({ run: finished, tickets: ticketsWith("done", "working") }, state), "finished", `finished beats ${state}`); + assert.equal(statusLineState({ run: finished, tickets: ticketsWith("done", "skipped") }, state), "finished", `finished beats settled and ${state}`); + assert.equal(statusLineState({ run: open, tickets: ticketsWith("done", "skipped") }, state), "settled", `settled beats ${state}`); + assert.equal(statusLineState({ run: open, tickets: ticketsWith("done", "working") }, state), state); + } + assert.equal(statusLineState({ run: open, tickets: [] }, "paused"), "paused", "no tickets yet is not settled"); +}); + test("removed tickets leave the dashboard and their ids are never reused", async (t) => { const w = await worktree(t); await w.run("start", "Run"); @@ -453,10 +472,27 @@ test("the pill check returns only counts and run state", async (t) => { const w = await worktree(t); const context = { paseo: {} as PluginHandlerContext["paseo"] }; const input = { workspaceId: "ws-1", workspaceDirectory: w.directory }; - assert.deepEqual(await handleGetAttention(input, context), { configured: false, questions: 0, stuck: 0, runOpen: false, panelOpened: false }); + assert.deepEqual(await handleGetAttention(input, context), { configured: false, questions: 0, stuck: 0, run: "closed", panelOpened: false }); await w.run("start", "Run"); await w.run("question", "ask", "Spacing", "Tighter?", "--option", "A=Yes | tighter", "--option", "B=No | as is", "--recommend", "A"); - assert.deepEqual(await handleGetAttention(input, context), { configured: true, questions: 1, stuck: 0, runOpen: true, panelOpened: false }); + assert.deepEqual( + await handleGetAttention(input, context), + { configured: true, questions: 1, stuck: 0, run: "ticketsLeft", panelOpened: false }, + "no tickets yet", + ); + await w.run("ticket", "add", "Ticket 01", "--estimate", "10"); + await w.run("ticket", "add", "Ticket 02", "--estimate", "10"); + await w.run("ticket", "update", "T01", "--status", "done"); + assert.equal((await handleGetAttention(input, context)).run, "ticketsLeft", "a ticket still to do"); + await w.run("ticket", "update", "T02", "--status", "skipped"); + assert.deepEqual( + await handleGetAttention(input, context), + { configured: true, questions: 1, stuck: 0, run: "ticketsSettled", panelOpened: false }, + "every ticket done or skipped, finish not called", + ); + await w.run("question", "answer", "Q1", "A"); + await w.run("finish", "Done"); + assert.equal((await handleGetAttention(input, context)).run, "closed", "finished"); }); test("unchanged dashboards are reused until exact stale and overdue boundaries, including clock rollback", async (t) => { diff --git a/progress/shared/dashboard.ts b/progress/shared/dashboard.ts index a35cb1e..d6edf47 100644 --- a/progress/shared/dashboard.ts +++ b/progress/shared/dashboard.ts @@ -203,6 +203,25 @@ export function isSettled(ticket: Ticket): boolean { return ticket.status === "done" || ticket.status === "skipped"; } +export function hasTicketsAndAllSettled(tickets: Ticket[]): boolean { + return tickets.length > 0 && tickets.every(isSettled); +} + +export type Liveness = "running" | "paused" | "stalled"; + +export function livenessOf(dashboard: Pick, agentRunning: boolean): Liveness { + if (agentRunning) return "running"; + return dashboard.stale ? "stalled" : "paused"; +} + +export type StatusLineState = "finished" | "settled" | Liveness; + +export function statusLineState(dashboard: Pick, liveness: Liveness): StatusLineState { + if (dashboard.run?.finished) return "finished"; + if (hasTicketsAndAllSettled(dashboard.tickets)) return "settled"; + return liveness; +} + // The events from the last `run.start` on; earlier runs are ignored. export function latestRun(events: ParsedLine[]): ParsedLine[] { const start = events.findLastIndex(({ event }) => event.type === "run.start"); @@ -371,7 +390,7 @@ export function reduceProgress( const allQuestions = [...questions.values()]; const open = allQuestions.filter((question) => !question.answer); // A finished run has nothing left to stall, so it never goes stale. - const finished = Boolean(run?.finished) || (list.length > 0 && list.every(isSettled)); + const finished = Boolean(run?.finished) || hasTicketsAndAllSettled(list); const answered = allQuestions.filter((question) => question.answer).sort((a, b) => Date.parse(b.answer!.at) - Date.parse(a.answer!.at)); const dashboard: Dashboard = { run, diff --git a/progress/shared/rpc.ts b/progress/shared/rpc.ts index 6fd9b77..bce814b 100644 --- a/progress/shared/rpc.ts +++ b/progress/shared/rpc.ts @@ -32,9 +32,8 @@ export const getDashboard = defineRpc({ output: z.custom(), }); -// What a message-box pill shows: counts that need the user, and whether a run -// is open in a worktree whose panel has never been opened. -export type AttentionResult = { configured: boolean; questions: number; stuck: number; runOpen: boolean; panelOpened: boolean }; +export type RunState = "closed" | "ticketsLeft" | "ticketsSettled"; +export type AttentionResult = { configured: boolean; questions: number; stuck: number; run: RunState; panelOpened: boolean }; export const getAttention = defineRpc({ name: "progress.attention",