paseo-follow-up 2.7.0-beta.0 → 2.7.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client/view-r.tsx CHANGED
@@ -6,7 +6,7 @@ import { Pressable, Text } from "./text";
6
6
  import { ScrollView } from "./keyboard";
7
7
  import { RichText } from "./rich-text";
8
8
  import { Button, IconButton, focusRing, text, type Theme } from "./kit";
9
- import { readable, runningColor, toneColor } from "./theme";
9
+ import { headlineColor, readable, runningColor, toneColor } from "./theme";
10
10
  import { CardOpenContext, ShownCard } from "./shown-cards";
11
11
  import { useCards, type ViewCard } from "./card-data";
12
12
  import { useCardsOn } from "./display";
@@ -26,11 +26,13 @@ import { followUpObligations } from "../shared/follow-up";
26
26
  import { workspaceNow, lowerLead } from "../shared/now";
27
27
  import { ChipLine, useRowChipActions, type ChipRow } from "./row-chips";
28
28
  import type { RowChip, RowChips } from "../shared/row-chips";
29
- import { indexSections, needChips, needsCount, needsEntries, sectionSummary, stackRows, keyIntent, queuedWords, readerFor, rowSelect, viewAtRow, type IndexSection } from "../shared/view-r";
29
+ import { indexSections, needChips, needLook, needsCount, needsEntries, sectionSummary, stackRows, keyIntent, queuedWords, readerFor, rowSelect, viewAtRow, type IndexSection } from "../shared/view-r";
30
30
  import { takeViewAt, useViewAt } from "./view-at";
31
31
  import type { AgentTreeNode, InboxRow } from "../shared/inbox";
32
32
  import type { Pr, Workspace } from "../shared/model";
33
33
  import type { ViewPlace } from "./agent-card";
34
+ import type { BlockBrief } from "../shared/needs-block";
35
+ import { allQuestions } from "../shared/outside-run";
34
36
 
35
37
  /**
36
38
  * The new workspace view (Display `enable_new_workspace_view`, beta; invariant 220): an index and a reader. A narrow
@@ -65,6 +67,9 @@ type Row = { key: string; section: IndexSection; icon: string; color: string; ti
65
67
  chips?: RowChips | null };
66
68
  type OnChip = (s: ChipRow, chip: RowChip) => void;
67
69
 
70
+ /** What the view's Needs-you list is built from: the permissions, the brief (folding into its question) and the questions. */
71
+ export const needsExtra = (w: Workspace, parts: Pick<ReaderParts, "permissionCount" | "brief">) => ({ permissions: parts.permissionCount, brief: parts.brief?.ask ?? null, questions: allQuestions(w) });
72
+
68
73
  export const INDEX_W = (width: number) => width >= 1400 ? 320 : width >= 1100 ? 300 : 272;
69
74
  const LINKS_SHOWN = 3;
70
75
  const SECTION_LABEL: Record<IndexSection, string> = { goal: "", needs: "Needs you", prs: "Pull requests", cards: "Cards", tasks: "Tasks", links: "Spec and linked", agents: "Agents" };
@@ -75,8 +80,8 @@ export type ReaderParts = {
75
80
  /** Pending permissions, Allow and Deny. */
76
81
  permissions: ReactNode;
77
82
  permissionCount: number;
78
- /** The main agent's open brief and its card. */
79
- brief: { title: string; card: ReactNode } | null;
83
+ /** The main agent's open brief and its card; `ask` is what folds it into its question (shared/needs-block.ts). */
84
+ brief: { title: string; card: ReactNode; ask: BlockBrief } | null;
80
85
  /** Spec and linked's sheet (edit the spec link and the linked items). */
81
86
  editLinks: () => void;
82
87
  };
@@ -250,14 +255,14 @@ function useIndexRows(w: Workspace, theme: Theme, now: number, inboxRows: readon
250
255
  if (w.goal?.trim()) out.push({ key: "goal", section: "goal", icon: "Target", color: c.foregroundMuted, title: w.goal.trim(), muted: true, open: { kind: "overview" }, a11y: `Goal: ${w.goal.trim()}. Opens the overview` });
251
256
  // Needs you: pending permissions, the main agent's open brief, then one row per item in Needs you's own order.
252
257
  // One row per needsEntries entry (invariant 224, one-needs-you-count): every Needs-you number counts these rows.
253
- const entries = needsEntries(needsYou(w, now), { permissions: parts.permissionCount, brief: !!parts.brief });
254
- const glyph = (n: NeedItem): [string, string] => n.kind === "question" ? ["MessageCircleQuestion", c.statusWarning] : n.kind === "merge" ? ["GitMerge", readable(c.statusSuccess, c)]
255
- : n.kind === "send" ? ["Wrench", c.statusDanger] : n.kind === "reviewers" ? ["Users", c.statusWarning] : ["CircleAlert", c.statusWarning];
258
+ const entries = needsEntries(needsYou(w, now), needsExtra(w, parts));
259
+ // One icon and colour per kind, Home's (needLook): a Review never wears a question's glyph.
260
+ const glyph = (e: Parameters<typeof needLook>[0]): [string, string] => { const l = needLook(e); return [l.icon, l.key === "merge" ? readable(c.statusSuccess, c) : headlineColor(l.tone, c)]; };
256
261
  for (const e of entries) {
257
262
  if (e.kind === "permissions") { out.push({ key: "permissions", section: "needs", icon: "ShieldQuestion", color: c.statusWarning, title: e.count === 1 ? "An agent asks to run a tool" : `${e.count} agents ask to run a tool`, meta: "allow or deny", open: { kind: "permissions" } }); continue; }
258
- if (e.kind === "brief") { out.push({ key: "brief", section: "needs", icon: "MessageCircleQuestion", color: c.statusWarning, title: parts.brief!.title, open: { kind: "brief" } }); continue; }
263
+ if (e.kind === "brief") { const [icon, color] = glyph(e); out.push({ key: "brief", section: "needs", icon, color, title: parts.brief!.title, meta: needLook(e).word.toLowerCase(), open: { kind: "brief" } }); continue; }
259
264
  const n = e.item;
260
- const [icon, color] = glyph(n);
265
+ const [icon, color] = glyph(e);
261
266
  // A send names the PRs its repairs are about, so "1 to fix" and "2 repairs" can be told apart.
262
267
  const batch = n.kind === "send" ? w.batches.find(b => b.id === n.batchId) : null;
263
268
  const about = batch ? [...new Set(batch.tasks.map(t => t.target.includes("#") ? `#${t.target.split("#").pop()}` : null).filter(Boolean))].join(", ") : "";
@@ -327,7 +332,7 @@ function useIndexRows(w: Workspace, theme: Theme, now: number, inboxRows: readon
327
332
  const sections = indexSections(wide);
328
333
  const rank = (r: Row) => sections.indexOf(r.section);
329
334
  const sorted = out.map((r, i) => [r, i] as const).sort((a, b) => rank(a[0]) - rank(b[0]) || a[1] - b[1]).map(x => x[0]);
330
- return { all: sorted, rows: sorted, cards, linked: items, sections, summary: (s: IndexSection) => sectionSummary(s, w, now, { rows: inboxRows, cards: cards.current, links: items.length + (w.spec?.url ? 1 : 0), needs: needsYou(w, now), permissions: parts.permissionCount, brief: !!parts.brief, tasks }) };
335
+ return { all: sorted, rows: sorted, cards, linked: items, sections, summary: (s: IndexSection) => sectionSummary(s, w, now, { rows: inboxRows, cards: cards.current, links: items.length + (w.spec?.url ? 1 : 0), needs: needsYou(w, now), ...needsExtra(w, parts), tasks }) };
331
336
  }
332
337
 
333
338
  type Index = ReturnType<typeof useIndexRows>;
@@ -429,9 +434,17 @@ function Reader({ open, workspace: w, theme, compact, now, place, wide, rows, ca
429
434
  switch (open.kind) {
430
435
  case "need": {
431
436
  const n = open.item;
437
+ // A brief folded into this row (the question it points at, the Send or reviewers row it rides on) keeps its words
438
+ // here: its ask and context under the row's head (one-ask-reads-the-same-everywhere).
439
+ const carried = parts.brief && needsEntries(needsYou(w, now), needsExtra(w, parts)).some(e => e.kind === "item" && e.item.key === n.key && e.withBrief);
440
+ const said = carried ? parts.brief!.ask as { ask?: string; context?: string | null } : null;
441
+ const briefWords = said && (said.ask || said.context) ? <View testID="follow-up-r-folded-brief" style={{ gap: 4, marginBottom: 14, paddingLeft: 26 }}>
442
+ {!!said.ask && n.kind !== "question" && <RichText selectable style={[t.body, { color: c.foreground }]}>{said.ask}</RichText>}
443
+ {!!said.context && <RichText selectable style={[t.body, { color: c.foregroundMuted }]}>{said.context}</RichText>}
444
+ </View> : null;
432
445
  if (n.kind === "question") {
433
446
  const q = (w.questions ?? []).find(x => x.id === n.questionId);
434
- body = q ? <>{head("MessageCircleQuestion", c.statusWarning, `${q.id} · ${q.title}`)}
447
+ body = q ? <>{head("MessageCircleQuestion", c.statusWarning, `${q.id} · ${q.title}`)}{briefWords}
435
448
  <CardOpenContext.Provider value={id => onPick({ kind: "card", id, from: open })}>
436
449
  <QuestionBody key={q.id} workspace={w} question={q} theme={theme} compact={compact} now={now} openAgent={openAgent} onAnswered={onAnswered} dismissAt="foot"
437
450
  split={wide} footSticky={!wide} footExtra={wide ? null : <View style={{ gap: 8 }}>
@@ -445,11 +458,13 @@ function Reader({ open, workspace: w, theme, compact, now, place, wide, rows, ca
445
458
  </CardOpenContext.Provider>
446
459
  </> : null;
447
460
  } else if (n.kind === "merge" || n.kind === "reviewers") {
448
- body = <>{head(n.kind === "merge" ? "GitMerge" : "Users", n.kind === "merge" ? readable(c.statusSuccess, c) : c.statusWarning, n.title, n.detail)}
461
+ body = <>{head(n.kind === "merge" ? "GitMerge" : "Users", n.kind === "merge" ? readable(c.statusSuccess, c) : c.statusWarning, n.title, n.detail)}{briefWords}
449
462
  <PrDetail workspace={w} prKey={n.prKey} intent={n.kind === "merge" ? "merge" : "reviewers"} theme={theme} compact={compact} browserReady={browserReady} />
450
463
  {reply(w.mainAgentId, `#${n.number}`)}</>;
451
464
  } else if (n.kind === "send") {
452
- body = <>{head("Wrench", c.statusDanger, `Send ${n.what}`, n.blocker ?? (w.enable_auto_sends ? "Auto-send is on: it goes when the main agent is idle." : "Auto-send is off: it waits for your Send."))}
465
+ // The index row's glyph and colour (needLook): one ask wears one icon in the row and the reader.
466
+ const l = needLook({ kind: "item", item: n });
467
+ body = <>{head(l.icon, headlineColor(l.tone, c), `Send ${n.what}`, n.blocker ?? (w.enable_auto_sends ? "Auto-send is on: it goes when the main agent is idle." : "Auto-send is off: it waits for your Send."))}{briefWords}
453
468
  <View style={{ marginHorizontal: compact ? -16 : -12 }}>{parts.messages}</View>
454
469
  {failingPrs(w).map(p => <View key={p.key} style={{ marginTop: 18, paddingTop: 16, borderTopWidth: 1, borderTopColor: c.border }}>
455
470
  <PrDetail workspace={w} prKey={p.key} intent={null} theme={theme} compact={compact} browserReady={browserReady} />
@@ -460,7 +475,7 @@ function Reader({ open, workspace: w, theme, compact, now, place, wide, rows, ca
460
475
  }
461
476
  break;
462
477
  }
463
- case "brief": body = parts.brief ? <>{head("MessageCircleQuestion", c.statusWarning, parts.brief.title)}<View style={{ marginHorizontal: compact ? -16 : -12 }}>{parts.brief.card}</View></> : null; break;
478
+ case "brief": body = parts.brief ? <>{(() => { const l = needLook({ kind: "brief", briefKind: (parts.brief.ask.kind as never) ?? null }); return head(l.icon, headlineColor(l.tone, c), parts.brief.title); })()}<View style={{ marginHorizontal: compact ? -16 : -12 }}>{parts.brief.card}</View></> : null; break;
464
479
  case "permissions": body = <>{head("ShieldQuestion", c.statusWarning, "Allow or deny", "An agent waits for your answer before it runs the tool.")}<View style={{ marginHorizontal: compact ? -16 : -12 }}>{parts.permissions}</View></>; break;
465
480
  case "pr": {
466
481
  const p = w.prs.find(x => x.key === open.key);
@@ -538,7 +553,7 @@ function Reader({ open, workspace: w, theme, compact, now, place, wide, rows, ca
538
553
  case "overview": {
539
554
  // The goal, what the work waits on, and the main agent's last words; reachable at any time from the goal row.
540
555
  const main = workspaceNow(w, rows, now).find(n => n.role === "main");
541
- const waiting = needsCount(needsYou(w, now), { permissions: parts.permissionCount, brief: !!parts.brief });
556
+ const waiting = needsCount(needsYou(w, now), needsExtra(w, parts));
542
557
  const live = w.batches.filter(b => b.state === "pending" || b.state === "sending" || b.state === "sent" || b.state === "uncertain");
543
558
  const waits = w.prs.filter(p => p.snapshot?.state === "OPEN" && prTone(p) !== "approved").map(p => {
544
559
  const tone = prTone(p); const word = prWord(compactPrStatus(p).label);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "paseo-follow-up",
3
3
  "private": false,
4
- "version": "2.7.0-beta.0",
4
+ "version": "2.7.0-beta.2",
5
5
  "description": "Every agent, one inbox. Follow-up brings what all your coding agents need from you into one ranked list, and follows their work through merge, deploy and after.",
6
6
  "type": "module",
7
7
  "files": [
@@ -15,7 +15,7 @@ import { mergeBlockers } from "../shared/pr-actions";
15
15
  import { recoveryBatch } from "../shared/follow-up";
16
16
  import { prLink, type PrLink } from "../shared/presentation";
17
17
  import { flagHeadline } from "../shared/headline";
18
- import { resolveUntil, sectionOf, type InboxRow } from "../shared/inbox";
18
+ import { quietFinish, resolveUntil, sectionOf, type InboxRow } from "../shared/inbox";
19
19
  import { needKey, needsYou } from "../shared/attention";
20
20
  import { completionCheck, type Pr, type State, type Workspace } from "../shared/model";
21
21
  import { configuredReviewers, reviewerLoginSchema, noReviewers, resolveReviewers, reviewerConfig, reviewerLabel, withoutAuthor, type ReviewerEntry } from "../shared/reviewers";
@@ -36,6 +36,7 @@ import { DISPLAY_KEYS, displayPreferences, HOME_DETAIL_DEFAULT, CATCH_UP_RAIL_DE
36
36
  import { DEFAULT_SEARCH_SHORTCUT, NEW_SHORTCUTS, SEARCH_SHORTCUTS } from "../shared/search-key";
37
37
  import { DEFAULT_SORT, MENU_SORTS } from "../shared/sort";
38
38
  import { DEFAULT_HOME_VIEW, GROUPINGS, parseHomeView, SHOW_ITEMS } from "../shared/home-arrange";
39
+ import { rowFlagHeadline } from "../shared/home";
39
40
  import { SCALE } from "../shared/scale";
40
41
  import { boundDone, newestFirst, pageInput } from "../shared/paged";
41
42
  import { boundReply } from "./bounded-reply";
@@ -636,12 +637,15 @@ export class AgentActions {
636
637
  const tracked = new Map(state.workspaces.map(w => [w.id, w]));
637
638
  const held = !!this.d.autoSendsHeld?.();
638
639
  // Flagged, snoozed, running and signed-off-today rows (and your own) in full; quiet ones as the newest few and a count.
639
- const listed = rows.filter(r => !args.flagged_only || r.needs && !r.snooze);
640
+ // A helper's or delegated child's quiet finish is no ask on Home either (quietFinish, invariant 249): not flagged here.
641
+ const quiet = (r: (typeof rows)[number]) => quietFinish(r, r.workspaceId ? tracked.get(r.workspaceId)?.mainAgentId : null);
642
+ const listed = rows.filter(r => !args.flagged_only || r.needs && !r.snooze && !quiet(r));
640
643
  const bounded = boundDone(listed, r => r.agentId !== caller && sectionOf(r, now) === null, { newestFirst: newestFirst(listed, r => Date.parse(r.lastActivityAt ?? "") || 0), hint: "inbox_list offset/limit pages these (newest first)", offset: args.offset, limit: args.limit });
641
644
  return { enabled, you: caller, quiet: bounded.done, rows: bounded.items.map(r => {
642
- const head = flagHeadline(r, now);
643
645
  // Home's Sending row rides its workspace's main agent: queued or sent, when and why, and whether send_repairs would go through.
644
646
  const w = r.workspaceId ? tracked.get(r.workspaceId) : undefined;
647
+ // The same headline as Home's row (rowFlagHeadline, invariant 249).
648
+ const head = quiet(r) ? null : rowFlagHeadline(r, w, now);
645
649
  const sending = w && w.mainAgentId === r.agentId ? sendingOf(w, now, { held }) : null;
646
650
  // An outside run on this agent (docs/outside-runs.md): its work line and what it holds open for the developer.
647
651
  const run = w?.outsideRun && (w.outsideRun.agentId ?? w.mainAgentId) === r.agentId ? w.outsideRun : null;
@@ -8,7 +8,7 @@ import type { State } from "../shared/model";
8
8
  import type { Priority } from "../shared/priorities";
9
9
  import type { Brief } from "../shared/brief";
10
10
  import { flagHeadline } from "../shared/headline";
11
- import { tailSteps, HOME_GROUPS, type PaseoWorkspaceLite, type TailStep } from "../shared/home";
11
+ import { rowFlagHeadline, tailSteps, HOME_GROUPS, type PaseoWorkspaceLite, type TailStep } from "../shared/home";
12
12
  import { isOpen as questionOpen } from "../shared/questions";
13
13
  import { classify, latestPrompt, ledgerSender, type Sources } from "./inbox-classifier";
14
14
  import {
@@ -313,8 +313,9 @@ export class Overseer {
313
313
  if (!agent) throw new Error(`No agent ${agentId}. Use an agentId from workstreams.`);
314
314
  const [read, inbox, state, brief, lites] = await Promise.all([this.steps(paseo, agentId, n, agent).catch(() => null), this.d.inbox.list(), this.d.store.snapshot(), this.d.inbox.brief(agentId).catch(() => null), this.d.workspaces().catch(() => [])]);
315
315
  const row = inbox.rows.find(r => r.agentId === agentId);
316
- const head = row ? flagHeadline(row, this.now()) : null;
317
316
  const w = state.workspaces.find(w => w.id === agent.workspaceId && w.enable_tracking);
317
+ // The same headline as Home's row (rowFlagHeadline, invariant 249).
318
+ const head = row ? rowFlagHeadline(row, w, this.now()) : null;
318
319
  const loaded = isLoaded(agent);
319
320
  const asks = [
320
321
  ...(head ? [`${head.label}${head.line && head.line !== head.label ? `: ${head.line}` : ""}`] : []),
@@ -180,7 +180,9 @@ type NeedItemBase =
180
180
  */
181
181
  | { kind: "person"; key: string; taskKey: string; prKey: string | null; review: boolean; /** Only part of the task (Batch.waitingOn): the agent goes on with the rest. */ part: boolean; title: string; detail: string }
182
182
  /** `finish`: the Done check. It never auto-sends, so it always waits on you. */
183
- | { kind: "send"; key: string; batchId: string; title: string; tasks: string[]; /** "2 repairs": what the message holds, in the developer's words (send-words). */ what: string; blocker: string | null; finish?: true }
183
+ | { kind: "send"; key: string; batchId: string; title: string; tasks: string[]; /** "2 repairs": what the message holds, in the developer's words (send-words). */ what: string; blocker: string | null; finish?: true;
184
+ /** The PRs its repairs are about: Follow-up's own PR-event brief for one of them folds into this row (shared/needs-block.ts). */ prKeys?: string[];
185
+ /** Only the backlog Auto-send found when it turned on (invariant 203): Home folds these into one line (invariant 249). */ backlog?: true }
184
186
  | { kind: "decision"; key: string; obligationId: string; title: string; detail: string }
185
187
  | { kind: "question"; key: string; questionId: string; title: string; detail: string; state: QuestionState; big: string | null }
186
188
  /**
@@ -387,7 +389,9 @@ function computeAllNeeds(w: Workspace, now: number): NeedItem[] {
387
389
  items.push(completionCheck(b)
388
390
  ? { kind: "send", key: `send:${b.id}`, batchId: b.id, tasks: b.tasks.map(t => t.title), what: sendItems(b.tasks), blocker: sendBlocker(w, b), title: FINISH_LINE, finish: true }
389
391
  : { kind: "send", key: `send:${b.id}`, batchId: b.id, tasks: b.tasks.map(t => t.title), what: sendItems(b.tasks), blocker: sendBlocker(w, b),
392
+ prKeys: [...new Set(b.tasks.flatMap(t => t.target.includes("#") ? [t.target] : []))],
390
393
  // Say it once: the tasks are rows in Tasks; the send item says only why it waits on you, and its button how many.
394
+ ...(w.enable_auto_sends && w.sendWait !== "stale" && w.sendWait !== "unloaded" && backlogOnly(w, b) ? { backlog: true as const } : {}),
391
395
  title: w.enable_auto_sends ? capitalize(w.sendWait !== "stale" && w.sendWait !== "unloaded" && backlogOnly(w, b) ? BASELINE_REASON : STALE_REASON) : autoOffLine(b.tasks) });
392
396
  }
393
397
  const blocking = (pr: Pr) => w.prActions.some(a => prActionBlocks(a, [pr.key]));
package/shared/brief.ts CHANGED
@@ -729,6 +729,17 @@ export function briefCardAsk<B extends Pick<Brief, "state" | "kind" | "source" |
729
729
  }
730
730
 
731
731
  /** The PR an add-reviewers brief asks about: its Add reviewers move's PR. Null for every other kind. */
732
+ /**
733
+ * Follow-up's own PR-event brief (a conflict, review threads, a failing check: `source` followup, kind review): a test
734
+ * for the PR keys it is about (its facts' PR, its Open PR move, else a "#N" its ask names). Null for any other brief.
735
+ * Its repair rides a Send row, which it folds into (shared/needs-block.ts).
736
+ */
737
+ export function repairBriefPrs(b: { kind?: string; source?: string; factsPr?: string | null; ask?: string; moves?: readonly { kind: string; prKey?: string | null }[] }): ((prKey: string) => boolean) | null {
738
+ if (b.kind !== "review" || b.source !== "followup") return null;
739
+ const keys = [b.factsPr, ...(b.moves ?? []).map(m => m.prKey)].filter((k): k is string => !!k);
740
+ const numbers = keys.length ? [] : [...(b.ask ?? "").matchAll(/#(\d+)\b/g)].map(m => m[1]!);
741
+ return key => keys.includes(key) || numbers.includes(key.split("#").pop()!);
742
+ }
732
743
  export function reviewersBriefPr(b: { kind: string; moves?: readonly { kind: string; prKey?: string | null }[]; prKey?: string }): string | null {
733
744
  if (b.kind !== "reviewers") return null;
734
745
  return b.prKey ?? b.moves?.find(m => m.kind === "add_reviewers")?.prKey ?? null;
@@ -6,6 +6,7 @@ import { z } from "zod";
6
6
  import type { HomeModel, Workstream } from "./home";
7
7
  import type { InboxRow } from "./inbox";
8
8
  import type { NeedItem } from "./attention";
9
+ import { repairBriefPrs } from "./brief";
9
10
 
10
11
  export type CardKind = "permission" | "question" | "item" | "brief" | "finished" | "answer";
11
12
  /**
@@ -31,25 +32,43 @@ export const ANSWER_TIER = 3 as const;
31
32
 
32
33
  /**
33
34
  * The deck, in Home's Needs-you order: the order the developer already sees in the list (blocking asks first, then
34
- * decisions, then finished turns; inside a tier the chosen sort, AI priority included). Inside a workstream: a pending
35
- * permission, then each open question, then every other item, then the agent's own ask when nothing above speaks for it.
35
+ * decisions, then finished turns; inside a tier the chosen sort, AI priority included). One card per Needs-you row, so
36
+ * Catch up counts what Needs you counts (one-ask-reads-the-same-everywhere): the row's lead ask, in the workspace
37
+ * block's order (a pending permission, the agent's own ask unless it points at a question, each open question, every
38
+ * other item). When it is handled the row's next ask is its card (`sync` adds it after the row's last card). The
39
+ * fresh-install backlog (rows whose only ask is the backlog Send) is one card, its first workspace's, as it is one line.
40
+ * `model` is the arranged model (Display's filters applied), the one `useHomeCounts` counts.
36
41
  */
37
- export function deckCards({ model, rows, items, answers }: Source): DeckCard[] {
38
- const needs = model.groups.find(g => g.id === "needs")?.items ?? [];
42
+ export function deckCards(source: Source): DeckCard[] {
39
43
  const out: DeckCard[] = [];
40
- for (const s of needs) {
44
+ let backlog = false;
45
+ for (const s of source.model.groups.find(g => g.id === "needs")?.items ?? []) {
46
+ if (s.backlog) { if (backlog) continue; backlog = true; }
47
+ const [lead] = rowCards(s, source);
48
+ if (lead) out.push(lead);
49
+ }
50
+ return out;
51
+ }
52
+
53
+ /** Every card one Needs-you row holds, its lead first (the workspace block's order). */
54
+ export function rowCards(s: Workstream, { rows, items, answers }: Source): DeckCard[] {
55
+ const out: DeckCard[] = [];
56
+ {
41
57
  const row = s.agentId ? rows.find(r => r.agentId === s.agentId) ?? null : null;
42
58
  const reasons = row?.needs?.reasons.map(r => r.reason) ?? [];
43
59
  const before = out.length;
44
60
  if (reasons.includes("permission")) out.push({ key: `${s.key}|permission`, kind: "permission", s });
45
61
  const asks = s.workspaceId ? items(s.workspaceId) : [];
62
+ const brief = row?.brief as { kind?: string; source?: string; ask?: string; questionIds?: string[] } | null | undefined;
63
+ const pointsAtQuestion = !!brief?.questionIds?.some(id => asks.some(i => i.kind === "question" && i.questionId === id));
64
+ // Follow-up's own PR-event brief folds into the Send row that holds its repair (shared/needs-block.ts): no card of its own.
65
+ const repair = brief ? repairBriefPrs(brief as never) : null;
66
+ const folded = !!repair && asks.some(i => i.kind === "send" && !i.finish && (i.prKeys ?? []).some(repair));
67
+ if (brief && !pointsAtQuestion && !folded && BRIEF_CARD_KINDS.includes(brief.kind ?? "")) out.push({ key: `${s.key}|brief`, kind: "brief", s });
46
68
  for (const item of asks) {
47
69
  if (item.kind === "question") out.push({ key: `${s.key}|${item.questionId}`, kind: "question", s, questionId: item.questionId, item });
48
70
  else out.push({ key: `${s.key}|${item.key}`, kind: "item", s, item });
49
71
  }
50
- const brief = row?.brief as { kind?: string; questionIds?: string[] } | null | undefined;
51
- const pointsAtQuestion = !!brief?.questionIds?.length && out.slice(before).some(c => c.kind === "question");
52
- if (brief && !pointsAtQuestion && BRIEF_CARD_KINDS.includes(brief.kind ?? "")) out.push({ key: `${s.key}|brief`, kind: "brief", s });
53
72
  // An answer to read: the lowest tier (Q172 C=a), after everything else the workstream asks.
54
73
  const read = s.workspaceId && answers ? answers(s.workspaceId) : [];
55
74
  if (out.length === before && s.tier !== ANSWER_TIER) out.push({ key: `${s.key}|finished`, kind: "finished", s });
@@ -307,8 +326,8 @@ const asks = (n: number) => `${n} ${n === 1 ? "ask" : "asks"}`;
307
326
  export const MODE = {
308
327
  name: "Catch up",
309
328
  /**
310
- * The number is asks (cards), which differs from Needs you's count of workspaces right above it on a phone (P2-7:
311
- * "Catch up · 6" under "4 Needs you" read as a contradiction), so the button names what it counts.
329
+ * The number is its cards, one per Needs-you row, so it is Needs you's count right above it on a phone (invariant 249;
330
+ * "Catch up · 28 asks" under "11 Needs you" read as a contradiction, as "Catch up · 6" under "4 Needs you" did, P2-7).
312
331
  */
313
332
  button: (n: number) => `Catch up · ${asks(n)}`,
314
333
  /** The button's accessible name and tooltip. */
@@ -62,6 +62,12 @@ export type Headline = {
62
62
  * ("Reviewer"), never the generic "Blocked" (2026-11-29: "Blocked · Part of the review feedback").
63
63
  */
64
64
  word?: string;
65
+ /**
66
+ * The line is the agent's own words (its brief's ask, a question's title or detail, a decision): a row shows it as
67
+ * written, never with a PR ref cut out (rowLine). 2026-12-03: "Check the reminder emails after #12 ships" read
68
+ * "Check the reminder emails after ships" beside the #12 chip.
69
+ */
70
+ agentWords?: boolean;
65
71
  };
66
72
 
67
73
  /** The word a row leads with: the headline's own word, else its key's. */
@@ -115,6 +121,9 @@ export function flagHeadline(row: Pick<InboxRow, "needs" | "snooze" | "brief">,
115
121
  if (there) return { key, label: word, line: answeredThereText(run!.plugin, there.id), source: "flag" };
116
122
  if (run?.finished) return { key, label: word, line: runWork(run, false), source: "flag" };
117
123
  }
124
+ // Only Follow-up's own PR news yields to the repair that fixes it; the agent's own Review ask stays the row's ask, as
125
+ // it leads the workspace's Needs you list everywhere else (one-ask-reads-the-same-everywhere).
126
+ if ((key === "flagged" || key === "review") && brief?.source === "agent" && briefAsks(brief, row)) items = items.filter(i => i.kind !== "send" && i.kind !== "person");
118
127
  // A failed check or review thread headlines as the developer's action: tasks ready to send.
119
128
  const send = items.find((i): i is Extract<NeedItem, { kind: "send" }> => i.kind === "send" && !i.finish);
120
129
  // A person item ahead of it (the part only a person can move) headlines like any other Needs-you item.
@@ -147,9 +156,13 @@ export function flagHeadline(row: Pick<InboxRow, "needs" | "snooze" | "brief">,
147
156
  : speaks ? (brief!.source === "none" ? "No ask stated" : brief!.ask)
148
157
  : brief && items.length ? items[0].title
149
158
  : flagFact(key, fact) || HEADLINE_WORD[key];
150
- return { key, label: since ? `${HEADLINE_WORD[key]} ${since}` : HEADLINE_WORD[key], line, source: "flag" };
159
+ const own = line !== doneLine && (speaks ? brief!.source !== "none" : !!brief && items.length > 0 && (items[0].kind === "question" || items[0].kind === "decision"));
160
+ return { key, label: since ? `${HEADLINE_WORD[key]} ${since}` : HEADLINE_WORD[key], line, source: "flag", ...(own ? { agentWords: true } : {}) };
151
161
  }
152
162
 
163
+ /** A row's line: the headline's, without the PR refs the row already shows (sayNew), unless it is the agent's own words. */
164
+ export const rowLine = (h: Pick<Headline, "line" | "agentWords">, shown: { label?: string | null; chip?: string | null }): string => h.agentWords ? h.line : sayNew(h.line, shown);
165
+
153
166
  /**
154
167
  * a-headline-says-only-what-is-new: what a headline's line repeats from the row it sits in, or null. The row already
155
168
  * shows its word ("Add reviewers"), the pill label ("Add reviewers #246") and the PR chip ("#246 running"), so a line
@@ -219,11 +232,11 @@ export function workspaceHeadline(items: NeedItem[]): Headline | null {
219
232
  // needsYou() already orders by urgency; questions read as a count when there are several.
220
233
  if (top.kind === "question") {
221
234
  const stopped = top.state === "stopped";
222
- if (questions.length > 1) return { key: "question", label: plural(questions.length, "question"), line: stopped ? `The main agent stopped until you answer ${top.questionId}` : top.title, source: "workspace" };
235
+ if (questions.length > 1) return { key: "question", label: plural(questions.length, "question"), line: stopped ? `The main agent stopped until you answer ${top.questionId}` : top.title, source: "workspace", ...(stopped ? {} : { agentWords: true }) };
223
236
  // An outside ask keeps "Progress Q1 · title" on a row with one ask too: its id says whose question it is. The line
224
237
  // names it, so the label doesn't again (say-it-once: not "Question Progress Q1 / Progress Q1 · title").
225
- if (isOutsideId(top.questionId)) return { key: "question", label: "Question", line: top.title, source: "workspace" };
226
- return { key: "question", label: `Question ${top.questionId}`, line: top.detail || top.title, source: "workspace" };
238
+ if (isOutsideId(top.questionId)) return { key: "question", label: "Question", line: top.title, source: "workspace", agentWords: true };
239
+ return { key: "question", label: `Question ${top.questionId}`, line: top.detail || top.title, source: "workspace", agentWords: true };
227
240
  }
228
241
  switch (top.kind) {
229
242
  case "hold": return { key: "blocked", label: "On hold", line: top.detail || top.title, source: "workspace" };
@@ -234,7 +247,7 @@ export function workspaceHeadline(items: NeedItem[]): Headline | null {
234
247
  case "message": return { key: "blocked", label: "Message not sent", line: top.title, source: "workspace" };
235
248
  case "stuck": return { key: "blocked", label: "Stuck", line: top.title.replace(/^Stuck · /, "") || top.detail, source: "workspace" };
236
249
  case "answer": return top.waiting ? { key: "decision", label: "Send answer", line: top.title, source: "workspace" } : { key: "blocked", label: "Check answer", line: top.title, source: "workspace" };
237
- case "decision": return { key: "decision", label: "Decision", line: top.title, source: "workspace" };
250
+ case "decision": return { key: "decision", label: "Decision", line: top.title, source: "workspace", agentWords: true };
238
251
  case "send": return top.finish ? { key: "finish", label: FINISH_WORD, line: FINISH_ASK[0].toUpperCase() + FINISH_ASK.slice(1), source: "workspace" } : { key: "repairs", label: sendButton(top.what), line: top.title, source: "workspace" };
239
252
  // a-headline-says-only-what-is-new: the label names the PR, so the line is the PR's title or whom to ask.
240
253
  case "merge": return { key: "merge", label: `Merge #${top.number}`, line: top.detail || top.title, source: "workspace" };
@@ -302,6 +315,8 @@ export function pillState(input: {
302
315
  recent: { agentIds: string[]; at: number; kind?: "sign_off" | "later" | "later_ws" } | null;
303
316
  /** This agent has a Done waiting on its Undo toast (client/done-windows.ts). */
304
317
  done?: boolean;
318
+ /** The workspace's Done-check line (shared/status.ts finishLine), only when this agent is its main agent. */
319
+ doneLine?: string | null;
305
320
  now: number;
306
321
  }): PillState {
307
322
  const { row, recent, now } = input;
@@ -309,7 +324,7 @@ export function pillState(input: {
309
324
  // Done waits on its toast, so the Action brief is still open on the daemon: the developer's move owns the pill for
310
325
  // as long as the toast does (the store clears it when the toast ends), not a fixed 6 s.
311
326
  if (row && input.done) return { mode: "undo", label: "Done" };
312
- const flag = row ? flagHeadline(row, now, items, input.run) : null;
327
+ const flag = row ? flagHeadline(row, now, items, input.run, input.doneLine) : null;
313
328
  if (flag) return { mode: "flag", headline: flag, todo: items.length };
314
329
  if (row && recent && recent.agentIds.includes(row.agentId) && now - recent.at < UNDO_MS) return { mode: "undo", label: recent.kind === "later" ? "Later" : "Signed off" };
315
330
  const work = workspaceHeadline(items);
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { GROUP_TITLE, homeCounts, type HomeCounts, type HomeGroup, type HomeGroupId, type HomeModel, type PaseoWorkspaceLite, type Workstream } from "./home";
2
+ import { GROUP_TITLE, groupLines, homeCounts, type HomeCounts, type HomeGroup, type HomeGroupId, type HomeModel, type PaseoWorkspaceLite, type Workstream } from "./home";
3
3
 
4
4
  /**
5
5
  * How Home's list and the sidebar view arrange their rows: one model for both, saved in Settings → Display
@@ -82,7 +82,7 @@ export function arrangeHome(model: HomeModel, view: HomeView, workspaces: (id: s
82
82
  const pinned = hostHasPins ? groups.flatMap(g => g.items.filter(s => pinnedAt(s)))
83
83
  .sort((a, b) => (pinnedAt(b) ?? "").localeCompare(pinnedAt(a) ?? "") || a.key.localeCompare(b.key)) : null;
84
84
  const lifted = new Set(pinned?.map(s => s.key));
85
- const rest = groups.map(g => ({ ...g, all: g.items.length, items: g.items.filter(s => !lifted.has(s.key)) }));
85
+ const rest = groups.map(g => ({ ...g, all: groupLines(g.items), items: g.items.filter(s => !lifted.has(s.key)) }));
86
86
  let sections: HomeSection[];
87
87
  if (view.grouping === "status") {
88
88
  // A group whose rows all went to Pinned draws no header; the counts that matter (the badge, the strip) still count them.