paseo-follow-up 2.6.0-beta.2 → 2.6.0-beta.3

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.
Files changed (57) hide show
  1. package/OVERVIEW.md +1 -5
  2. package/client/catch-up.tsx +19 -7
  3. package/client/floating-surface.tsx +79 -0
  4. package/client/fold.tsx +49 -0
  5. package/client/home-chrome.tsx +3 -2
  6. package/client/kit.tsx +37 -18
  7. package/client/large.tsx +3 -3
  8. package/client/messages.tsx +3 -1
  9. package/client/more-context.tsx +6 -5
  10. package/client/needs-you.tsx +12 -2
  11. package/client/panel.tsx +24 -14
  12. package/client/questions.tsx +2 -1
  13. package/client/review-mode.tsx +3 -2
  14. package/client/row-menu.tsx +7 -23
  15. package/client/scroll-allowlist.ts +1 -0
  16. package/client/settings-shell.tsx +9 -15
  17. package/client/settings.tsx +25 -6
  18. package/client/stacks.tsx +21 -12
  19. package/client/tasks.tsx +8 -8
  20. package/client/your-questions.tsx +20 -7
  21. package/index.client.tsx +1 -1
  22. package/index.server.ts +4 -2
  23. package/package.json +1 -1
  24. package/server/agent-actions.ts +3 -3
  25. package/server/agent-parity.ts +1 -0
  26. package/server/check-watches.ts +8 -7
  27. package/server/compass.ts +5 -0
  28. package/server/daemon.ts +1 -0
  29. package/server/discovery.ts +2 -1
  30. package/server/engine.ts +37 -8
  31. package/server/mcp-source.ts +4 -4
  32. package/server/mcp.mjs +4 -4
  33. package/server/obligations.ts +5 -4
  34. package/server/questions.ts +2 -1
  35. package/server/report-issue-adapter.ts +2 -2
  36. package/server/scheduled-tasks.ts +10 -8
  37. package/server/tasks.ts +2 -1
  38. package/server/wait-jobs.ts +28 -4
  39. package/server/wait-runner-source.ts +1 -1
  40. package/server/wait-runner.sh +1 -1
  41. package/shared/activity.ts +2 -1
  42. package/shared/attention.ts +5 -5
  43. package/shared/contracts.ts +4 -1
  44. package/shared/finished.ts +18 -0
  45. package/shared/floating.ts +38 -0
  46. package/shared/history.ts +17 -22
  47. package/shared/home.ts +4 -2
  48. package/shared/model.ts +17 -4
  49. package/shared/now.ts +13 -4
  50. package/shared/pr-status.ts +43 -0
  51. package/shared/presentation.ts +2 -22
  52. package/shared/send-decision.ts +37 -4
  53. package/shared/settings-nav.ts +15 -0
  54. package/shared/status-invariants.ts +13 -0
  55. package/shared/task-due.ts +5 -4
  56. package/shared/task-dup.ts +2 -1
  57. package/shared/task-status.ts +2 -1
package/OVERVIEW.md CHANGED
@@ -26,11 +26,7 @@ you, in one place, ranked.
26
26
 
27
27
  It never merges, requests reviewers, archives, answers a question for you or wakes a resting agent on its own.
28
28
 
29
- ## Install
30
-
31
- ```sh
32
- paseo plugin install npm:paseo-follow-up
33
- ```
29
+ ## Requirements
34
30
 
35
31
  You need Paseo 0.15 or later and Node 22+ on the machine Paseo runs on. A signed-in GitHub CLI there is optional and
36
32
  turns on the PR features. Then open Follow-up in Paseo's sidebar: a two-minute setup walks you through the rest.
@@ -1,3 +1,5 @@
1
+ import { floatingScopes } from "../shared/floating";
2
+ import { FloatingSurface } from "./floating-surface";
1
3
  // Catch up: everything in Needs you, one card at a time (docs/design/catch-up.md, docs/needs-you.md#catch-up). It
2
4
  // renders the same components the panel and Home use (QuestionBody, NeedsYouList, BriefCard, the permission block), so
3
5
  // the answer flow is the shared one, never a fork (one-answer-flow-for-every-question). The deck's order and every
@@ -164,18 +166,20 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
164
166
  if (!doc || typeof win.addEventListener !== "function") return;
165
167
  const mac = isMac();
166
168
  const root = () => rootRef.current as unknown as Root | null;
167
- const inCard = (q: string) => root()?.querySelector(`[data-catch-up-card] ${q}`) ?? null;
169
+ const scopes = () => { const r = root(); return r ? floatingScopes(r, doc) : []; };
170
+ const inCard = (q: string) => scopes().map(r => r.querySelector(`[data-catch-up-card] ${q}`)).find(Boolean) ?? null;
168
171
  const railItems = () => Array.from(root()?.querySelectorAll("[data-catch-up-rail] [role=\"button\"]") ?? []);
169
172
  const onKey = (e: Ev) => {
170
173
  const el = e.target as El | null;
171
174
  const r = root();
172
175
  const onBody = !el || el === doc.body;
173
- if (!r || !ownsKey({ inside: !!el && r.contains(el), onBody, claimBody: true, visible: onBody && surfaceVisible(r, doc) })) return;
176
+ if (!r || !ownsKey({ inside: !!el && scopes().some(s => s.contains(el)), onBody, claimBody: true, visible: onBody && surfaceVisible(r, doc) })) return;
174
177
  const typing = !!el && (el.tagName === "INPUT" || el.tagName === "TEXTAREA" || !!el.isContentEditable);
175
178
  const hit = catchUpKey({ key: e.key, meta: e.metaKey, ctrl: e.ctrlKey, alt: e.altKey, shift: e.shiftKey, composing: e.isComposing, mac },
176
179
  { typing, inMore: !!el?.closest?.("[data-catch-up-more]"), moreOpen: more, inRail: !!el?.closest?.("[data-catch-up-rail]"), answer: card?.kind === "answer" });
177
180
  if (!hit || finished && !["back", "keys", "leave", "rail"].includes(hit.action)) return;
178
- const click = (q: string) => { const b = r.querySelector(q); b?.click?.(); return !!b; };
181
+ const query = (q: string) => scopes().map(s => s.querySelector(q)).find(Boolean) ?? null;
182
+ const click = (q: string) => { const b = query(q); b?.click?.(); return !!b; };
179
183
  switch (hit.action) {
180
184
  case "skip": skip(); break;
181
185
  case "skip-workspace": if (wsLeft < 2) return; skipWs(); break;
@@ -211,7 +215,7 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
211
215
  case "done": if (!click('[data-catch-up-card] [aria-label="Done (D)"]')) return; break;
212
216
  case "reply": if (!click('[data-catch-up-card] [aria-label="Reply (W)"]')) return; break;
213
217
  case "task": if (!click('[data-catch-up-card] [aria-label="Make a task (T)"]')) return; break;
214
- case "chip": r.querySelectorAll("[data-catch-up-more] [role=\"radio\"]")[Number(hit.arg) - 1]?.click?.(); break;
218
+ case "chip": scopes().flatMap(s => Array.from(s.querySelectorAll("[data-catch-up-more] [role=\"radio\"]")))[Number(hit.arg) - 1]?.click?.(); break;
215
219
  case "ask": if (!click('[data-catch-up-more] [data-ask-agent] [role="button"]')) return; break;
216
220
  case "rail": {
217
221
  const items = railItems();
@@ -481,7 +485,7 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
481
485
  </View>;
482
486
  const toggleMore = () => { setLaterOpen(false); setMore(v => !v); };
483
487
  const toggleLater = () => { setMore(false); setLaterOpen(v => !v); };
484
- const popover = (open: ReactNode, label: string, width: number) => open && <MoveResult place="popover" theme={theme} label={label} width={width}>{open}</MoveResult>;
488
+ const popover = (open: ReactNode, label: string, width: number) => open && <MoveResult place="popover" theme={theme} label={label} width={width} onClose={() => { setMore(false); setLaterOpen(false); }}>{open}</MoveResult>;
485
489
 
486
490
  // The deck's moves: in thumb reach on phones, under the card on desktop. Once the card has an answer to send, Send to
487
491
  // agent takes the bar's primary slot: the question's own Send (onSendReady), so one click, one flow. Icon-only moves
@@ -573,6 +577,14 @@ export type KeySection = { title: string; keys: readonly { key: string; what: st
573
577
  * over the screen; S or its X closes it.
574
578
  */
575
579
  export function KeysSheet({ theme, onClose, label = "Catch up keys", sections: given, keyWidth = 64 }: { theme: Theme; onClose: () => void; label?: string; sections?: readonly KeySection[]; /** The key column, wide enough for the list's longest key so every description lines up. */ keyWidth?: number }) {
580
+ useEffect(() => {
581
+ if (Platform.OS !== "web") return;
582
+ type Key = { key: string; metaKey: boolean; ctrlKey: boolean; altKey: boolean; preventDefault(): void; stopPropagation(): void };
583
+ const win = globalThis as unknown as { addEventListener?(t: string, f: (e: Key) => void): void; removeEventListener?(t: string, f: (e: Key) => void): void };
584
+ const key = (e: Key) => { if (e.key.toLowerCase() === "s" && !e.metaKey && !e.ctrlKey && !e.altKey) { e.preventDefault(); e.stopPropagation(); onClose(); } };
585
+ win.addEventListener?.("keydown", key);
586
+ return () => win.removeEventListener?.("keydown", key);
587
+ }, [onClose]);
576
588
  const dictation = !!hostDictation();
577
589
  const sections = given ?? catchUpSections(dictation);
578
590
  const c = theme.colors; const t = text(c, false);
@@ -580,7 +592,7 @@ export function KeysSheet({ theme, onClose, label = "Catch up keys", sections: g
580
592
  <View style={{ width: keyWidth }}><Text style={[t.meta, { alignSelf: "flex-start", paddingHorizontal: 6, borderRadius: 4, borderWidth: 1, borderColor: c.border, color: c.foreground, fontVariant: ["tabular-nums"] }]}>{keyLabel(k.key, isMac())}</Text></View>
581
593
  <Text style={[t.meta, { flex: 1, minWidth: 0 }]}>{k.what}</Text>
582
594
  </View>;
583
- return <View role="dialog" accessibilityLabel={label} style={{ position: "absolute", zIndex: 10, right: 20, top: 8, width: 236 + keyWidth, padding: 16, gap: 12, borderRadius: 10, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1, shadowColor: "#000", shadowOpacity: 0.25, shadowRadius: 12 }}>
595
+ return <FloatingSurface modal={false} side="top-right" label={label} width={236 + keyWidth} onClose={onClose} style={{ padding: 16, gap: 12, borderRadius: 10, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1, shadowColor: "#000", shadowOpacity: 0.25, shadowRadius: 12 }}>
584
596
  <View style={{ flexDirection: "row", alignItems: "center" }}>
585
597
  <Text style={[t.label, { flex: 1, fontWeight: "600" }]}>Keys</Text>
586
598
  <IconButton theme={theme} compact={false} icon="X" label="Close the keys (S)" tooltip onPress={onClose} />
@@ -588,7 +600,7 @@ export function KeysSheet({ theme, onClose, label = "Catch up keys", sections: g
588
600
  {sections.filter(s => s.keys.length).map(s => <View key={s.title} style={{ gap: 6 }}>
589
601
  <Text style={[t.small, { fontWeight: "600" }]}>{s.title}</Text>{s.keys.map(row)}
590
602
  </View>)}
591
- </View>;
603
+ </FloatingSurface>;
592
604
  }
593
605
  /** Catch up's sheet: the dictation key only where the host has a mic. */
594
606
  const catchUpSections = (dictation: boolean): readonly KeySection[] => [
@@ -0,0 +1,79 @@
1
+ import { useEffect, useId, useLayoutEffect, useRef, useState, type ReactNode } from "react";
2
+ import { Modal as RNModal, ScrollView, Platform, View, useWindowDimensions, type ViewStyle } from "react-native";
3
+ import { Pressable } from "./text";
4
+ import { floatingPlacement, intersectFloatBox, type FloatBox, type FloatSide } from "../shared/floating";
5
+
6
+ type Node = { getBoundingClientRect?(): { left: number; top: number; width: number; height: number }; measureInWindow?(f: (x: number, y: number, width: number, height: number) => void): void };
7
+ type Events = { addEventListener(t: string, f: () => void, capture?: boolean): void; removeEventListener(t: string, f: () => void, capture?: boolean): void };
8
+ type Browser = Events & { visualViewport?: Events & { offsetLeft: number; offsetTop: number; width: number; height: number }; ResizeObserver?: new (f: () => void) => { observe(n: unknown): void; disconnect(): void } };
9
+
10
+ /**
11
+ * One bounded surface for every custom menu/popover. RN Modal preserves React/plugin context while moving the web
12
+ * subtree to document.body, outside transformed panels, clipped sidebar slots and host footer stacking contexts.
13
+ * Nonmodal keys help stays in its visible pane instead. The probe stays with the opener; resize and captured scroll
14
+ * remeasure it only while the popup is mounted.
15
+ */
16
+ export function FloatingSurface({ children, anchor, side = "below", width = 256, onClose, role = "dialog", label, style, contentRef, onSize, dismissOnEscape = true, dataSet, modal = true }: {
17
+ children: ReactNode; anchor?: { x: number; y: number }; side?: FloatSide; width?: number; onClose?: () => void;
18
+ role?: "menu" | "dialog" | "alertdialog"; label?: string; style?: ViewStyle; dataSet?: Record<string, string>;
19
+ modal?: boolean; dismissOnEscape?: boolean; contentRef?: { current: unknown }; onSize?: (s: { width: number; height: number }) => void;
20
+ }) {
21
+ const win = useWindowDimensions();
22
+ const owner = useId();
23
+ const probe = useRef<View>(null);
24
+ const wasVisible = useRef(false);
25
+ const closeRef = useRef(onClose); closeRef.current = onClose;
26
+ const [box, setBox] = useState<FloatBox | null>(null);
27
+ const [viewport, setViewport] = useState<FloatBox>({ x: 0, y: 0, width: win.width, height: win.height });
28
+ const [size, setSize] = useState<{ width: number; height: number } | null>(null);
29
+ useLayoutEffect(() => {
30
+ const browser = globalThis as unknown as Browser;
31
+ const measure = () => {
32
+ const v = browser.visualViewport;
33
+ const next = v ? { x: v.offsetLeft, y: v.offsetTop, width: v.width, height: v.height } : { x: 0, y: 0, width: win.width, height: win.height };
34
+ setViewport(old => old.x === next.x && old.y === next.y && old.width === next.width && old.height === next.height ? old : next);
35
+ const node = probe.current as unknown as Node | null;
36
+ const save = (x: number, y: number, width: number, height: number) => setBox(old => old?.x === x && old.y === y && old.width === width && old.height === height ? old : { x, y, width, height });
37
+ const r = node?.getBoundingClientRect?.();
38
+ if (r) {
39
+ if (r.width > 0 && r.height > 0) wasVisible.current = true;
40
+ else if (wasVisible.current) closeRef.current?.(); // A kept tab was hidden: its portal must leave too.
41
+ save(r.left, r.top, r.width, r.height);
42
+ }
43
+ else node?.measureInWindow?.(save);
44
+ };
45
+ measure();
46
+ if (Platform.OS !== "web") return;
47
+ browser.addEventListener?.("resize", measure); browser.addEventListener?.("scroll", measure, true);
48
+ browser.visualViewport?.addEventListener("resize", measure); browser.visualViewport?.addEventListener("scroll", measure);
49
+ const observer = browser.ResizeObserver ? new browser.ResizeObserver(measure) : null;
50
+ if (probe.current) observer?.observe(probe.current);
51
+ return () => { browser.removeEventListener?.("resize", measure); browser.removeEventListener?.("scroll", measure, true); browser.visualViewport?.removeEventListener("resize", measure); browser.visualViewport?.removeEventListener("scroll", measure); observer?.disconnect(); };
52
+ }, [win.width, win.height]);
53
+ useEffect(() => {
54
+ if (Platform.OS !== "web" || !onClose || !dismissOnEscape) return;
55
+ const doc = (globalThis as { document?: { addEventListener(t: string, f: (e: { key: string; preventDefault(): void }) => void): void; removeEventListener(t: string, f: (e: { key: string; preventDefault(): void }) => void): void } }).document;
56
+ const close = (e: { key: string; preventDefault(): void }) => { if (e.key === "Escape") { e.preventDefault(); onClose(); } };
57
+ doc?.addEventListener("keydown", close);
58
+ return () => doc?.removeEventListener("keydown", close);
59
+ }, [onClose, dismissOnEscape]);
60
+ const target = anchor ? { ...anchor, width: 0, height: 0 } : box;
61
+ const area = !modal && box ? intersectFloatBox(box, viewport) : viewport;
62
+ const at = floatingPlacement(target ?? { x: 0, y: 0, width: 0, height: 0 }, { width, height: size?.height ?? 0 }, area, anchor ? "point" : side);
63
+ const content = <View ref={contentRef as never} role={role} aria-label={label} {...({ dataSet: { ...dataSet, floatingOwner: owner } } as object)}
64
+ onLayout={e => { const next = e.nativeEvent.layout; setSize(old => old?.width === next.width && old.height === next.height ? old : { width: next.width, height: next.height }); onSize?.(next); }}
65
+ style={[style, { position: "absolute", ...at, left: at.left - (modal ? 0 : box?.x ?? 0), top: at.top - (modal ? 0 : box?.y ?? 0), zIndex: 1000, opacity: size && target ? 1 : 0, overflow: "hidden" }]}>
66
+ <ScrollView style={{ flexShrink: 1, minHeight: 0 }} contentContainerStyle={{ gap: style?.gap }} keyboardShouldPersistTaps="handled">{children}</ScrollView>
67
+ </View>;
68
+ return <>
69
+ <View ref={probe} nativeID={owner} collapsable={false} pointerEvents="none" style={{ position: "absolute", inset: 0 }} />
70
+ {/* Web Escape belongs to keydown, never RN Web's additional keyup callback. Native keeps hardware Back.
71
+ Nonmodal keys help stays within its visible pane, so the list behind it keeps its keyboard walk. */}
72
+ {modal ? <RNModal transparent visible animationType="none" onRequestClose={Platform.OS === "web" ? undefined : onClose}>
73
+ <View style={{ flex: 1 }}>
74
+ <Pressable accessible={false} focusable={false} onPress={onClose} style={{ position: "absolute", inset: 0 }} />
75
+ {content}
76
+ </View>
77
+ </RNModal> : content}
78
+ </>;
79
+ }
@@ -0,0 +1,49 @@
1
+ import { type ReactNode } from "react";
2
+ import { View, type StyleProp, type ViewStyle } from "react-native";
3
+ import { Icon } from "@getpaseo/plugin/client/ui";
4
+ import { Pressable } from "./text";
5
+ import { readOpen, writeOpen } from "../shared/settings-nav";
6
+ import { useViewVersion } from "./view-store";
7
+ import type { Theme } from "./theme";
8
+
9
+ /**
10
+ * The one fold (invariant 132, panel-sections-fold): every collapsible block, in settings and in the workspace's panel,
11
+ * reads its state here and draws its header through FoldButton. Open or closed is remembered per device and per
12
+ * block id (`follow-up.settings.fold.<id>`, in the device document on 0.16), never per workspace; until the
13
+ * developer chooses, `defaultOpen` decides.
14
+ */
15
+ export function useFold(id: string | null, defaultOpen: boolean): { open: boolean; toggle: () => void } {
16
+ // Read from device storage on every render: the localStorage cache paints first, the device document once it loads.
17
+ useViewVersion();
18
+ const open = id === null ? true : readOpen(id, defaultOpen);
19
+ return { open, toggle: () => { if (id !== null) writeOpen(id, !open); } };
20
+ }
21
+
22
+ /**
23
+ * A fold's header: a button with its expanded state, toggled by a click or Enter (React Native Web's press; Space
24
+ * never reaches it in Paseo, whose window listener takes it first). `label` is what a screen
25
+ * reader hears (the title, then the summary or count). `chevron`: "lead" draws a right/down chevron first (settings),
26
+ * "end" an up/down chevron last (the panel's cards). Only FoldButton draws a fold's chevron, always the same size and
27
+ * color in a box that never shrinks, so every header shows it in the same place: the end of the button, just before
28
+ * the section's own controls (a narrow header squeezed Activity's to a faint sliver between its title and tabs).
29
+ */
30
+ export const FOLD_CHEVRON_SIZE = 14;
31
+ export function FoldButton({ open, onToggle, label, theme, chevron, style, children }: {
32
+ open: boolean; onToggle: () => void; label: string; theme: Theme; chevron: "lead" | "end";
33
+ style: (hovered: boolean, pressed: boolean) => StyleProp<ViewStyle>; children: ReactNode;
34
+ }) {
35
+ const c = theme.colors;
36
+ const mark = (name: string) => <View {...({ dataSet: { foldChevron: chevron } } as object)}
37
+ style={{ flexShrink: 0, width: FOLD_CHEVRON_SIZE, height: FOLD_CHEVRON_SIZE, alignItems: "center", justifyContent: "center" }}>
38
+ <Icon name={name} size={FOLD_CHEVRON_SIZE} color={c.foregroundMuted} />
39
+ </View>;
40
+ return <Pressable accessibilityRole="button" accessibilityState={{ expanded: open }} aria-expanded={open}
41
+ accessibilityLabel={label} accessibilityHint={open ? "Collapses" : "Expands"} onPress={onToggle}
42
+ style={state => style(!!(state as { hovered?: boolean }).hovered, state.pressed)}>
43
+ {chevron === "lead" && mark(open ? "ChevronDown" : "ChevronRight")}
44
+ {children}
45
+ {chevron === "end" && mark(open ? "ChevronUp" : "ChevronDown")}
46
+ </Pressable>;
47
+ }
48
+
49
+ export { PANEL_FOLDS, type PanelFold } from "../shared/settings-nav";
@@ -1,3 +1,4 @@
1
+ import { FloatingSurface } from "./floating-surface";
1
2
  import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
2
3
  import { Platform, TextInput, View } from "react-native";
3
4
  import { AttachImageButton, ImageField, useImageAttachments, type ImageAttachments } from "./image-attach";
@@ -268,7 +269,7 @@ export function SortMenu({ theme, mode, onChange, rankedAt, touch, rank = null,
268
269
  {!compact && <Text numberOfLines={1} style={{ color: c.foreground, fontSize: 12 }}>{SORT_LABEL[mode]}</Text>}
269
270
  {!compact && <Icon name="ChevronDown" size={12} color={c.foregroundMuted} />}
270
271
  </Pressable>
271
- {open && <View accessibilityRole="menu" style={{ position: "absolute", top: touch ? 48 : compact ? 36 : 34, right: 0, minWidth: touch ? 240 : 220, paddingVertical: 4, borderRadius: 8, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1,
272
+ {open && <FloatingSurface role="menu" label="Sort workspaces" width={touch ? 240 : 220} onClose={() => setOpen(false)} style={{ paddingVertical: 4, borderRadius: 8, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1,
272
273
  shadowColor: "#000", shadowOpacity: 0.25, shadowRadius: 12, shadowOffset: { width: 0, height: 4 }, elevation: 8 }}>
273
274
  {SORT_MODES.map(m => <Pressable key={m} accessibilityRole="menuitem" accessibilityState={{ selected: m === mode }} onPress={() => { onChange(m); setOpen(false); }}
274
275
  style={state => ({ ...menuItemRow(touch), minHeight: touch ? 48 : 34, paddingHorizontal: touch ? 12 : 10, backgroundColor: (state as { hovered?: boolean }).hovered ? c.surface2 : "transparent" })}>
@@ -281,7 +282,7 @@ export function SortMenu({ theme, mode, onChange, rankedAt, touch, rank = null,
281
282
  </Pressable>}
282
283
  {note && <Text style={{ color: c.foregroundMuted, fontSize: 11, paddingHorizontal: touch ? 12 : 10, paddingTop: 4, paddingBottom: 6 }}>{note}</Text>}
283
284
  </View>
284
- </View>}
285
+ </FloatingSurface>}
285
286
  </View>;
286
287
  }
287
288
 
package/client/kit.tsx CHANGED
@@ -5,6 +5,7 @@ import { Icon } from "@getpaseo/plugin/client/ui";
5
5
  import { openExternalUrl, type PluginSvgIcon } from "@getpaseo/plugin/client";
6
6
  import { PressScale, Spinner } from "./motion";
7
7
  import { raised, tint, withAlpha, type Colors, type Theme } from "./theme";
8
+ import { FoldButton, PANEL_FOLDS, useFold, type PanelFold } from "./fold";
8
9
 
9
10
  export type { Theme } from "./theme";
10
11
 
@@ -172,34 +173,52 @@ export type CardTone = "plain" | "attention" | "success";
172
173
  /**
173
174
  * A raised container with an icon title. Attention cards trade the ring for a warning border. `search`: the section
174
175
  * is being searched (client/section-search.tsx), and its field takes the title's place in the header.
176
+ * `fold`: a section of the workspace panel (invariant 132, panel-sections-fold). The title, count and chevron are one
177
+ * button (client/fold.tsx), remembered per device per section; folded, the body unmounts and the header keeps the
178
+ * count and `summary`. Controls in `right` (search, tabs) sit outside the button and show only while open.
175
179
  */
176
180
  export function Card({ theme, icon, title, tone = "plain", count, right, children, compact = false, style, search, fold }: {
177
181
  theme: Theme; icon: string | PluginSvgIcon; title: string; tone?: CardTone; count?: string | number; right?: ReactNode; children: ReactNode; compact?: boolean; style?: StyleProp<ViewStyle>; search?: ReactNode;
178
- /** A card that folds to its header line: the whole header toggles it, with a chevron at the end. */
179
- fold?: { open: boolean; onToggle: () => void; label: string };
182
+ fold?: { id: PanelFold; defaultOpen?: boolean; /** Shown while folded. */ summary?: ReactNode; /** Shown while open (the tasks' line). */ openSummary?: ReactNode; /** What a screen reader hears after the title; else the count. */ label?: string };
180
183
  }) {
181
184
  const c = theme.colors;
185
+ const state = useFold(fold ? PANEL_FOLDS[fold.id] : null, fold?.defaultOpen ?? true);
186
+ const open = !fold || state.open;
182
187
  const accent = tone === "attention" ? c.statusWarning : tone === "success" ? c.statusSuccess : null;
183
- const head = { flexDirection: "row", alignItems: "center", gap: compact ? 8 : 7, paddingHorizontal: compact ? 14 : 12, paddingTop: 10, paddingBottom: fold && !fold.open ? 10 : 8, minHeight: compact ? 44 : undefined } as const;
184
- const inner = <>
185
- {/* The icon never shrinks: a header whose title, tabs and search run wider than the card (Activity on a narrow
186
- panel) squeezed it to a sliver, a stray mark before the title. */}
187
- <View style={{ flexShrink: 0 }}>{typeof icon === "string" ? <Icon name={icon} size={compact ? 16 : 14} color={accent ?? c.foregroundMuted} /> : <Icon icon={icon} size={compact ? 16 : 14} color={accent ?? c.foregroundMuted} />}</View>
188
- {search ?? <>
189
- <Text accessibilityRole="header" style={{ color: accent ?? c.foreground, fontSize: compact ? 14 : 13, lineHeight: compact ? 20 : 18, fontWeight: "600" }}>{title}</Text>
190
- {count !== undefined && count !== "" && <Chip theme={theme} color={accent ?? c.foregroundMuted} label={String(count)} />}
191
- <View style={{ flex: 1 }} />
192
- {right}
193
- {fold && <Icon name={fold.open ? "ChevronUp" : "ChevronDown"} size={14} color={c.foregroundMuted} />}
194
- </>}
188
+ const pad = { paddingHorizontal: compact ? 14 : 12, paddingTop: 10, paddingBottom: open ? 8 : 10, minHeight: compact ? 44 : undefined } as const;
189
+ const row = { flexDirection: "row", alignItems: "center", gap: compact ? 8 : 7 } as const;
190
+ // The icon never shrinks: a header whose title, tabs and search run wider than the card (Activity on a narrow
191
+ // panel) squeezed it to a sliver, a stray mark before the title.
192
+ const glyph = <View style={{ flexShrink: 0 }}>{typeof icon === "string" ? <Icon name={icon} size={compact ? 16 : 14} color={accent ?? c.foregroundMuted} /> : <Icon icon={icon} size={compact ? 16 : 14} color={accent ?? c.foregroundMuted} />}</View>;
193
+ const titled = <>
194
+ <Text accessibilityRole={fold ? undefined : "header"} numberOfLines={1} style={{ flexShrink: 0, color: accent ?? c.foreground, fontSize: compact ? 14 : 13, lineHeight: compact ? 20 : 18, fontWeight: "600" }}>{title}</Text>
195
+ {count !== undefined && count !== "" && <Chip theme={theme} color={accent ?? c.foregroundMuted} label={String(count)} />}
195
196
  </>;
197
+ const summary = fold ? (open ? fold.openSummary : fold.summary) : null;
198
+ const summaryNode = summary == null || summary === "" ? null : typeof summary === "string"
199
+ ? <Text numberOfLines={1} style={{ flexShrink: 1, color: c.foregroundMuted, fontSize: 12, lineHeight: 17, fontVariant: ["tabular-nums"] }}>{summary}</Text> : summary;
200
+ let head: ReactNode;
201
+ if (search) head = <View style={[row, pad]}>{glyph}{search}</View>;
202
+ else if (!fold) head = <View style={[row, pad]}>{glyph}{titled}<View style={{ flex: 1 }} />{right}</View>;
203
+ else {
204
+ const spoken = fold.label ?? (count !== undefined && count !== "" ? String(count) : "");
205
+ const button = <FoldButton open={open} onToggle={state.toggle} label={spoken ? `${title}, ${spoken}` : title} theme={theme} chevron="end"
206
+ style={(hovered, pressed) => [row, pad, { flex: 1, minWidth: 0, backgroundColor: pressed ? c.surface2 : hovered ? c.surface1 : "transparent" }]}>
207
+ {glyph}{titled}
208
+ {/* With no summary the spacer takes no gap of its own, so a header with controls (Activity's tabs) keeps room. */}
209
+ <View style={{ flex: 1, minWidth: 0, flexDirection: "row", justifyContent: "flex-end", marginLeft: summaryNode ? 0 : -row.gap }}>{summaryNode}</View>
210
+ </FoldButton>;
211
+ // The section's heading for screen readers wraps the button, as a disclosure's heading does.
212
+ head = open && right ? <View style={{ flexDirection: "row", alignItems: "center" }}>
213
+ <View accessibilityRole="header" style={{ flex: 1, minWidth: 0 }}>{button}</View>
214
+ <View style={{ flexDirection: "row", alignItems: "center", paddingRight: compact ? 10 : 8, paddingTop: 2 }}>{right}</View>
215
+ </View> : <View accessibilityRole="header">{button}</View>;
216
+ }
196
217
  // dataSet: a paged list inside turns its page back to this card's header (client/paged-list.tsx, toListStart).
197
218
  return <View {...({ dataSet: { pagedTop: "1" } } as object)} style={[{ marginHorizontal: compact ? 16 : 12, marginTop: 12, borderRadius: 8, overflow: "hidden", backgroundColor: c.surface0 },
198
219
  accent ? { borderWidth: 1, borderColor: withAlpha(accent, 0.7) } : raised(c), style]}>
199
- {fold ? <Pressable accessibilityRole="button" aria-expanded={fold.open} accessibilityState={{ expanded: fold.open }} accessibilityLabel={`${title}: ${fold.label}. ${fold.open ? "Hide" : "Show"} them`} onPress={fold.onToggle}
200
- style={state => ({ ...head, backgroundColor: state.pressed ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>{inner}</Pressable>
201
- : <View style={head}>{inner}</View>}
202
- {children}
220
+ {head}
221
+ {open && children}
203
222
  </View>;
204
223
  }
205
224
 
package/client/large.tsx CHANGED
@@ -5,7 +5,7 @@ import { Text } from "./text";
5
5
  import { type PluginScreenProps } from "@getpaseo/plugin/client";
6
6
  import { useWorkspace } from "./workspace-data";
7
7
  import type { LiveStore } from "./live";
8
- import type { PaseoWorkspaces } from "./home-data";
8
+ import type { HomeSources, PaseoWorkspaces } from "./home-data";
9
9
  import { Button, Card, CardRow, errorText, text } from "./kit";
10
10
  import { Skeleton } from "./motion";
11
11
  import { FOLLOW_UP_ICON } from "./follow-up-icon";
@@ -17,7 +17,7 @@ export const LARGE_SCREEN = "follow-up-workspace";
17
17
  * The panel opened as a Paseo screen: the host supplies the page, header and close button, and the
18
18
  * layout switches to two columns. Collapse (or Esc) returns to the workspace, where the panel still is.
19
19
  */
20
- export function FollowLarge(props: PluginScreenProps & PanelLinks & { live?: LiveStore; /** Paseo's workspace list: the running state Your questions shows. */ paseo?: PaseoWorkspaces; inbox?: InboxStore }) {
20
+ export function FollowLarge(props: PluginScreenProps & PanelLinks & { live?: LiveStore; /** Paseo's workspace list: the running state Your questions shows. */ paseo?: PaseoWorkspaces; inbox?: InboxStore; sources?: HomeSources }) {
21
21
  const { theme, layout, params, navigation } = props;
22
22
  const workspaceId = params.workspaceId ?? "";
23
23
  const c = theme.colors;
@@ -54,7 +54,7 @@ export function FollowLarge(props: PluginScreenProps & PanelLinks & { live?: Liv
54
54
  </CardRow>
55
55
  </Card>
56
56
  </View>;
57
- return <WorkspaceView theme={theme} layout={layout} host={props.host} navigation={navigation} workspace={w} large inbox={props.inbox}
57
+ return <WorkspaceView theme={theme} layout={layout} host={props.host} navigation={navigation} workspace={w} large inbox={props.inbox} sources={props.sources}
58
58
  loadError={query.error ? "Refresh failed. Showing the last saved state." : query.loadError}
59
59
  openSettings={props.openSettings} openOverview={props.openOverview} folds={folds} paseo={props.paseo}
60
60
  top={<PanelTop theme={theme} compact={layout.compact} openOverview={props.openOverview} openSettings={props.openSettings} />}
@@ -159,7 +159,9 @@ export function MessagesCard({ workspace: w, theme, compact, openAgent, now = Da
159
159
  if (!strip && !repairs.open.length) return null;
160
160
  const repairRow = repairs.open.find(r => r.task.key === repair) ?? null;
161
161
  // The card's title and icon say what it is; the strip under it says to whom, how many, when and why.
162
- return <Card theme={theme} compact={compact} icon="Send" title="Messages to the agent">
162
+ // Folded, the header says what is in the next message and where it stands ("2 repairs queued").
163
+ const folded = strip ? `${strip.what} ${strip.phase}` : `${repairs.open.length} repair${repairs.open.length === 1 ? "" : "s"} open`;
164
+ return <Card theme={theme} compact={compact} icon="Send" title="Messages to the agent" fold={{ id: "messages", summary: folded, label: folded }}>
163
165
  {strip && <StripRow strip={strip} w={w} theme={theme} compact={compact} onPreview={() => setPreview(true)} openAgent={openAgent} />}
164
166
  {page.shown.map(r => <RepairTaskRow key={r.task.key} row={r} w={w} theme={theme} compact={compact} onOpen={() => setRepair(r.task.key)} />)}
165
167
  {page.footer}
@@ -1,3 +1,4 @@
1
+ import { FloatingSurface } from "./floating-surface";
1
2
  // More context, the one component and the one request path for every surface that answers a question
2
3
  // (more-context-is-the-same-on-every-surface, docs/needs-you.md#more-context): Catch up's card (its move bar opens
3
4
  // MorePanel), and QuestionBody everywhere else: the panel's Needs you card, Home's detail pane, the question dialog, the
@@ -97,7 +98,7 @@ export function QuestionMoreContext({ workspace: w, question: q, theme, compact,
97
98
  * Where a move's result opens (MOVE_OPENS, a-move-bar-action-opens-in-view): a sheet in the phone's dock or a popover
98
99
  * on its desktop button. Focus moves into it (its first choice), and on the web it scrolls into view the least distance.
99
100
  */
100
- export function MoveResult({ place, theme, label, width, inset = false, children }: { place: "sheet" | "popover"; theme: Theme; label: string; width?: number; /** Inside a card: no margins of its own. */ inset?: boolean; children: ReactNode }) {
101
+ export function MoveResult({ place, theme, label, width, inset = false, children, onClose }: { place: "sheet" | "popover"; theme: Theme; label: string; width?: number; /** Inside a card: no margins of its own. */ inset?: boolean; children: ReactNode; onClose?: () => void }) {
101
102
  const c = theme.colors;
102
103
  const ref = useRef<View>(null);
103
104
  useEffect(() => {
@@ -110,11 +111,11 @@ export function MoveResult({ place, theme, label, width, inset = false, children
110
111
  }, 0);
111
112
  return () => clearTimeout(t);
112
113
  }, []);
114
+ if (place === "popover") return <FloatingSurface side="above" dataSet={{ moveResult: place }} width={width} onClose={onClose} label={label} contentRef={ref}
115
+ style={{ padding: 16, borderRadius: 12, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1, shadowColor: "#000", shadowOpacity: 0.22, shadowRadius: 16, shadowOffset: { width: 0, height: 6 } }}>{children}</FloatingSurface>;
113
116
  return <View ref={ref} {...({ dataSet: { moveResult: place } } as object)} role="dialog" accessibilityLabel={label}
114
- style={[{ padding: place === "sheet" ? 14 : 16, borderRadius: 12, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1 },
115
- place === "sheet"
116
- ? inset ? {} : { marginHorizontal: 12, marginTop: 12 }
117
- : { position: "absolute", zIndex: 20, left: 0, bottom: "100%", marginBottom: 8, width, shadowColor: "#000", shadowOpacity: 0.22, shadowRadius: 16, shadowOffset: { width: 0, height: 6 } }]}>
117
+ style={[{ padding: 14, borderRadius: 12, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1 },
118
+ inset ? {} : { marginHorizontal: 12, marginTop: 12 }]}>
118
119
  {children}
119
120
  </View>;
120
121
  }
@@ -243,10 +243,11 @@ function QuestionState({ workspace: w, questionId, theme }: { workspace: Workspa
243
243
  * a question becomes that question's section, carrying the brief's context; a brief that points at none keeps its own
244
244
  * card (`briefCard`, drawn bare inside the frame). Questions answer in place through follow.answer-question.
245
245
  */
246
- export function NeedsYouBlock({ workspace: w, theme, compact, actions, now, brief = null, briefCard = null, style }: {
246
+ export function NeedsYouBlock({ workspace: w, theme, compact, actions, now, brief = null, briefCard = null, style, fold = false }: {
247
247
  workspace: Workspace; theme: Theme; compact: boolean; actions: NeedActions; now: number;
248
248
  /** The agent's open brief this surface shows, or null. */ brief?: Pick<Brief, "questionIds" | "context" | "kind" | "moves"> | null;
249
249
  /** That brief's own card, drawn when it points at no open question. */ briefCard?: ReactNode; style?: StyleProp<ViewStyle>;
250
+ /** The workspace panel's section: it folds (client/fold.tsx), and folded its header names the first ask. */ fold?: boolean;
250
251
  }) {
251
252
  useReviewerSettings(); // re-renders on a No review change, so the block's rows and count drop the asks at once
252
253
  // Held before grouping: a clicked reviewers row keeps its place, and the brief it folds stays folded.
@@ -264,7 +265,8 @@ export function NeedsYouBlock({ workspace: w, theme, compact, actions, now, brie
264
265
  if (!block.count) return null; // held rows keep the block drawn after its last ask is done
265
266
  // In Later the block stays (its moves still work) but reads Later, without the attention border.
266
267
  const later = workspaceSnoozed(w, all, now) && w.snooze ? laterLabel(w.snooze.until, now) : null;
267
- return <Card theme={theme} compact={compact} icon={later ? "AlarmClock" : asked ? "Check" : "CircleAlert"} title={later ? `Later ${later}` : asked ? "Reviewers requested" : "Needs you"} tone={later || !count ? "plain" : "attention"} count={count || undefined} style={style}>
268
+ return <Card theme={theme} compact={compact} icon={later ? "AlarmClock" : asked ? "Check" : "CircleAlert"} title={later ? `Later ${later}` : asked ? "Reviewers requested" : "Needs you"} tone={later || !count ? "plain" : "attention"} count={count || undefined} style={style}
269
+ fold={fold ? { id: "needs", summary: firstAsk(block, w), label: `${count || block.count} open` } : undefined}>
268
270
  <PagedRows items={block.cards} theme={theme} compact={compact} noun="questions" row={card => card.kind === "brief"
269
271
  ? <View key="brief" style={{ borderTopWidth: 1, borderTopColor: theme.colors.border }}>{briefCard}</View>
270
272
  : <QuestionAsk key={card.questionId} workspace={w} questionId={card.questionId} context={card.brief ? brief?.context ?? null : null} theme={theme} compact={compact} now={now} openAgent={actions.openAgent}
@@ -273,6 +275,14 @@ export function NeedsYouBlock({ workspace: w, theme, compact, actions, now, brie
273
275
  </Card>;
274
276
  }
275
277
 
278
+ /** Folded, the header names what is first in the block: its first question or row, in the rows' own words. */
279
+ function firstAsk(block: ReturnType<typeof needsYouBlock>, w: Workspace): string | null {
280
+ const first = block.cards[0];
281
+ if (first?.kind === "question") return w.questions.find(q => q.id === first.questionId)?.title ?? null;
282
+ if (first) return null; // the brief's card: the count says it
283
+ return block.rows[0]?.title ?? null;
284
+ }
285
+
276
286
  /**
277
287
  * One open question as a section of the block. Open: title, Q chip and asked age; the brief's context when the agent
278
288
  * pointed its brief at it, under what the agent does meanwhile; then the options with Send. Collapsed: the
package/client/panel.tsx CHANGED
@@ -1,4 +1,5 @@
1
- import { useEffect, useRef, useState, type ReactNode } from "react";
1
+ import { finishedTask } from "../shared/finished";
2
+ import { createContext, useContext, useEffect, useRef, useState, type ReactNode } from "react";
2
3
  import { PagedRows } from "./paged-list";
3
4
  import type { SettingsCategory } from "../shared/settings-nav";
4
5
  import { recoveryActions } from "./recovery-actions";
@@ -203,7 +204,7 @@ function ShippedCard({ workspace: w, theme, compact, now }: { workspace: Workspa
203
204
  }
204
205
 
205
206
  /** Quiet extras: the main agent, optional recovery and the Graphite merge-when-ready connection. */
206
- function WorkspaceCard({ workspace: w, theme, compact, open, toggle, openAgent, browserReady, openOverview, editSpec }: { workspace: Workspace; theme: Theme; compact: boolean; open: (key: string) => boolean; toggle: (key: string) => void; openAgent?: (id: string) => void; browserReady: boolean | null; openOverview: () => void; editSpec: () => void }) {
207
+ function WorkspaceCard({ workspace: w, theme, compact, openAgent, browserReady, openOverview, editSpec }: { workspace: Workspace; theme: Theme; compact: boolean; openAgent?: (id: string) => void; browserReady: boolean | null; openOverview: () => void; editSpec: () => void }) {
207
208
  const c = theme.colors; const t = text(c);
208
209
  const control = useRpc(controlRpc); const send = useRpc(sendRpc); const runRecovery = useRpc(recoverRpc); const cache = useQueryClient(); const toast = useToast();
209
210
  const invalidate = () => { void cache.invalidateQueries({ queryKey: workspaceKey(w.id) }); void cache.invalidateQueries({ queryKey: overviewKey }); };
@@ -215,11 +216,10 @@ function WorkspaceCard({ workspace: w, theme, compact, open, toggle, openAgent,
215
216
  const actions = recoveryActions(last, { archived: w.archived, starting: recovery.isPending });
216
217
  const recoveryState = last ? last.state === "sent" ? "Recovery is running" : last.state === "completed" ? "Last recovery finished" : last.state === "pending" ? "Recovery is ready to run" : last.state === "sending" ? "Starting recovery" : "Recovery needs a check" : null;
217
218
  const active = w.prs.some(p => !settledForDisplay(p));
218
- const shown = open("workspace");
219
219
  const openUrl = (url: string) => { void openExternalUrl(url).catch(() => undefined); };
220
- return <View style={{ marginHorizontal: compact ? 16 : 12, marginTop: 12, borderRadius: 8, borderWidth: 1, borderColor: c.border, overflow: "hidden" }}>
221
- <View style={{ marginTop: -1 }}><FoldRow theme={theme} compact={compact} open={shown} onPress={() => toggle("workspace")} icon="SlidersHorizontal" iconColor={c.foregroundMuted} label="Spec, agent and recovery" /></View>
222
- {shown && <>
220
+ // Quiet and folded by default; open or closed is remembered per device, like every panel section.
221
+ return <Card theme={theme} compact={compact} icon="SlidersHorizontal" title="Spec, agent and recovery" fold={{ id: "workspace", defaultOpen: false }}>
222
+ <>
223
223
  <SpecRow workspace={w} theme={theme} compact={compact} onEdit={editSpec} />
224
224
  <LinkedItemsRow workspace={w} theme={theme} compact={compact} />
225
225
  <CardRow theme={theme} compact={compact}><SummaryRow workspaceId={w.id} theme={theme} compact={compact} /></CardRow>
@@ -261,13 +261,22 @@ function WorkspaceCard({ workspace: w, theme, compact, open, toggle, openAgent,
261
261
  <Button title="Open Graphite" icon="ExternalLink" theme={theme} compact={compact} accessibilityLabel="Connect Graphite" onPress={() => openUrl("https://app.graphite.com")} />
262
262
  </View>
263
263
  </CardRow>}
264
- </>}
265
- </View>;
264
+ </>
265
+ </Card>;
266
266
  }
267
267
 
268
- /** An agent's title from Paseo's client state (no fetch), or a short id while it loads or once it's gone. */
268
+ /**
269
+ * How an agent's title is read: Paseo's client state (no fetch) inside a workspace panel. The larger view is a screen
270
+ * with no client state, where useAgent throws ("Plugin state hooks must run inside a workspace panel"): there the
271
+ * title is the short id. Once Spec, agent and recovery's fold was remembered per device, opening it in the panel
272
+ * crashed the larger view on its next open.
273
+ */
274
+ const AgentTitleSource = createContext<(agentId: string) => string | null | undefined>((agentId: string) => useAgent(agentId, a => a.title));
275
+ const noClientState = () => null;
276
+
277
+ /** An agent's title, or a short id while it loads, once it's gone, or in the larger view. */
269
278
  function useAgentTitle(agentId: string): string {
270
- return useAgent(agentId, a => a.title) || `Agent ${agentId.slice(0, 8)}`;
279
+ return useContext(AgentTitleSource)(agentId) || `Agent ${agentId.slice(0, 8)}`;
271
280
  }
272
281
 
273
282
  /**
@@ -332,7 +341,7 @@ function OtherRootAgent({ agentId, mainAgentId, workspace: w, theme, compact, op
332
341
 
333
342
  function historyLabel(w: Workspace): string {
334
343
  const stacks = new Set(w.prs.map(p => p.stack)).size;
335
- const tasks = followUpObligations(w).filter(o => ["done", "waived"].includes(o.status)).length;
344
+ const tasks = followUpObligations(w).filter(o => finishedTask(o)).length;
336
345
  return [`${w.prs.length} PR${w.prs.length === 1 ? "" : "s"} in ${stacks} stack${stacks === 1 ? "" : "s"}`, tasks ? `${tasks} task${tasks === 1 ? "" : "s"} done` : null].filter(Boolean).join(" · ");
337
346
  }
338
347
 
@@ -394,9 +403,9 @@ export function WorkspaceView({ theme, layout, workspace: w, navigation, loadErr
394
403
  const shipped = <ShippedCard workspace={w} theme={theme} compact={compact} now={now} />;
395
404
  // What each agent is on now (shared/now.ts); once shipped nobody is working toward the goal.
396
405
  const agents = !done && <AgentLines workspace={w} inbox={inbox} theme={theme} compact={compact} now={now} openAgent={openAgent} />;
397
- const needs = <NeedsYouBlock workspace={w} theme={theme} compact={compact} now={now} brief={ask?.brief ?? null} briefCard={ask?.card ?? null} actions={{ openAgent, openPr: (key, intent) => setSheet({ key, intent }), openQuestion: setQuestion }} />;
406
+ const needs = <NeedsYouBlock workspace={w} theme={theme} compact={compact} now={now} brief={ask?.brief ?? null} briefCard={ask?.card ?? null} actions={{ openAgent, openPr: (key, intent) => setSheet({ key, intent }), openQuestion: setQuestion }} fold />;
398
407
  // Your questions (docs/needs-you.md#your-questions): under Needs you, the same card as Home's detail pane.
399
- const questions = <YourQuestionsCard workspaceId={w.id} mainAgentId={w.mainAgentId} theme={theme} compact={compact} openAgent={openAgent} running={running} />;
408
+ const questions = <YourQuestionsCard workspaceId={w.id} mainAgentId={w.mainAgentId} theme={theme} compact={compact} openAgent={openAgent} running={running} fold />;
400
409
  // Once shipped, the stack and tasks are history: one quiet fold instead of two near-empty cards.
401
410
  const history = done && <View style={{ marginHorizontal: compact ? 16 : 12, marginTop: 12, borderRadius: 8, borderWidth: 1, borderColor: theme.colors.border, overflow: "hidden" }}>
402
411
  <View style={{ marginTop: -1 }}><FoldRow theme={theme} compact={compact} open={isOpen("history")} onPress={() => toggle("history")} icon="History" iconColor={theme.colors.foregroundMuted} label={historyLabel(w)} /></View>
@@ -414,7 +423,8 @@ export function WorkspaceView({ theme, layout, workspace: w, navigation, loadErr
414
423
  // The send queue (what Follow-up sends the main agent next, and the repairs in it) is Follow-up's, not the agent's to-do list.
415
424
  const messages = showWork && <MessagesCard workspace={w} theme={theme} compact={compact} openAgent={openAgent} now={now} />;
416
425
  const log = <View ref={logRef} onLayout={e => { logY.current = e.nativeEvent.layout.y; }}><ActivityCard workspace={w} theme={theme} compact={compact} now={now} open={isOpen} toggle={toggle} onOpenQuestion={(id, q) => { setOldQuestion(q ?? null); setQuestion(id); }} /></View>;
417
- const extras = <WorkspaceCard workspace={w} theme={theme} compact={compact} open={isOpen} toggle={toggle} openAgent={openAgent} browserReady={browser.data ? browser.data.ready : null} openOverview={openOverview} editSpec={() => setSpecOpen(true)} />;
426
+ const workspaceCard = <WorkspaceCard workspace={w} theme={theme} compact={compact} openAgent={openAgent} browserReady={browser.data ? browser.data.ready : null} openOverview={openOverview} editSpec={() => setSpecOpen(true)} />;
427
+ const extras = large ? <AgentTitleSource.Provider value={noClientState}>{workspaceCard}</AgentTitleSource.Provider> : workspaceCard;
418
428
  return <View onLayout={event => setWidth(event.nativeEvent.layout.width)} style={{ flex: 1, backgroundColor: theme.colors.surface0 }}>
419
429
  {/* Phones fold the top bar into the header's own row. */}
420
430
  {!compact && top}
@@ -497,7 +497,7 @@ export function ActivityCard({ workspace: w, theme, compact, now, open, toggle,
497
497
  const tabButton = (id: ActivityTab, label: string, count?: number) => {
498
498
  const selected = tab === id;
499
499
  return <Pressable key={id} accessibilityRole="tab" aria-selected={selected} accessibilityState={{ selected }} accessibilityLabel={count !== undefined ? `${label}, ${count}` : label} onPress={() => setTab(id)} hitSlop={4}
500
- style={state => ({ flexDirection: "row", alignItems: "center", gap: 5, minHeight: compact ? 36 : 24, paddingHorizontal: 7, borderRadius: 999, backgroundColor: selected ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
500
+ style={state => ({ flexDirection: "row", alignItems: "center", gap: 5, minHeight: compact ? 36 : 24, paddingHorizontal: 6, borderRadius: 999, backgroundColor: selected ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
501
501
  <Text style={{ color: selected ? c.foreground : c.foregroundMuted, fontSize: 12, fontWeight: "600" }}>{label}</Text>
502
502
  {count !== undefined && <Text style={{ color: c.foregroundMuted, fontSize: 12, fontVariant: ["tabular-nums"] }}>{count}</Text>}
503
503
  </Pressable>;
@@ -510,6 +510,7 @@ export function ActivityCard({ workspace: w, theme, compact, now, open, toggle,
510
510
  : (info.pages > 1 || !searching) && <Pager theme={theme} compact={compact} info={info} busy={reply.isFetching && reply.isPlaceholderData} noun={tab === "timeline" ? "events" : "questions"}
511
511
  onPage={p => setPage({ key, at: p })} onLess={searching ? undefined : () => { setPage({ key, at: 0 }); toggle("activity"); }} />;
512
512
  return <Card theme={theme} compact={compact} icon="Activity" title="Activity" search={search.header}
513
+ fold={{ id: "activity", summary: info.page === 0 ? d.timeline[0]?.row.text ?? null : null }}
513
514
  right={<View style={{ flexDirection: "row", alignItems: "center", gap: 2 }}>{hasQuestions ? tabs(false) : null}{search.button}</View>}>
514
515
  {/* Searching: the tabs move under the field and count their matches, so a hit in the other tab is never hidden. */}
515
516
  {search.header && <View style={{ flexDirection: "row", paddingHorizontal: compact ? 14 : 12, paddingTop: 6, paddingBottom: 10 }}>{tabs(searching)}</View>}
@@ -1,3 +1,4 @@
1
+ import { FloatingSurface } from "./floating-surface";
1
2
  import { useState } from "react";
2
3
  import { View } from "react-native";
3
4
  import { Pressable, Text } from "./text";
@@ -85,13 +86,13 @@ export function ReviewModeRow({ repo, value, theme, compact, busy, onChange }: {
85
86
  <Text numberOfLines={1} style={{ color: c.foreground, fontSize: compact ? 15 : 14 }}>{REVIEW_MODE_LABELS[value].label}</Text>
86
87
  <Icon name="ChevronDown" size={compact ? 16 : 12} color={c.foregroundMuted} />
87
88
  </Pressable>
88
- {open && <View accessibilityRole="menu" accessibilityLabel={`Review for ${repo}`} style={{ position: "absolute", top: compact ? 50 : 38, ...(compact ? { left: 0, width: 264 } : { right: 0, width: 340 }), paddingVertical: 4,
89
+ {open && <FloatingSurface role="menu" label={`Review for ${repo}`} width={compact ? 264 : 340} onClose={() => setOpen(false)} style={{ paddingVertical: 4,
89
90
  borderRadius: 8, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1, shadowColor: "#000", shadowOpacity: 0.25, shadowRadius: 12, shadowOffset: { width: 0, height: 4 }, elevation: 8 }}>
90
91
  {REVIEW_MODES.map(mode => <Pressable key={mode} accessibilityRole="menuitem" accessibilityState={{ selected: mode === value }} onPress={() => { setOpen(false); if (mode !== value) onChange(mode); }}
91
92
  style={state => ({ ...menuItemRow(compact), minHeight: compact ? 56 : 44, paddingHorizontal: compact ? 12 : 10, paddingVertical: 6, backgroundColor: (state as { hovered?: boolean }).hovered ? c.surface2 : "transparent" })}>
92
93
  <MenuItemContent theme={theme} touch={compact} glyph={mode === value ? "Check" : null} label={REVIEW_MODE_LABELS[mode].label} hint={REVIEW_MODE_LABELS[mode].hint} hintLines={compact ? 2 : 1} />
93
94
  </Pressable>)}
94
- </View>}
95
+ </FloatingSurface>}
95
96
  </View>
96
97
  </SettingsRow>
97
98
  </View>;