paseo-follow-up 2.7.0-beta.5 → 2.7.0-beta.6

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/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  What changed in each version of Follow-up, newest first. Follow-up shows "What's new" after an update that brings new release notes: the curated part of each stable release since you last looked (betas install quietly; Settings → General can turn it off), and every version's notes from Home's version line.
4
4
 
5
+ ## 2.6.1 (2026-12-05)
6
+
7
+ One fix for 2.6.0.
8
+
9
+ - **No more "Stop hook error occurred" under your agents' messages.** Follow-up's turn-end reminders now reach the agent quietly, never cut into your next message, and never pause the workspace as if you had stopped the agent.
10
+
11
+ <details><summary>Full changelog since 2.6.0</summary>
12
+
13
+ ### Fixes
14
+
15
+ - Follow-up's turn-end reminders no longer show "Stop hook error occurred" in the chat, cut into your next message, or pause the workspace as if you stopped the agent.
16
+
17
+ </details>
18
+
5
19
  ## 2.6.0 (2026-12-01)
6
20
 
7
21
  A new workspace view, a redesigned sidebar, agents that show you their work, and lots of fixes.
@@ -41,6 +41,7 @@ import { Marked, NoMatchRow, useSectionSearch } from "./section-search";
41
41
  import { questionStatus } from "../shared/section-search";
42
42
  import { answerImagesKey, clearPendingAnswer, confirmPendingAnswer, failPendingAnswer, markSentHere, pendingKey, retryPendingAnswer, setPendingAnswer, usePendingAnswer, usePendingAnswers, type PendingAnswer } from "./pending-answers";
43
43
  import { inFlight } from "../shared/optimistic-answers";
44
+ import { estLines, questionLayout } from "../shared/question-layout";
44
45
  import { Field } from "./field";
45
46
 
46
47
  const who = (w: Pick<ListWorkspace, "mainAgentId">, agentId: string | null) => !agentId || agentId === w.mainAgentId ? "the main agent" : "a root session";
@@ -250,6 +251,8 @@ function QuestionBodyBody({ workspace: w, question: q, theme, compact, now = Dat
250
251
  useEffect(() => { if (!open && !pending) clearDraft(draftKey); }, [open, !!pending, draftKey]);
251
252
  // The pill's scrolling body: track whether more sits below the fold, so it can say so.
252
253
  const [scroll, setScroll] = useState({ content: 0, view: 0, offset: 0 });
254
+ // Split: the width the body has, measured once it lays out; it picks stacked or the newspaper (invariant 254).
255
+ const [splitWidth, setSplitWidth] = useState(0);
253
256
  const more = scroll.content - scroll.view - scroll.offset > 4;
254
257
  const refresh = () => { void cache.invalidateQueries({ queryKey: workspaceKey(w.id) }); void cache.invalidateQueries({ queryKey: overviewKey }); };
255
258
  const free = !q.options.length;
@@ -388,8 +391,14 @@ function QuestionBodyBody({ workspace: w, question: q, theme, compact, now = Dat
388
391
  </View>
389
392
  </ImageField>;
390
393
  })();
391
- // Split (the new view's wide reader): the form stands beside the text (see the twoCols return below).
392
- const twoCols = !!split && open && !dense;
394
+ // The wide reader's layout (shared/question-layout.ts): stacked unless the question is long and the reader wide.
395
+ const layout = !!split && open && !dense && splitWidth > 0 ? questionLayout({
396
+ width: splitWidth, phone: compact, text: shown.text, options: q.options,
397
+ contextLines: (q.background ? Math.min(3, estLines(q.background, splitWidth)) : 0) + shown.below.length + (q.prKey ? 1 : 0),
398
+ }) : null;
399
+ const paper = layout?.kind === "newspaper" ? layout : null;
400
+ // Split (the new view's wide reader): the form stands beside the text only in the newspaper (see its return below).
401
+ const twoCols = !!paper;
393
402
  const options = !!q.options.length && !doneOnly && <View accessibilityRole="radiogroup" accessibilityLabel={`Options for ${q.id}`} style={{ gap: dense ? 4 : 6 }}>
394
403
  {q.options.map(o => <OptionCard key={o.letter} theme={theme} compact={compact} dense={dense || twoCols} ring={split || footSticky} letter={o.letter} label={o.label} consequence={o.consequence} recommended={q.recommend === o.letter}
395
404
  selected={(open ? choice : q.answer?.choice) === o.letter} disabled={!open || run.isPending} onPress={() => setChoice(o.letter)}>{open && draft.field === "note" ? input : null}</OptionCard>)}
@@ -398,13 +407,15 @@ function QuestionBodyBody({ workspace: w, question: q, theme, compact, now = Dat
398
407
  selected={open ? other : isOther(q.answer?.choice)} disabled={!open || run.isPending} onPress={() => setChoice(OTHER)}>{open && draft.field === "answer" ? input : null}</OptionCard>}
399
408
  </View>;
400
409
  // Context comes before the options so the developer reads why before choosing.
410
+ const askText = (words: string, top: boolean) => {
411
+ /* Inline: the block's header carries the title, so the question reads as body text under it. */
412
+ const question = <RichText selectable style={[inline ? text(c, compact).body : [t.body, { fontSize: dense ? 13 : 15, lineHeight: dense ? 19 : 22 }], { flex: 1, minWidth: 0 }]}>{words}</RichText>;
413
+ return top && dismissX && dismissAt === "top" ? <View style={{ flexDirection: "row", alignItems: "flex-start", gap: 8 }}>{question}<View style={{ marginTop: -2, marginRight: -5 }}>{dismissX}</View></View> : question;
414
+ };
401
415
  const body = <View style={{ gap: dense ? 10 : 14 }}>
402
416
  <View style={{ gap: 6 }}>
403
- {/* Inline: the block's header carries the title, so the question reads as body text under it. */}
404
- {(() => {
405
- const question = <RichText selectable style={[inline ? text(c, compact).body : [t.body, { fontSize: dense ? 13 : 15, lineHeight: dense ? 19 : 22 }], { flex: 1, minWidth: 0 }]}>{shown.text}</RichText>;
406
- return dismissX && dismissAt === "top" ? <View style={{ flexDirection: "row", alignItems: "flex-start", gap: 8 }}>{question}<View style={{ marginTop: -2, marginRight: -5 }}>{dismissX}</View></View> : question;
407
- })()}
417
+ {/* The newspaper's lead is drawn above both columns, so the left column starts with the rest of the question. */}
418
+ {paper ? (paper.rest ? askText(paper.rest, false) : null) : askText(shown.text, true)}
408
419
  {/* Phones: who asked and when is meta under the question, not a footnote after the buttons. */}
409
420
  {compact && !dense && !inline && <Text style={t.small}>Asked {ago(q.askedAt, now)} by {who(w, q.askedBy)}{q.taskId && !q.options.length ? " (blocked task)" : ""}</Text>}
410
421
  {state && <StateLine state={state} theme={theme} />}
@@ -493,19 +504,27 @@ function QuestionBodyBody({ workspace: w, question: q, theme, compact, now = Dat
493
504
  <Text style={[t.small, { flex: 1 }]}>Asked {ago(q.askedAt, now)} by {who(w, q.askedBy)}{q.taskId && !q.options.length ? " (blocked task)" : ""}</Text>
494
505
  {dismissAt === "foot" && dismissX}
495
506
  </View>;
496
- // The new view's wide reader: the question and its context on the left, the same form (options with the field in
497
- // place, the answer as recorded, Send) on the right, sticky.
498
- if (twoCols) return <SubmitScope message compact={compact} enabled={submittable} onLetter={onLetter} onSubmit={() => doneOnly ? done() : open ? quick("send") : run.mutate("send")} style={{ flexDirection: "row", alignItems: "flex-start", gap: 28 }}>
499
- <View style={{ flex: 1, minWidth: 0 }}>{body}</View>
500
- <View {...PRIMARY_FORM} style={[{ width: 400, flexShrink: 0, gap: 12 }, Platform.OS === "web" ? { position: "sticky", top: 0 } as unknown as ViewStyle : null]}>
501
- {options}
502
- {open && free && input}
503
- {after}
504
- {actions}
505
- {askedLine}
507
+ // Split measures its width first; until then it draws the stacked form, unseen, so nothing jumps.
508
+ const measure = split && open && !dense ? { onLayout: (e: { nativeEvent: { layout: { width: number } } }) => { const next = Math.round(e.nativeEvent.layout.width); if (Math.abs(next - splitWidth) > 1) setSplitWidth(next); } } : null;
509
+ // The new view's wide reader, a long question (the newspaper): its first lines full width, then the rest of it and
510
+ // its context on the left, the same form (options with the field in place, the answer as recorded, Send) on the
511
+ // right, sticky.
512
+ if (paper) return <SubmitScope message compact={compact} enabled={submittable} onLetter={onLetter} onSubmit={() => doneOnly ? done() : open ? quick("send") : run.mutate("send")} style={{ gap: 14 }}>
513
+ <View testID="follow-up-question-newspaper" {...measure} style={{ gap: 14 }}>
514
+ {askText(paper.lead, true)}
515
+ <View style={{ flexDirection: "row", alignItems: "flex-start", gap: 28 }}>
516
+ <View style={{ flex: 1, minWidth: 0 }}>{body}</View>
517
+ <View {...PRIMARY_FORM} style={[{ width: paper.formWidth, flexShrink: 0, gap: 12 }, Platform.OS === "web" ? { position: "sticky", top: 0 } as unknown as ViewStyle : null]}>
518
+ {options}
519
+ {open && free && input}
520
+ {after}
521
+ {actions}
522
+ {askedLine}
523
+ </View>
524
+ </View>
506
525
  </View>
507
526
  </SubmitScope>;
508
- return <SubmitScope message compact={compact} enabled={submittable} onLetter={onLetter} onSubmit={() => doneOnly ? done() : open ? quick("send") : run.mutate("send")} style={{ gap: dense ? 10 : 12 }}>
527
+ const stacked = <SubmitScope message compact={compact} enabled={submittable} onLetter={onLetter} onSubmit={() => doneOnly ? done() : open ? quick("send") : run.mutate("send")} style={{ gap: dense ? 10 : 12 }}>
509
528
  {body}
510
529
  {/* The field with its Send: kept on screen together while typing (a-focused-field-and-its-send-stay-in-view). */}
511
530
  <View {...PRIMARY_FORM} style={[{ gap: dense ? 10 : 14 }, footSticky && open && Platform.OS === "web" ? pinnedFoot(c) : null]}>
@@ -517,6 +536,7 @@ function QuestionBodyBody({ workspace: w, question: q, theme, compact, now = Dat
517
536
  </View>
518
537
  {!dense && !compact && !inline && askedLine}
519
538
  </SubmitScope>;
539
+ return measure ? <View testID="follow-up-question-stacked" {...measure} style={splitWidth ? null : { opacity: 0 }}>{stacked}</View> : stacked;
520
540
  }
521
541
 
522
542
  /** A question's x: closes it as dismissed (follow.dismiss with "question:Qn"), sends the agent nothing, Undo in the toast. */
@@ -97,24 +97,29 @@ export function ViewRHeader({ workspace: w, theme, compact, now, wide, width, on
97
97
  </View>
98
98
  {after}
99
99
  </View>;
100
- return <View testID="follow-up-head-narrow" style={{ paddingHorizontal: compact ? 12 : 8, paddingTop: compact ? 0 : 4, paddingBottom: 6, gap: compact ? 0 : 2, borderBottomWidth: 1, borderBottomColor: c.border }}>
101
- <View style={{ flexDirection: "row", alignItems: "center", gap: 4, minHeight: compact ? 44 : 32 }}>
100
+ // Narrow (the side panel, a phone; invariant 225): two short lines, the stack bar as the bottom edge. The status puts
101
+ // what waits first and drops words, never a count ("3 of 20 PRs merged" reads "3/20 merged"); when ↻ and the switch
102
+ // don't fit beside it they wrap to their own line instead of cutting it. The panel labels the switch "Auto" (its
103
+ // spoken label stays "Auto-send repairs"); a phone has room for the word. On a phone the bar has no per-PR presses.
104
+ const short = (x: string) => x.replace(/^(\d+) of (\d+) PRs? merged/, "$1/$2 merged").replace(/^No PRs registered yet$/, "No PRs yet");
105
+ const urgent = [...parts].sort((a, b) => Number(!(a.tone === "warning" || a.tone === "danger")) - Number(!(b.tone === "warning" || b.tone === "danger"))).map(x => ({ ...x, text: short(x.text) }));
106
+ return <View testID="follow-up-head-narrow" style={{ paddingTop: compact ? 0 : 2 }}>
107
+ <View style={{ flexDirection: "row", alignItems: "center", gap: 4, minHeight: compact ? 44 : 32, paddingHorizontal: compact ? 12 : 8 }}>
102
108
  {home}
103
109
  {titleLead}
104
- <View style={{ flex: 1, minWidth: 0, flexDirection: "row", paddingLeft: home ? 0 : 4 }}>{titleText(2)}</View>
105
- <View style={{ flexDirection: "row", alignItems: "center", gap: 0, flexShrink: 0, marginRight: compact ? -8 : -2 }}>{tools}</View>
110
+ <View style={{ flex: 1, minWidth: 0, flexDirection: "row", paddingLeft: home ? 0 : 4 }}>{titleText(1)}</View>
111
+ <View style={{ flexDirection: "row", alignItems: "center", flexShrink: 0, marginRight: compact ? -8 : -2 }}>{tools}</View>
106
112
  </View>
107
- {/* Narrow (the side panel, a phone): no room for the status, the bar, ↻ and Auto-send on one line, so the status
108
- keeps every part (the count that waits is never cut) beside ↻ and Auto-send, and the bar is a thin line under
109
- them. On a phone the bar has no per-PR presses (its marks are under 44 pt). */}
110
- <View style={{ flexDirection: "row", alignItems: "center", gap: compact ? 6 : 4, minHeight: compact ? 44 : 28, paddingLeft: 4 }}>
111
- <View style={{ flex: 1, minWidth: 0 }}>{statusParts}</View>
112
- {words ? checkedWords : null}
113
- {refresh}
114
- {auto}
113
+ <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", columnGap: 6, minHeight: compact ? 40 : 28, paddingLeft: compact ? 16 : 12, paddingRight: compact ? 12 : 8 }}>
114
+ <Text accessibilityLiveRegion="polite" style={[t.meta, { flexShrink: 0, maxWidth: "100%", color: c.foregroundMuted }]}>
115
+ {urgent.map((part, i) => <Text key={part.text} {...press(part.tone, part.text)} style={toneOf(part.tone) ? { color: toneOf(part.tone), fontWeight: "600" } : { color: c.foreground }}>{i ? <Text style={{ color: c.foregroundMuted, fontWeight: "400" }}>{" · "}</Text> : null}{part.text}</Text>)}
116
+ </Text>
117
+ <View style={{ flexDirection: "row", alignItems: "center", gap: 2, marginLeft: "auto" }}>{refresh}{compact ? auto : <Switch theme={theme} compact={compact} label="Auto" accessibilityLabel="Auto-send repairs" hint="Send repairs to the main agent on its own when the agent is idle. Off means each message waits for your click."
118
+ value={w.enable_auto_sends} disabled={autoPending} onChange={onAuto} />}</View>
115
119
  </View>
116
- <View style={{ paddingLeft: 4, paddingTop: 2 }}><StackBar workspace={w} theme={theme} height={4} onOpen={compact ? undefined : onOpenPr} /></View>
117
120
  {after}
121
+ <View style={{ paddingTop: 4 }}><StackBar workspace={w} theme={theme} height={3} onOpen={compact ? undefined : onOpenPr} /></View>
122
+ <View style={{ height: 1, backgroundColor: c.border }} />
118
123
  </View>;
119
124
  }
120
125
 
package/client/view-r.tsx CHANGED
@@ -26,7 +26,7 @@ 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, needLook, needsCount, needsEntries, sectionSummary, stackRows, keyIntent, queuedWords, readerFor, rowSelect, viewAtRow, type IndexSection } from "../shared/view-r";
29
+ import { capRows, dockTiles, fitCount, indexSections, lastActivityWords, needChips, needLook, needsCount, needsEntries, quietRows, sectionSummary, stackRows, keyIntent, queuedWords, readerFor, rowSelect, viewAtRow, type DockTile, 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";
@@ -52,6 +52,10 @@ import { allQuestions } from "../shared/outside-run";
52
52
  * - Keys (web): j/k and ↑/↓ walk the rows; Enter or → moves into the reader; a–e pick a question's option, ⌘↵ sends;
53
53
  * Esc or ← goes back to the index.
54
54
  * - Selecting is view state, never an action: every action in the reader is the same RPC and tool as before.
55
+ * - The tab's index shows at most 5 rows a section (the 4 first and "N more", which opens the whole list in the
56
+ * reader). The side panel and phone (invariant 225) are Needs you and a dock: six one-line tiles under the header
57
+ * that never move (`Dock`), the goal on one line, then Needs you filling what is left (`NeedsFill`); a tile opens its
58
+ * list in Needs you's place with Back. A stack row opens its PRs in place; an agent row has its own Open chat.
55
59
  */
56
60
 
57
61
  type Open =
@@ -61,7 +65,7 @@ type Open =
61
65
  | { kind: "task"; id: string } | { kind: "tasks-done" }
62
66
  | { kind: "spec" } | { kind: "link"; key: string } | { kind: "links-all" }
63
67
  | { kind: "agent"; id: string; node?: AgentTreeNode } | { kind: "subagents"; id: string }
64
- | { kind: "overview" };
68
+ | { kind: "overview" } | { kind: "list"; section: IndexSection };
65
69
  type Row = { key: string; section: IndexSection; icon: string; color: string; title: string; meta?: string | null; metaColor?: string; open: Open; a11y?: string; muted?: boolean; depth?: number; expanded?: boolean;
66
70
  /** A Needs-you question's one-click chips (invariant 200, needChips): answer from the index; Read opens it in the reader. */
67
71
  chips?: RowChips | null };
@@ -102,6 +106,8 @@ export function ViewR({ workspace: w, theme, compact, now, place, wide, width, h
102
106
  const [selKey, setSelKey] = useState<string | null>(null);
103
107
  const [opened, setOpened] = useState<Open | null>(null);
104
108
  const [narrowOpen, setNarrowOpen] = useState(false);
109
+ // The side panel's open tile (invariant 225): its list sits in Needs you's place until Back.
110
+ const [pane, setPane] = useState<PaneKey | null>(null);
105
111
  const lastNeed = useRef(0);
106
112
  const readerRef = useRef<View>(null);
107
113
  const byKey = new Map(index.rows.map(r => [r.key, r]));
@@ -202,12 +208,12 @@ export function ViewR({ workspace: w, theme, compact, now, place, wide, width, h
202
208
  const advance = () => { const i = needs.findIndex(r => r.key === sel?.key); const next = needs[i + 1] ?? needs[i - 1] ?? null; lastNeed.current = Math.max(0, i); if (next) pick(next); else { setSelKey(null); setOpened({ kind: "overview" }); } };
203
209
  const sectionRows = sel ? index.rows.filter(r => r.section === sel!.section) : [];
204
210
  const reader = <View ref={readerRef} testID="follow-up-reader" style={{ flex: 1, minWidth: 0, minHeight: 0, backgroundColor: c.surface0 }}>
205
- <Reader key={sel?.key ?? openKey(open)} open={open} workspace={w} theme={theme} compact={compact} now={now} place={place} wide={wide} rows={rows} cards={index.cards} linked={index.linked}
211
+ <Reader key={sel?.key ?? openKey(open)} open={open} listRows={sec => listRows(index, w, theme, sec)} workspace={w} theme={theme} compact={compact} now={now} place={place} wide={wide} rows={rows} cards={index.cards} linked={index.linked}
206
212
  openAgent={openAgent} browserReady={browserReady} parts={parts} onAnswered={advance} onPick={(o) => { const r = index.rows.find(x => openKey(x.open) === openKey(o)) ?? null; pick(r, o); }}
207
- nav={!wide ? { back: () => setNarrowOpen(false), prev: at > 0 ? () => step(-1) : null, next: at < index.rows.length - 1 ? () => step(1) : null, where: sel && SECTION_LABEL[sel.section] ? `${SECTION_LABEL[sel.section]} · ${sectionRows.indexOf(sel) + 1} of ${sectionRows.length}` : "Overview" } : null}
213
+ nav={!wide ? { back: () => setNarrowOpen(false), prev: at > 0 ? () => step(-1) : null, next: at < index.rows.length - 1 ? () => step(1) : null, where: sel && SECTION_LABEL[sel.section] ? `${SECTION_LABEL[sel.section]} · ${sectionRows.indexOf(sel) + 1} of ${sectionRows.length}` : open.kind === "list" ? `${SECTION_LABEL[open.section]} · all` : open.kind === "prs-all" ? "Pull requests · all" : "Overview" } : null}
208
214
  position={sel?.section === "needs" && needs.length > 1 && needs.includes(sel) ? { at: needs.indexOf(sel) + 1, of: needs.length, prev: needs.indexOf(sel) > 0 ? () => pick(needs[needs.indexOf(sel!) - 1]!) : null, next: needs.indexOf(sel) < needs.length - 1 ? () => pick(needs[needs.indexOf(sel!) + 1]!) : null } : null} />
209
215
  </View>;
210
- const list = <IndexList index={index} selected={sel?.key ?? null} theme={theme} compact={compact} onPick={r => pick(r)} wide={wide} openAll={() => pick(null, { kind: "prs-all" })} onChip={onChip} />;
216
+ const list = <IndexList index={index} selected={sel?.key ?? null} theme={theme} compact={compact} onPick={r => pick(r)} wide={wide} openAll={() => pick(null, { kind: "prs-all" })} onChip={onChip} openList={s => pick(null, { kind: "list", section: s })} />;
211
217
  if (wide) return <View testID="follow-up-view-r" style={{ flex: 1, minHeight: 0 }}>
212
218
  {place !== "panel" && top}
213
219
  {header}
@@ -221,7 +227,10 @@ export function ViewR({ workspace: w, theme, compact, now, place, wide, width, h
221
227
  return <View testID="follow-up-view-r" style={{ flex: 1, minHeight: 0 }}>
222
228
  {(!compact || place !== "panel") && top}
223
229
  {narrowOpen ? <View style={{ flex: 1, minHeight: 0 }}>{header}{reader}</View>
224
- : <ScrollView style={{ flex: 1 }} contentContainerStyle={{ paddingBottom: 24 }}><View testID="follow-up-index">{header}{list}</View></ScrollView>}
230
+ : <View style={{ flex: 1, minHeight: 0 }}>{header}<View testID="follow-up-index" style={{ flex: 1, minHeight: 0 }}>
231
+ <PanelBody index={index} w={w} theme={theme} compact={compact} selected={sel?.key ?? null} pane={pane} setPane={setPane} onChip={onChip}
232
+ onPick={r => pick(r)} openOpen={o => pick(null, o)} openAgent={openAgent} />
233
+ </View></View>}
225
234
  </View>;
226
235
  }
227
236
 
@@ -332,19 +341,24 @@ function useIndexRows(w: Workspace, theme: Theme, now: number, inboxRows: readon
332
341
  const sections = indexSections(wide);
333
342
  const rank = (r: Row) => sections.indexOf(r.section);
334
343
  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]);
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 }) };
344
+ // The workspace's latest activity, for "Nothing needs you · last activity 2h ago" (invariant 225).
345
+ const mine = new Set([w.mainAgentId, ...(w.contributorAgentIds ?? [])]);
346
+ // Its agents' last activity, else (no inbox row yet) the last merge or question Follow-up recorded.
347
+ const lastAt = [...inboxRows.filter(r => r.workspaceId === w.id || mine.has(r.agentId)).map(r => r.lastActivityAt ?? ""),
348
+ ...w.prs.map(x => x.snapshot?.mergedAt ?? ""), ...w.questions.map(q => q.askedAt ?? "")].sort().pop() || null;
349
+ return { now, lastAt, 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 }) };
336
350
  }
337
351
 
338
352
  type Index = ReturnType<typeof useIndexRows>;
339
353
 
340
354
  /** The index: the sections in order, each folding from its header; a folded one is left out of j/k too. */
341
- function IndexList({ index, selected, theme, compact, onPick, wide, openAll, onChip }: { index: Index; selected: string | null; theme: Theme; compact: boolean; onPick: (r: Row) => void; wide: boolean; openAll: () => void; onChip: OnChip }) {
355
+ function IndexList({ index, selected, theme, compact, onPick, wide, openAll, onChip, openList }: { index: Index; selected: string | null; theme: Theme; compact: boolean; onPick: (r: Row) => void; wide: boolean; openAll: () => void; onChip: OnChip; openList: (s: IndexSection) => void }) {
342
356
  return <View accessibilityRole="list" style={{ paddingTop: wide ? 4 : 0 }}>
343
- {index.sections.map(s => <IndexSectionBlock key={s} section={s} index={index} selected={selected} theme={theme} compact={compact} onPick={onPick} wide={wide} openAll={openAll} onChip={onChip} />)}
357
+ {index.sections.map(s => <IndexSectionBlock key={s} section={s} index={index} selected={selected} theme={theme} compact={compact} onPick={onPick} wide={wide} openAll={openAll} onChip={onChip} openList={openList} />)}
344
358
  </View>;
345
359
  }
346
360
 
347
- function IndexSectionBlock({ section: s, index, selected, theme, compact, onPick, wide, openAll, onChip }: { section: IndexSection; index: Index; selected: string | null; theme: Theme; compact: boolean; onPick: (r: Row) => void; wide: boolean; openAll: () => void; onChip: OnChip }) {
361
+ function IndexSectionBlock({ section: s, index, selected, theme, compact, onPick, wide, openAll, onChip, openList }: { section: IndexSection; index: Index; selected: string | null; theme: Theme; compact: boolean; onPick: (r: Row) => void; wide: boolean; openAll: () => void; onChip: OnChip; openList: (s: IndexSection) => void }) {
348
362
  const c = theme.colors; const t = text(c, compact);
349
363
  // Remembered per device (invariant 132's one fold); Needs you starts open, as every section does.
350
364
  const fold = useFold(`view-r.${s}`, true);
@@ -370,7 +384,8 @@ function IndexSectionBlock({ section: s, index, selected, theme, compact, onPick
370
384
  </Pressable>}
371
385
  </View>}
372
386
  {fold.open && !rows.length && <Text style={[t.meta, { paddingHorizontal: pad, paddingVertical: 6 }]}>Nothing needs you right now</Text>}
373
- {fold.open && rows.map(r => <IndexRow key={r.key} row={r} selected={selected === r.key} theme={theme} compact={compact} lines={r.muted || (!wide && r.section === "needs") ? 2 : 1} onPress={() => onPick(r)} onChip={onChip} />)}
387
+ {fold.open && capped(rows, s, selected).map(r => r.key === `more:${s}` ? <IndexRow key={r.key} row={r} selected={false} theme={theme} compact={compact} onPress={() => openList(s)} />
388
+ : <IndexRow key={r.key} row={r} selected={selected === r.key} theme={theme} compact={compact} lines={r.muted || (!wide && r.section === "needs") ? 2 : 1} onPress={() => onPick(r)} onChip={onChip} />)}
374
389
  </View>;
375
390
  }
376
391
 
@@ -400,7 +415,8 @@ function IndexRow({ row: r, selected, theme, compact, lines = 1, onPress, onChip
400
415
  </Pressable>;
401
416
  }
402
417
 
403
- function Reader({ open, workspace: w, theme, compact, now, place, wide, rows, cards, linked, openAgent, browserReady, parts, onAnswered, onPick, nav, position }: {
418
+ function Reader({ listRows, open, workspace: w, theme, compact, now, place, wide, rows, cards, linked, openAgent, browserReady, parts, onAnswered, onPick, nav, position }: {
419
+ /** A section's whole list, for "N more" (the tab's capped sections and the panel's Needs you). */ listRows: (s: IndexSection) => Row[];
404
420
  open: Open; workspace: Workspace; theme: Theme; compact: boolean; now: number; place: ViewPlace; wide: boolean; rows: readonly InboxRow[];
405
421
  cards: Index["cards"]; linked: Index["linked"]; openAgent?: (id: string) => void; browserReady: boolean; parts: ReaderParts;
406
422
  onAnswered: () => void; onPick: (o: Open) => void;
@@ -550,6 +566,13 @@ function Reader({ open, workspace: w, theme, compact, now, place, wide, rows, ca
550
566
  </View></>;
551
567
  break;
552
568
  }
569
+ case "list": {
570
+ // "N more": a section's whole list, each row opening its item.
571
+ const all = listRows(open.section);
572
+ body = <>{head("List", c.foreground, SECTION_LABEL[open.section] || "All", `${all.length} in all`)}
573
+ <View style={{ marginHorizontal: compact ? -8 : -6 }}>{all.map(r => <IndexRow key={r.key} row={r} selected={false} theme={theme} compact={compact} lines={r.section === "needs" ? 2 : 1} onPress={() => onPick(r.open)} />)}</View></>;
574
+ break;
575
+ }
553
576
  case "overview": {
554
577
  // The goal, what the work waits on, and the main agent's last words; reachable at any time from the goal row.
555
578
  const main = workspaceNow(w, rows, now).find(n => n.role === "main");
@@ -674,11 +697,11 @@ function checksLine(p: Pr): string | null {
674
697
  }
675
698
 
676
699
  /** Above a card opened from a question's link: the way back to that question. */
677
- function BackTo({ label, theme, compact, onPress }: { label: string; theme: Theme; compact: boolean; onPress: () => void }) {
700
+ function BackTo({ label, theme, compact, onPress, icon = "ChevronLeft" }: { label: string; theme: Theme; compact: boolean; onPress: () => void; icon?: string }) {
678
701
  const c = theme.colors; const t = text(c, compact);
679
702
  return <Pressable accessibilityRole="button" accessibilityLabel={label} onPress={onPress}
680
703
  style={s => ({ alignSelf: "flex-start", flexDirection: "row", alignItems: "center", gap: 4, marginBottom: 12, marginLeft: -6, paddingVertical: compact ? 10 : 4, paddingHorizontal: 6, borderRadius: 6, backgroundColor: s.pressed ? c.surface2 : (s as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
681
- <Icon name="ChevronLeft" size={14} color={c.foregroundMuted} /><Text style={[t.meta, { color: c.foreground }]}>{label}</Text>
704
+ <Icon name={icon} size={14} color={c.foregroundMuted} /><Text style={[t.meta, { color: c.foreground }]}>{label}</Text>
682
705
  </Pressable>;
683
706
  }
684
707
 
@@ -728,3 +751,191 @@ function PrRepairs({ w, prKey, now, theme, compact, onPick }: { w: Workspace; pr
728
751
  }
729
752
 
730
753
  export type { Row as ViewRRow };
754
+
755
+ // ─── The tab's 5-row cap and the side panel (invariant 225, the-panel-is-needs-you-and-a-dock) ───────────────────────
756
+
757
+ /** A section's rows under the cap: top-level rows count, a shown row keeps its nested rows; past it, "N more". */
758
+ function capped(rows: Row[], s: IndexSection, selected: string | null): Row[] {
759
+ const top = rows.filter(r => !r.depth);
760
+ const { shown, more } = capRows(top);
761
+ if (!more) return rows;
762
+ // The selected row stays in view: it takes the last shown slot.
763
+ const sel = top.find(r => r.key === selected);
764
+ const keep = sel && !shown.includes(sel) ? [...shown.slice(0, -1), sel] : shown;
765
+ const out: Row[] = []; let on = false;
766
+ for (const r of rows) { if (!r.depth) on = keep.includes(r); if (on) out.push(r); }
767
+ const left = top.length - keep.length;
768
+ return [...out, { key: `more:${s}`, section: s, icon: "Ellipsis", color: "", title: `${left} more`, open: { kind: "list", section: s }, a11y: `${left} more in ${SECTION_LABEL[s] || "this section"}, the whole list in the reader` }];
769
+ }
770
+
771
+ /** A section's whole list: the panel's tile lists and the reader's "N more". Links lists the spec and every linked item. */
772
+ function listRows(index: Index, w: Workspace, theme: Theme, s: IndexSection): Row[] {
773
+ const c = theme.colors;
774
+ const rows = index.rows.filter(r => r.section === s && r.open.kind !== "overview");
775
+ if (s === "links") return [
776
+ ...rows.filter(r => r.key === "spec"),
777
+ ...index.linked.map((i): Row => ({ key: `link:${i.key}`, section: "links", icon: `kind:${i.kind}`, color: c.foregroundMuted, title: i.title ?? i.key, open: { kind: "link", key: i.key } })),
778
+ ];
779
+ return rows;
780
+ }
781
+
782
+ type PaneKey = "prs" | "links" | "agents" | "tasks" | "cards";
783
+ type PanelProps = {
784
+ index: Index; w: Workspace; theme: Theme; compact: boolean; selected: string | null; pane: PaneKey | null; setPane: (p: PaneKey | null) => void;
785
+ onPick: (r: Row) => void; openOpen: (o: Open) => void; openAgent?: (id: string) => void; onChip: OnChip;
786
+ /** Stacks opened in place. */ stacks?: readonly string[]; toggleStack?: (stack: string) => void;
787
+ };
788
+
789
+ /** The side panel and phone: the dock on top, the goal on one line, then Needs you or the open tile's list. */
790
+ function PanelBody(p: PanelProps) {
791
+ const [stacks, setStacks] = useState<readonly string[]>([]);
792
+ const q: PanelProps = { ...p, stacks, toggleStack: st => setStacks(prev => prev.includes(st) ? prev.filter(x => x !== st) : [...prev, st]) };
793
+ const goal = p.index.rows.find(r => r.section === "goal");
794
+ return <View style={{ flex: 1, minHeight: 0 }}>
795
+ <Dock {...q} />
796
+ {goal && <View style={{ paddingTop: 4 }}><IndexRow row={goal} selected={p.selected === goal.key} theme={p.theme} compact={p.compact} lines={1} onPress={() => p.onPick(goal)} /></View>}
797
+ {p.pane ? <PaneList {...q} section={p.pane} /> : <NeedsFill {...q} />}
798
+ </View>;
799
+ }
800
+
801
+ /** A stack row's PRs in place under it, base to top, each opening in the reader. */
802
+ function expandRows(rows: Row[], w: Workspace, theme: Theme, open: readonly string[] | undefined): Row[] {
803
+ if (!open) return rows;
804
+ const c = theme.colors;
805
+ return rows.flatMap(r => {
806
+ if (r.open.kind !== "stack") return [r];
807
+ const st = r.open.stack; const on = open.includes(st);
808
+ const head: Row = { ...r, expanded: on, a11y: `${r.a11y ?? r.title}, ${on ? "open" : "opens its PRs here"}` };
809
+ if (!on) return [head];
810
+ return [head, ...stackOrder(w.prs.filter(x => x.stack === st)).map((x): Row => {
811
+ const tone = prTone(x); const word = prWord(compactPrStatus(x).label);
812
+ return { key: `pr:${x.key}`, section: "prs", icon: tone === "merged" ? "GitMerge" : tone === "draft" ? "GitPullRequestDraft" : "GitPullRequest", color: toneColor(c, tone), depth: 1,
813
+ title: x.snapshot?.title ?? `#${x.number}`, meta: `#${x.number} · ${word}`, metaColor: tone === "danger" || tone === "warning" || tone === "approved" ? toneColor(c, tone) : undefined,
814
+ a11y: `#${x.number} ${x.snapshot?.title ?? ""}, ${word}`, open: { kind: "pr", key: x.key } };
815
+ })];
816
+ });
817
+ }
818
+
819
+ /** A panel row: a stack row opens its PRs in place; an agent row carries its own Open chat (an agent's chat in two clicks). */
820
+ function PanelRow({ row: r, p, lines = 1 }: { row: Row; p: PanelProps; lines?: number }) {
821
+ const { theme, compact, selected, onPick, openAgent, toggleStack, onChip } = p;
822
+ const press = () => r.open.kind === "stack" && toggleStack ? toggleStack(r.open.stack) : onPick(r);
823
+ const row = <IndexRow row={r} selected={selected === r.key} theme={theme} compact={compact} lines={lines} onPress={press} onChip={onChip} />;
824
+ if (r.open.kind !== "agent" || r.depth || !openAgent) return row;
825
+ const id = r.open.id;
826
+ return <View style={{ flexDirection: "row", alignItems: "center" }}>
827
+ <View style={{ flex: 1, minWidth: 0 }}>{row}</View>
828
+ <View style={{ marginRight: compact ? 4 : 2 }}><IconButton icon="MessageSquare" label={`Open chat: ${r.title}`} tooltip onPress={() => openAgent(id)} theme={theme} compact={compact} /></View>
829
+ </View>;
830
+ }
831
+
832
+ /**
833
+ * Needs you, filling the height it is given: every entry that fits, "N more" past it (each row is measured; rows that
834
+ * don't fit stay laid out, hidden, so their heights are known). Nothing waiting is never a blank box: `NothingNeedsYou`.
835
+ */
836
+ function NeedsFill(p: PanelProps) {
837
+ const { index, theme, compact } = p;
838
+ const c = theme.colors; const t = text(c, compact);
839
+ const all = index.rows.filter(r => r.section === "needs");
840
+ const sum = index.summary("needs");
841
+ const [box, setBox] = useState(0);
842
+ const [hs, setHs] = useState<Record<string, number>>({});
843
+ const moreH = compact ? 44 : 30;
844
+ const measured = all.every(r => hs[r.key]);
845
+ const fit = fitCount(measured ? all.map(r => hs[r.key]!) : [], box, moreH) || (measured ? 0 : all.length);
846
+ const y = all.slice(0, fit).reduce((n, r) => n + (hs[r.key] ?? 0), 0);
847
+ const more = all.length - fit;
848
+ const moreRow: Row = { key: "more:needs", section: "needs", icon: "Ellipsis", color: c.foregroundMuted, title: `${more} more`, open: { kind: "list", section: "needs" }, a11y: `${more} more that need you, the whole list in the reader` };
849
+ return <View style={{ flex: 1, minHeight: 0 }}>
850
+ {all.length > 0 && <Text accessibilityRole="header" style={[t.section, { paddingHorizontal: compact ? 16 : 14, paddingTop: compact ? 10 : 8, paddingBottom: 4 }]}>
851
+ Needs you <Text style={{ color: readable(c.statusWarning, c) }}>{sum.count}</Text></Text>}
852
+ <View testID="follow-up-needs-fill" onLayout={e => setBox(Math.floor(e.nativeEvent.layout.height))} style={{ flex: 1, minHeight: 0, overflow: "hidden" }}>
853
+ {!all.length && <NothingNeedsYou {...p} />}
854
+ {all.map((r, i) => <View key={r.key} onLayout={e => { const h = Math.ceil(e.nativeEvent.layout.height); setHs(prev => prev[r.key] === h ? prev : { ...prev, [r.key]: h }); }}
855
+ aria-hidden={i >= fit} pointerEvents={i >= fit ? "none" : "auto"} style={{ opacity: i >= fit ? 0 : 1 }}>
856
+ <PanelRow row={r} p={p} lines={2} />
857
+ </View>)}
858
+ {more > 0 && <View style={{ position: "absolute", left: 0, right: 0, top: y, height: moreH, justifyContent: "center", backgroundColor: c.surface0 }}>
859
+ <PanelRow row={moreRow} p={p} />
860
+ </View>}
861
+ </View>
862
+ </View>;
863
+ }
864
+
865
+ /** Nothing needs you: one line, then what is moving in the Agents and Pull requests lists' own rows; else the last activity. */
866
+ function NothingNeedsYou(p: PanelProps) {
867
+ const { index, w, theme, compact } = p;
868
+ const c = theme.colors; const t = text(c, compact);
869
+ const running = index.rows.filter(r => r.section === "agents" && r.open.kind === "agent" && !r.depth && r.icon === "LoaderCircle");
870
+ const waiting = w.prs.filter(x => prTone(x) === "pending").map((x): Row => {
871
+ const word = prWord(compactPrStatus(x).label);
872
+ return { key: `pr:${x.key}`, section: "prs", icon: "GitPullRequest", color: toneColor(c, "pending"), title: x.snapshot?.title ?? `#${x.number}`, meta: word, a11y: `#${x.number} ${x.snapshot?.title ?? ""}, ${word}`, open: { kind: "pr", key: x.key } };
873
+ });
874
+ const moving = quietRows(running, waiting);
875
+ const line = moving.length ? "Nothing needs you" : lastActivityWords(index.lastAt, index.now);
876
+ return <View testID="follow-up-nothing-needs-you">
877
+ <View style={{ flexDirection: "row", alignItems: "center", gap: 8, paddingHorizontal: compact ? 16 : 14, paddingTop: compact ? 10 : 8, paddingBottom: 6 }}>
878
+ <Icon name="Check" size={14} color={c.foregroundMuted} />
879
+ <Text accessibilityRole="header" numberOfLines={1} style={[t.label, { flexShrink: 1, color: c.foregroundMuted, fontWeight: "600" }]}>{line}</Text>
880
+ </View>
881
+ {moving.map(r => <PanelRow key={r.key} row={r} p={p} />)}
882
+ </View>;
883
+ }
884
+
885
+ /** The dock: six one-line tiles in two rows under the header, the same at any count; a tile opens its list here, Spec the doc. */
886
+ function Dock(p: PanelProps) {
887
+ const { index, w, theme, compact, pane, setPane, openOpen } = p;
888
+ const c = theme.colors;
889
+ const tiles = dockTiles({ prs: index.summary("prs"), tasks: index.summary("tasks"), links: index.linked.length, agents: index.summary("agents").count, cards: index.summary("cards").count, spec: !!w.spec?.url });
890
+ const press = (d: DockTile) => {
891
+ if (d.key === "spec") { if (w.spec?.url) openLinkQuietly(w.spec.url, { workspaceId: w.id }); else openOpen({ kind: "spec" }); return; }
892
+ setPane(pane === d.key ? null : d.key);
893
+ };
894
+ const ink = (d: DockTile) => d.tone === "danger" ? c.statusDanger : d.tone === "warning" ? readable(c.statusWarning, c) : c.foregroundMuted;
895
+ const grow = (d: DockTile) => d.key === "prs" ? 1.7 : 1;
896
+ return <View testID="follow-up-dock" style={{ flexShrink: 0, gap: 6, paddingHorizontal: compact ? 10 : 8, paddingTop: 8, paddingBottom: compact ? 10 : 8, borderBottomWidth: 1, borderBottomColor: c.border, backgroundColor: c.surface0 }}>
897
+ {[tiles.slice(0, 3), tiles.slice(3)].map((line, i) => <View key={i} style={{ flexDirection: "row", gap: 6 }}>
898
+ {line.map(d => {
899
+ const on = pane === d.key;
900
+ const words = [d.label, d.count != null ? String(d.count) : null, d.words].filter(Boolean).join(" · ");
901
+ return <Pressable key={d.key} accessibilityRole="button" accessibilityState={{ selected: on }} onPress={() => press(d)}
902
+ accessibilityLabel={d.key === "spec" ? (w.spec?.url ? `Spec: ${w.spec.title || "the spec"}, opens the doc` : "Spec: no spec yet, add one") : `${words}, the list here`}
903
+ style={s => ({ ...focusRing((s as { focused?: boolean }).focused, c, true), flex: grow(d), minWidth: 0, flexDirection: "row", alignItems: "center", justifyContent: "center", gap: 5, height: compact ? 44 : 32, paddingHorizontal: 8, borderRadius: 7, borderWidth: 1,
904
+ borderColor: on ? c.foregroundMuted : c.border, backgroundColor: on ? c.surface2 : (s as { hovered?: boolean }).hovered ? c.surface2 : d.muted ? c.surface0 : c.surface1 })}>
905
+ <Icon name={d.icon} size={13} color={d.tone === "plain" ? c.foregroundMuted : ink(d)} />
906
+ <Text numberOfLines={1} style={{ flexShrink: 1, fontSize: compact ? 13 : 12, lineHeight: 16, color: d.muted ? c.foregroundMuted : c.foreground, fontWeight: on ? "600" : "500" }}>
907
+ {d.label}{d.count != null && <Text style={{ color: c.foregroundMuted, fontVariant: ["tabular-nums"] }}>{` ${d.count}`}</Text>}
908
+ {!!d.words && <Text style={{ color: ink(d), fontWeight: "500" }}>{` · ${d.words}`}</Text>}
909
+ </Text>
910
+ {d.key === "spec" && !d.muted && <Icon name="ArrowUpRight" size={12} color={c.foregroundMuted} />}
911
+ </Pressable>;
912
+ })}
913
+ </View>)}
914
+ </View>;
915
+ }
916
+
917
+ /** A tile's whole list in Needs you's place; its Back bar names Needs you and its count, so what waits stays in sight. */
918
+ function PaneList(p: PanelProps & { section: PaneKey }) {
919
+ const { index, w, theme, compact, openOpen, section, setPane } = p;
920
+ const c = theme.colors; const t = text(c, compact);
921
+ const rows = expandRows(listRows(index, w, theme, section), w, theme, p.stacks);
922
+ const sum = index.summary(section); const needsN = index.summary("needs").count;
923
+ const label = section === "links" ? "Spec and linked" : SECTION_LABEL[section];
924
+ return <View style={{ flex: 1, minHeight: 0 }}>
925
+ <View style={{ flexDirection: "row", alignItems: "center", gap: 4, paddingHorizontal: 6, minHeight: compact ? 48 : 36, borderBottomWidth: 1, borderBottomColor: c.border }}>
926
+ <Pressable accessibilityRole="button" accessibilityLabel={`Back to Needs you${needsN ? `, ${needsN}` : ""}`} onPress={() => setPane(null)}
927
+ style={s => ({ ...focusRing((s as { focused?: boolean }).focused, c, true), flexDirection: "row", alignItems: "center", gap: 2, minHeight: compact ? 44 : 28, paddingHorizontal: 6, borderRadius: 6, backgroundColor: (s as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
928
+ <Icon name="ChevronLeft" size={16} color={c.foreground} />
929
+ <Text style={[t.label, { fontWeight: "500" }]}>Needs you{needsN ? <Text style={{ color: readable(c.statusWarning, c), fontWeight: "600" }}>{` ${needsN}`}</Text> : null}</Text>
930
+ </Pressable>
931
+ <Text numberOfLines={1} style={[t.label, { flex: 1, textAlign: "right", marginRight: 6, fontWeight: "600" }]}>{label} <Text style={{ color: c.foregroundMuted, fontWeight: "400" }}>{section === "links" ? rows.length : sum.count}</Text>
932
+ {!!sum.state && sum.tone !== "plain" && <Text style={{ color: sum.tone === "danger" ? c.statusDanger : readable(c.statusWarning, c), fontWeight: "400" }}>{` · ${sum.state}`}</Text>}</Text>
933
+ </View>
934
+ <ScrollView style={{ flex: 1 }} contentContainerStyle={{ paddingTop: 6, paddingBottom: 16 }}>
935
+ {!rows.length && <Text style={[t.meta, { paddingHorizontal: compact ? 16 : 14, paddingVertical: 8 }]}>Nothing here yet</Text>}
936
+ {rows.map(r => <PanelRow key={r.key} row={r} p={p} />)}
937
+ {section === "prs" && rows.length > 0 && <View style={{ flexDirection: "row", paddingHorizontal: compact ? 8 : 6, paddingTop: 6 }}><BackTo icon="ArrowRight" label="All pull requests, base to top" theme={theme} compact={compact} onPress={() => openOpen({ kind: "prs-all" })} /></View>}
938
+ {section === "links" && <View style={{ flexDirection: "row", paddingHorizontal: compact ? 8 : 6, paddingTop: 6 }}><BackTo icon="Pencil" label="Edit spec and linked" theme={theme} compact={compact} onPress={() => openOpen({ kind: "links-all" })} /></View>}
939
+ </ScrollView>
940
+ </View>;
941
+ }
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.5",
4
+ "version": "2.7.0-beta.6",
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": [
@@ -0,0 +1,124 @@
1
+ /**
2
+ * How the new view's reader lays out a question (client/questions.tsx `split`, AGENTS.md invariant 254,
3
+ * a-question-reads-whole-in-either-layout). Two layouts:
4
+ * - stacked: the question, then the answers under it. Every phone, every narrow reader, every short question.
5
+ * - newspaper: the question's first lines run the reader's full width (the lead), then the rest of it and its context
6
+ * flow in a left column with the answers beside them on the right, sticky.
7
+ *
8
+ * The choice is pure and costs a few string scans: line counts are estimated from the body font's average advance,
9
+ * never measured. A wrong estimate by a line or two only moves where the lead ends; the text always reads whole and in
10
+ * order, since the lead is cut at a paragraph, a sentence or (failing both) a word boundary outside any Markdown span.
11
+ */
12
+
13
+ /** The reader's body text: 15 px over 22 px lines; the average advance of the system UI font at 15 px. */
14
+ export const CHAR_PX = 7.4;
15
+ export const LINE_PX = 22;
16
+ /** The answers column: never narrower than an option card with its letter and recommend mark, never wider than a card reads. */
17
+ export const FORM_MIN = 340;
18
+ export const FORM_MAX = 440;
19
+ /** The gap between the two columns, and the narrowest the text column may get beside the answers. */
20
+ export const COL_GAP = 28;
21
+ export const TEXT_MIN = 300;
22
+ /** A question (with its context lines) up to this many full-width lines stacks: the answers sit right under it anyway. */
23
+ export const SHORT_LINES = 4;
24
+ /** The lead runs at most this many full-width lines. */
25
+ export const LEAD_LINES = 3;
26
+ /** An option label longer than this asks for the widest answers column. */
27
+ const LONG_LABEL = 48;
28
+
29
+ export type LayoutOption = { label: string; consequence?: string | null };
30
+ export type LayoutInput = {
31
+ /** The width the question body has (the reader's content box), in px. */
32
+ width: number;
33
+ /** A phone (compact): always stacked. */
34
+ phone: boolean;
35
+ /** The question's text as drawn (Markdown). */
36
+ text: string;
37
+ /** Lines its context draws under it (the note folds at 3, a line per link, the PR line). */
38
+ contextLines: number;
39
+ options: readonly LayoutOption[];
40
+ };
41
+ export type QuestionLayout = { kind: "stacked" } | { kind: "newspaper"; lead: string; rest: string; formWidth: number };
42
+
43
+ /** Markdown as it reads: a link reads as its label, code and emphasis marks take no room. */
44
+ const visible = (s: string) => s.replace(/!?\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/[`*_~]/g, "");
45
+
46
+ /** How many lines `text` takes at `width` px of body text: each paragraph at least one. */
47
+ export function estLines(text: string, width: number): number {
48
+ const per = Math.max(8, Math.floor(width / CHAR_PX));
49
+ return text.split("\n").reduce((n, line) => n + Math.max(1, Math.ceil(visible(line).trim().length / per)), 0);
50
+ }
51
+
52
+ /** Whether a cut after `prefix` falls outside every Markdown span: no open code, link or emphasis. */
53
+ function closed(prefix: string): boolean {
54
+ if ((prefix.match(/`/g) ?? []).length % 2) return false;
55
+ if ((prefix.match(/\*\*/g) ?? []).length % 2) return false;
56
+ let depth = 0;
57
+ for (const ch of prefix) { if (ch === "[" || ch === "(") depth++; else if ((ch === "]" || ch === ")") && depth > 0) depth--; }
58
+ return depth === 0;
59
+ }
60
+
61
+ const LIST_LINE = /^\s*(?:[-*+]|\d+[.)])\s/;
62
+
63
+ /**
64
+ * The question's lead: the longest start of it within `budget` visible characters that ends a paragraph, else a
65
+ * sentence, else a word; outside any Markdown span, and never between a list's lines. `lead + " " + rest` (or `lead`
66
+ * alone when nothing is left) is the text; with no clean cut inside the budget, the first clean cut after it.
67
+ */
68
+ export function splitLead(text: string, budget: number): { lead: string; rest: string } {
69
+ const src = text.trim();
70
+ const cuts: { at: number; rank: number }[] = [];
71
+ const lines = src.split("\n");
72
+ for (let i = 0; i < src.length; i++) {
73
+ const ch = src[i]!;
74
+ const next = src[i + 1];
75
+ if (next === undefined) break;
76
+ // A paragraph break (blank line), not inside a list run.
77
+ if (ch === "\n" && next === "\n") cuts.push({ at: i, rank: 0 });
78
+ // A sentence end: . ? ! (or :) then a space, inside a paragraph that isn't a list.
79
+ else if (/[.?!:]/.test(ch) && next === " ") cuts.push({ at: i + 1, rank: 1 });
80
+ else if (ch === " ") cuts.push({ at: i, rank: 2 });
81
+ }
82
+ const lineAt = (at: number) => { let n = 0, seen = 0; for (const l of lines) { if (at <= seen + l.length) return n; seen += l.length + 1; n++; } return n; };
83
+ const ok = (at: number) => {
84
+ const prefix = src.slice(0, at);
85
+ if (!closed(prefix)) return false;
86
+ // Never inside a list: neither the line it cuts nor the next line is a list item, unless the cut is a paragraph break.
87
+ const l = lineAt(at);
88
+ const inList = LIST_LINE.test(lines[l] ?? "") || (src[at] === "\n" && LIST_LINE.test(lines[l + 1] ?? ""));
89
+ return !inList || src.slice(at, at + 2) === "\n\n";
90
+ };
91
+ const fits = (at: number) => visible(src.slice(0, at)).length <= budget;
92
+ const pick = (rank: number) => {
93
+ let best = -1;
94
+ for (const c of cuts) if (c.rank === rank && fits(c.at) && ok(c.at)) best = c.at;
95
+ return best;
96
+ };
97
+ let at = pick(0);
98
+ if (at < 0) at = pick(1);
99
+ if (at < 0) at = pick(2);
100
+ if (at < 0) at = cuts.find(c => c.rank <= 1 && ok(c.at))?.at ?? cuts.find(c => ok(c.at))?.at ?? src.length;
101
+ const lead = src.slice(0, at).trim();
102
+ const rest = src.slice(at).trim();
103
+ return { lead, rest };
104
+ }
105
+
106
+ /** The answers column's width: about 40 % of the reader, the widest when a label is long. */
107
+ export function formWidth(width: number, options: readonly LayoutOption[]): number {
108
+ const longest = options.reduce((n, o) => Math.max(n, o.label.length), 0);
109
+ const base = Math.round(width * 0.4) + (longest > LONG_LABEL ? 80 : 0);
110
+ return Math.max(FORM_MIN, Math.min(FORM_MAX, base));
111
+ }
112
+
113
+ /** Which layout a question gets (see the module comment). */
114
+ export function questionLayout(i: LayoutInput): QuestionLayout {
115
+ if (i.phone) return { kind: "stacked" };
116
+ const form = formWidth(i.width, i.options);
117
+ if (i.width - form - COL_GAP < TEXT_MIN) return { kind: "stacked" };
118
+ const text = i.text.trim();
119
+ if (estLines(text, i.width) + i.contextLines <= SHORT_LINES) return { kind: "stacked" };
120
+ const per = Math.max(8, Math.floor(i.width / CHAR_PX));
121
+ const { lead, rest } = estLines(text, i.width) <= LEAD_LINES ? { lead: text, rest: "" } : splitLead(text, per * LEAD_LINES);
122
+ if (!rest && i.contextLines === 0) return { kind: "stacked" };
123
+ return { kind: "newspaper", lead, rest, formWidth: form };
124
+ }
@@ -40,6 +40,7 @@ import { emptyDraft, patchDraft, questionDraftKey, readDraft, seedDraft } from "
40
40
  import { fieldNotes, workspaceText } from "./agent-text.mjs";
41
41
  import { spinAngle, spinStart } from "./spin";
42
42
  import { questionText } from "./questions";
43
+ import { questionLayout } from "./question-layout";
43
44
  export { reopenViolations } from "./reopen";
44
45
 
45
46
  /**
@@ -898,6 +899,27 @@ export const INVARIANTS: Invariant[] = [
898
899
  return diffEntry(w, JSON.parse(JSON.stringify(w)) as Workspace) ? "an unchanged entry made a patch" : null;
899
900
  },
900
901
  },
902
+ {
903
+ id: "a-question-reads-whole-in-either-layout",
904
+ why: "2026-12-05 (AGENTS.md invariant 254): the new view's reader always split a question beside its answers, which looked wrong when the text was short. Short questions now stack and long ones get the newspaper (a full-width lead, the rest beside the answers); the cut must never drop, reorder or break the question's words, and a phone must always stack.",
905
+ check(w) {
906
+ // At most a few questions and widths, so the check costs the same for any workspace.
907
+ for (const q of w.questions.slice(-5)) {
908
+ const text = questionText(q.question, q.links ?? []).text.trim();
909
+ if (!text) continue;
910
+ const options = q.options.map(o => ({ label: o.label, consequence: o.consequence ?? null }));
911
+ if (questionLayout({ width: 1200, phone: true, text, contextLines: 0, options }).kind !== "stacked") return `${q.id}: a phone got two columns`;
912
+ for (const width of [720, 960, 1280]) {
913
+ const l = questionLayout({ width, phone: false, text, contextLines: 2, options });
914
+ if (l.kind !== "newspaper") continue;
915
+ const whole = l.rest ? `${l.lead} ${l.rest}` : l.lead;
916
+ if (whole.replace(/\s+/g, " ") !== text.replace(/\s+/g, " ")) return `${q.id}: the lead and the rest don't make the question at ${width}px`;
917
+ if (!l.lead) return `${q.id}: an empty lead at ${width}px`;
918
+ }
919
+ }
920
+ return null;
921
+ },
922
+ },
901
923
  ];
902
924
 
903
925
  export function violations(w: Workspace, now: number): { id: string; detail: string }[] {
package/shared/view-r.ts CHANGED
@@ -206,3 +206,48 @@ export function viewAtRow(at: ViewAt, rowKeys: readonly string[]): string | null
206
206
  const keys = at.kind === "question" ? [`need:question:${at.id}`, `need:answer:${at.id}`] : [`card:${at.id}`];
207
207
  return keys.find(k => rowKeys.includes(k)) ?? null;
208
208
  }
209
+
210
+ /**
211
+ * The side panel and phone (invariant 225, the-panel-is-needs-you-and-a-dock): the dock's tiles under the header,
212
+ * Needs you filling what is left, and a 5-row cap on every section of the tab view's index.
213
+ */
214
+ export const CAP = 5;
215
+ /** At most CAP rows; past it the CAP-1 first and how many more ("N more" opens the whole list in the reader). */
216
+ export function capRows<T>(rows: readonly T[]): { shown: T[]; more: number } {
217
+ if (rows.length <= CAP) return { shown: [...rows], more: 0 };
218
+ return { shown: rows.slice(0, CAP - 1), more: rows.length - (CAP - 1) };
219
+ }
220
+
221
+ export type DockTile = { key: "prs" | "spec" | "links" | "agents" | "tasks" | "cards"; label: string; icon: string; count: number | null; words: string | null; tone: SectionSummary["tone"]; muted: boolean };
222
+ /** The dock: six tiles in two fixed rows, the same at any count; a tile's words are its most urgent state, plain says none. */
223
+ export function dockTiles(s: { prs: SectionSummary; tasks: SectionSummary; links: number; agents: number; cards: number; spec: boolean }): DockTile[] {
224
+ const urgent = (x: SectionSummary) => x.tone === "plain" ? null : x.state;
225
+ return [
226
+ { key: "prs", label: "PRs", icon: "GitPullRequest", count: s.prs.count, words: urgent(s.prs), tone: s.prs.tone, muted: false },
227
+ { key: "spec", label: "Spec", icon: "FileText", count: null, words: null, tone: "plain", muted: !s.spec },
228
+ { key: "links", label: "Links", icon: "Link", count: s.links, words: null, tone: "plain", muted: false },
229
+ { key: "agents", label: "Agents", icon: "Bot", count: s.agents, words: null, tone: "plain", muted: false },
230
+ { key: "tasks", label: "Tasks", icon: "ListChecks", count: s.tasks.count, words: urgent(s.tasks), tone: s.tasks.tone, muted: false },
231
+ { key: "cards", label: "Cards", icon: "LayoutList", count: s.cards, words: null, tone: "plain", muted: false },
232
+ ];
233
+ }
234
+
235
+ /** How many measured rows fit `box` px, keeping room for an "N more" line when not all do; unmeasured (0) draws all. */
236
+ export function fitCount(heights: readonly number[], box: number, moreH: number): number {
237
+ if (!box || heights.reduce((n, h) => n + h, 0) <= box) return heights.length;
238
+ let y = 0; let fit = 0;
239
+ for (const h of heights) { if (y + h + moreH > box) break; y += h; fit++; }
240
+ return fit;
241
+ }
242
+
243
+ /** Nothing needs you: what is moving instead, running agents first, then PRs in checks or review, at most QUIET_CAP. */
244
+ export const QUIET_CAP = 5;
245
+ export const quietRows = <T>(running: readonly T[], waiting: readonly T[]): T[] => [...running, ...waiting].slice(0, QUIET_CAP);
246
+ /** The line when nothing moves either: the last activity's age in one unit ("1h ago", never "1h 29m ago"). */
247
+ export function lastActivityWords(at: string | null, now: number): string {
248
+ const ms = at ? now - Date.parse(at) : NaN;
249
+ if (!Number.isFinite(ms)) return "Nothing needs you";
250
+ const m = Math.max(0, Math.floor(ms / 60_000));
251
+ const age = m < 1 ? "just now" : m < 60 ? `${m}m ago` : m < 60 * 24 ? `${Math.floor(m / 60)}h ago` : `${Math.floor(m / 1440)}d ago`;
252
+ return `Nothing needs you · last activity ${age}`;
253
+ }