paseo-follow-up 2.6.0-beta.1 → 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 (94) hide show
  1. package/OVERVIEW.md +1 -5
  2. package/client/brief-since.tsx +4 -3
  3. package/client/catch-up.tsx +75 -22
  4. package/client/floating-surface.tsx +79 -0
  5. package/client/fold.tsx +49 -0
  6. package/client/header.tsx +5 -3
  7. package/client/home-chrome.tsx +3 -2
  8. package/client/home-data.ts +3 -1
  9. package/client/home-list.tsx +19 -11
  10. package/client/home-view.ts +8 -1
  11. package/client/home.tsx +13 -2
  12. package/client/keys.ts +2 -0
  13. package/client/kit.tsx +39 -17
  14. package/client/large.tsx +5 -3
  15. package/client/merge-button.tsx +3 -2
  16. package/client/messages.tsx +8 -2
  17. package/client/more-context.tsx +23 -9
  18. package/client/morning-brief-settings.tsx +5 -4
  19. package/client/needs-you.tsx +17 -6
  20. package/client/new-settings.tsx +7 -6
  21. package/client/now-lines.tsx +60 -0
  22. package/client/onboarding.tsx +5 -5
  23. package/client/paged-list.tsx +115 -0
  24. package/client/panel.tsx +45 -20
  25. package/client/pr-stats-settings.tsx +3 -2
  26. package/client/pr-stats.tsx +10 -10
  27. package/client/questions.tsx +64 -40
  28. package/client/release-notes.tsx +10 -9
  29. package/client/review-mode.tsx +3 -2
  30. package/client/reviewers.tsx +8 -3
  31. package/client/row-menu.tsx +7 -23
  32. package/client/row-open.ts +28 -0
  33. package/client/scroll-allowlist.ts +1 -0
  34. package/client/section-search.tsx +5 -3
  35. package/client/settings-shell.tsx +9 -15
  36. package/client/settings.tsx +36 -14
  37. package/client/shipping.tsx +5 -4
  38. package/client/stacks.tsx +31 -14
  39. package/client/tasks.tsx +11 -7
  40. package/client/your-questions.tsx +388 -0
  41. package/index.client.tsx +10 -2
  42. package/index.server.ts +137 -34
  43. package/package.json +1 -1
  44. package/server/agent-actions.ts +23 -14
  45. package/server/agent-hook.mjs +2 -2
  46. package/server/agent-parity.ts +22 -6
  47. package/server/brief-timeline.ts +47 -0
  48. package/server/check-watches.ts +8 -7
  49. package/server/compass.ts +5 -0
  50. package/server/context-requests.ts +90 -21
  51. package/server/daemon.ts +1 -0
  52. package/server/directory.ts +6 -0
  53. package/server/discovery.ts +4 -1
  54. package/server/engine.ts +40 -8
  55. package/server/hook-source.ts +2 -2
  56. package/server/inbox-classifier.ts +17 -0
  57. package/server/inbox.ts +9 -3
  58. package/server/mcp-source.ts +26 -18
  59. package/server/mcp.mjs +26 -18
  60. package/server/obligations.ts +9 -5
  61. package/server/questions.ts +2 -1
  62. package/server/report-issue-adapter.ts +2 -2
  63. package/server/scheduled-tasks.ts +10 -8
  64. package/server/tasks.ts +2 -1
  65. package/server/turn-end.ts +4 -1
  66. package/server/wait-jobs.ts +28 -4
  67. package/server/wait-runner-source.ts +1 -1
  68. package/server/wait-runner.sh +1 -1
  69. package/shared/activity.ts +4 -2
  70. package/shared/attention.ts +5 -5
  71. package/shared/catch-up.ts +65 -20
  72. package/shared/chat.ts +2 -2
  73. package/shared/contracts.ts +56 -9
  74. package/shared/finished.ts +18 -0
  75. package/shared/floating.ts +38 -0
  76. package/shared/history.ts +155 -0
  77. package/shared/home-keys.ts +1 -0
  78. package/shared/home.ts +58 -10
  79. package/shared/list.ts +4 -1
  80. package/shared/model.ts +25 -4
  81. package/shared/now.ts +237 -0
  82. package/shared/paged.ts +96 -0
  83. package/shared/pr-status.ts +43 -0
  84. package/shared/presentation.ts +2 -22
  85. package/shared/send-decision.ts +37 -4
  86. package/shared/settings-nav.ts +15 -0
  87. package/shared/sort.ts +8 -1
  88. package/shared/status-invariants.ts +13 -0
  89. package/shared/status.ts +3 -1
  90. package/shared/task-due.ts +5 -4
  91. package/shared/task-dup.ts +2 -1
  92. package/shared/task-status.ts +2 -1
  93. package/shared/your-questions.ts +133 -0
  94. package/skills/follow-up/SKILL.md +1 -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,4 +1,5 @@
1
1
  import { useCallback, useEffect, useRef, useState } from "react";
2
+ import { PagedRows } from "./paged-list";
2
3
  import { Platform, View } from "react-native";
3
4
  import { Pressable, Text } from "./text";
4
5
  import { useRpc } from "@getpaseo/plugin/client";
@@ -261,7 +262,7 @@ export function QueueScreen({ theme, compact, onHome, navigation }: { theme: The
261
262
  {view && !view.groups.length && <Text style={t.meta}>{filter === "all" ? "Nothing is assigned to you in the queue's states." : filter === "changed" ? "Nothing changed since you last read the brief." : "Every issue in your queue has a workspace."}</Text>}
262
263
  {view?.groups.map(g => <View key={g.priority} style={{ gap: 0 }}>
263
264
  <Text accessibilityRole="header" style={[t.section, { marginTop: 8 }]}>{g.name} · {g.count}</Text>
264
- {g.issues.map(i => <QueueRow key={i.key} i={i} change={changes.get(i.key)} c={c} compact={compact} timeZone={tz} navigation={navigation} />)}
265
+ <PagedRows items={g.issues} resetKey={filter} theme={theme} compact={compact} noun="issues" row={i => <QueueRow key={i.key} i={i} change={changes.get(i.key)} c={c} compact={compact} timeZone={tz} navigation={navigation} />} />
265
266
  </View>)}
266
267
  </ScrollView>;
267
268
  }
@@ -281,7 +282,7 @@ export function NobodyRows({ theme, compact, data, onDismissed }: { theme: Theme
281
282
  // pushes the new list on the home feed; without the feed, onDismissed reads it once.
282
283
  const dismiss = useDismiss(onDismissed);
283
284
  const now = Date.now();
284
- return <>{data.needs.map(r => {
285
+ return <PagedRows items={data.needs} theme={theme} compact={compact} noun="issues" row={r => {
285
286
  const row = nobodyRow(r, now, data.timeZone);
286
287
  const first = r.reasons[0]!;
287
288
  const reason = <PriorityLine reason={first.line} source={first.from === "compass" ? { kind: "compass", label: first.source } : { kind: "linear", label: first.source }} c={c} size={compact ? 12 : 11} lines={compact ? 2 : 1} />;
@@ -317,5 +318,5 @@ export function NobodyRows({ theme, compact, data, onDismissed }: { theme: Theme
317
318
  </View>
318
319
  </>}
319
320
  </RevealScope>;
320
- })}</>;
321
+ }} />;
321
322
  }
@@ -1,7 +1,10 @@
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
4
6
  // move are the pure session in shared/catch-up.ts (context-never-blocks-the-deck, the-card-on-screen-never-moves).
7
+ import { usePagedList } from "./paged-list";
5
8
  import { useEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
6
9
  import { Animated, PanResponder, Platform, View } from "react-native";
7
10
  import { Pressable, Text } from "./text";
@@ -19,7 +22,7 @@ import { CATCH_UP_RAIL_DEFAULT, CATCH_UP_RAIL_MAX, CATCH_UP_RAIL_MIN } from "../
19
22
  import { CATCH_UP_KEYS, MODE, catchUpKey, contextFor, keyLabel, deckCards, groupOf, openInWorkspace, park, prevPos, applySwipe, skipWorkspace, swipeLock, swipeOutcome, settle as settleCard, startSession, statsOf, sync, type ContextRequest, type DeckCard, type Outcome, type Session } from "../shared/catch-up";
20
23
  import type { Workspace } from "../shared/model";
21
24
  import type { ListWorkspace } from "../shared/list";
22
- import { bottomInset, Button, focusSoon, IconButton, SubmitScope, text, type Theme } from "./kit";
25
+ import { bottomInset, Button, errorText, focusSoon, IconButton, SubmitScope, text, type Theme } from "./kit";
23
26
  import { glyphColor } from "./home-list";
24
27
  import { useHomeModel, type HomeSources } from "./home-data";
25
28
  import { useInbox } from "./inbox";
@@ -39,6 +42,8 @@ import { ownsKey, surfaceVisible } from "../shared/list-keys";
39
42
  import { useReducedMotion } from "./motion";
40
43
  import { PRIMARY_FORM } from "./dock";
41
44
  import { MorePanel, MoveResult, ContextAnswer } from "./more-context";
45
+ import { AnswerActions, AnswerView, ReplyForm, useQuestionActs } from "./your-questions";
46
+ import { questionLine, questionsByWorkspace } from "../shared/your-questions";
42
47
 
43
48
  export { MorePanel, MoveResult, ContextAnswer };
44
49
 
@@ -58,13 +63,18 @@ export function cardLabel(card: DeckCard, w: ListWorkspace | undefined): string
58
63
  if (card.kind === "question") { const q = w?.questions.find(x => x.id === card.questionId); return q ? `${q.id} · ${q.title}` : card.questionId ?? "Question"; }
59
64
  if (card.kind === "item" && card.item) return card.item.title;
60
65
  if (card.kind === "brief") return card.s.line || card.s.word || "Ask";
66
+ if (card.kind === "answer") return card.ask || "Your question";
61
67
  return card.s.line || "Finished";
62
68
  }
63
69
  /** The card's own word: a workspace row's word names its first item, the card names its own. */
70
+ /** "4m ago", or "just now" (never "now ago"); empty when there's no time. */
71
+ const agoText = (a: string) => !a ? "" : a === "now" ? "just now" : `${a} ago`;
72
+
64
73
  function cardWord(card: DeckCard): string {
65
74
  if (card.kind === "permission") return "Permission";
66
75
  if (card.kind === "question") return card.item?.kind === "question" && card.item.state === "stopped" ? "Agent stopped" : "Question";
67
76
  if (card.kind === "finished") return "Finished";
77
+ if (card.kind === "answer") return "Your question";
68
78
  if (card.kind === "brief") return card.s.word ?? "Ask";
69
79
  switch (card.item?.kind) {
70
80
  case "merge": return "Merge"; case "reviewers": return "Add reviewers"; case "send": return "Send"; case "answer": return "Your answer";
@@ -73,14 +83,14 @@ function cardWord(card: DeckCard): string {
73
83
  default: return card.s.word ?? "Needs you";
74
84
  }
75
85
  }
76
- const cardIcon = (card: DeckCard) => card.kind === "permission" ? "ShieldQuestion" : card.kind === "question" ? "MessageCircleQuestion"
86
+ const cardIcon = (card: DeckCard) => card.kind === "permission" ? "ShieldQuestion" : card.kind === "question" ? "MessageCircleQuestion" : card.kind === "answer" ? "MessageSquareReply"
77
87
  : card.item?.kind === "merge" ? "GitMerge" : card.item?.kind === "reviewers" ? "UserPlus" : card.item?.kind === "person" ? "UserRound" : card.item?.kind === "send" ? "Send" : card.kind === "finished" ? "Flag" : card.s.icon;
78
88
  /**
79
89
  * The card Skip names what it skips, so it never reads as the workspace (Tom, beta.3: "at first I thought it skips the
80
90
  * workspace"): the card's kind where one word says it, else "card", the deck's own word ("N skipped" counts cards).
81
91
  */
82
92
  export function skipNoun(card: Pick<DeckCard, "kind" | "item">): string {
83
- return card.kind === "question" ? "question" : card.kind === "permission" ? "permission" : card.item?.kind === "merge" ? "merge" : "card";
93
+ return card.kind === "question" ? "question" : card.kind === "answer" ? "answer" : card.kind === "permission" ? "permission" : card.item?.kind === "merge" ? "merge" : "card";
84
94
  }
85
95
  /** The card Skip's tooltip and accessible name: what it does and that the card comes back. */
86
96
  export const skipCardHint = (noun: string) => `Skip this ${noun}. It comes back after the rest`;
@@ -96,8 +106,10 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
96
106
  const version = useSyncExternalStore(live.subscribe, live.version, live.version);
97
107
  const context = useSyncExternalStore(extras.subscribe, extras.context, extras.context);
98
108
  // Everything comes from what the client already holds: Home's model, the inbox rows, the listed workspaces.
99
- const liveCards = useMemo(() => deckCards({ model, rows, items: id => { const w = live.get(id); return w ? needsYou(w as unknown as Workspace) : []; } }),
100
- [model, rows, version, live]); // eslint-disable-line react-hooks/exhaustive-deps
109
+ // Your questions: each unread answer is a card, last in its workstream (shared deckCards).
110
+ const unread = useMemo(() => questionsByWorkspace(context), [context]);
111
+ const liveCards = useMemo(() => deckCards({ model, rows, items: id => { const w = live.get(id); return w ? needsYou(w as unknown as Workspace) : []; }, answers: id => unread.get(id)?.unread ?? [] }),
112
+ [model, rows, version, live, unread]); // eslint-disable-line react-hooks/exhaustive-deps
101
113
  const byKey = useMemo(() => new Map(liveCards.map(x => [x.key, x])), [liveCards]);
102
114
  // A card that left Needs you keeps its last copy, so it can say "Handled elsewhere" in place.
103
115
  const seen = useRef(new Map<string, DeckCard>());
@@ -154,18 +166,20 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
154
166
  if (!doc || typeof win.addEventListener !== "function") return;
155
167
  const mac = isMac();
156
168
  const root = () => rootRef.current as unknown as Root | null;
157
- 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;
158
171
  const railItems = () => Array.from(root()?.querySelectorAll("[data-catch-up-rail] [role=\"button\"]") ?? []);
159
172
  const onKey = (e: Ev) => {
160
173
  const el = e.target as El | null;
161
174
  const r = root();
162
175
  const onBody = !el || el === doc.body;
163
- 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;
164
177
  const typing = !!el && (el.tagName === "INPUT" || el.tagName === "TEXTAREA" || !!el.isContentEditable);
165
178
  const hit = catchUpKey({ key: e.key, meta: e.metaKey, ctrl: e.ctrlKey, alt: e.altKey, shift: e.shiftKey, composing: e.isComposing, mac },
166
- { typing, inMore: !!el?.closest?.("[data-catch-up-more]"), moreOpen: more, inRail: !!el?.closest?.("[data-catch-up-rail]") });
179
+ { typing, inMore: !!el?.closest?.("[data-catch-up-more]"), moreOpen: more, inRail: !!el?.closest?.("[data-catch-up-rail]"), answer: card?.kind === "answer" });
167
180
  if (!hit || finished && !["back", "keys", "leave", "rail"].includes(hit.action)) return;
168
- 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; };
169
183
  switch (hit.action) {
170
184
  case "skip": skip(); break;
171
185
  case "skip-workspace": if (wsLeft < 2) return; skipWs(); break;
@@ -197,7 +211,11 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
197
211
  // Its sheet or popover takes focus itself (MoveResult).
198
212
  case "later": if (!click('[aria-label="Later (L)"]')) return; break;
199
213
  case "chat": if (!click('[aria-label="Open chat (O)"]')) return; break;
200
- case "chip": r.querySelectorAll("[data-catch-up-more] [role=\"radio\"]")[Number(hit.arg) - 1]?.click?.(); break;
214
+ // An answer card's own buttons (AnswerActions), so the key does exactly what the click does.
215
+ case "done": if (!click('[data-catch-up-card] [aria-label="Done (D)"]')) return; break;
216
+ case "reply": if (!click('[data-catch-up-card] [aria-label="Reply (W)"]')) return; break;
217
+ case "task": if (!click('[data-catch-up-card] [aria-label="Make a task (T)"]')) return; break;
218
+ case "chip": scopes().flatMap(s => Array.from(s.querySelectorAll("[data-catch-up-more] [role=\"radio\"]")))[Number(hit.arg) - 1]?.click?.(); break;
201
219
  case "ask": if (!click('[data-catch-up-more] [data-ask-agent] [role="button"]')) return; break;
202
220
  case "rail": {
203
221
  const items = railItems();
@@ -226,6 +244,8 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
226
244
  const reduced = useReducedMotion();
227
245
  const drag = useRef(new Animated.Value(0)).current;
228
246
  const [dragDir, setDragDir] = useState<"skip-workspace" | "back" | null>(null);
247
+ // The desktop rail pages (client/paged-list.tsx) and follows the card on screen: a deck of hundreds draws one page.
248
+ const railPage = usePagedList({ items: session.order, resetKey: String(session.pos), follow: session.pos, theme, compact, noun: "cards" });
229
249
  const width = useRef(390);
230
250
  const lock = useRef<"x" | "y" | null>(null);
231
251
  // The finger's own offset from where it went down: react-native-web's accumulated gestureState.dx runs ahead of a
@@ -293,12 +313,13 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
293
313
  onSkipped={() => setSession(s => ({ ...s, pos: s.order.findIndex(k => s.outcomes[k] === "skipped"), lapped: true }))} />
294
314
  // The card on screen is the selected one: its x shows without hover (dismissing-anything-in-needs-you-sends-the-agent-nothing).
295
315
  : <DismissReveal.Provider value="always"><CardView key={card.key} card={card} w={w} theme={theme} compact={compact} deps={deps} navigation={navigation} gone={gone} more={more} setMore={setMore}
296
- request={askFor(context, card)} waiting={!!session.parked[card.s.key]} onAsk={ask}
316
+ request={askFor(context, card)} answer={card.requestId ? context.find(r => r.id === card.requestId) ?? null : null} waiting={!!session.parked[card.s.key]} onAsk={ask}
297
317
  sameWorkspace={session.order.filter(k => cardOf(k)?.s.key === card.s.key)}
298
318
  onDone={() => settle("done")} onSkip={skip} onSkipWorkspace={wsLeft > 1 ? skipWs : undefined} wsLeft={wsLeft} onBack={session.pos > 0 ? back : undefined} onLater={() => settle("later")} /></DismissReveal.Provider>;
299
319
 
300
320
  const rail = <ScrollView {...({ dataSet: { catchUpRail: "1" } } as object)} contentContainerStyle={{ paddingVertical: 8 }}>
301
- {session.order.map((k, i) => {
321
+ {railPage.shown.map((k, at) => {
322
+ const i = (railPage.info?.from ?? 0) + at;
302
323
  const x = cardOf(k); if (!x) return null;
303
324
  const xw = x.s.workspaceId ? live.get(x.s.workspaceId) : undefined;
304
325
  const o = session.outcomes[k]; const here = i === session.pos;
@@ -316,6 +337,7 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
316
337
  </Pressable>
317
338
  </View>;
318
339
  })}
340
+ {railPage.footer}
319
341
  </ScrollView>;
320
342
 
321
343
  // Under the dragged card: the one the release would show, so the drag says where it goes.
@@ -351,9 +373,9 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
351
373
  }
352
374
 
353
375
  /** One card: who and what, the ask through its own surface's component, then the deck's moves pinned to the bottom. */
354
- function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMore, request, waiting, onAsk, sameWorkspace, onDone, onSkip, onSkipWorkspace, wsLeft, onBack, onLater }: {
376
+ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMore, request, answer, waiting, onAsk, sameWorkspace, onDone, onSkip, onSkipWorkspace, wsLeft, onBack, onLater }: {
355
377
  card: DeckCard; w: ListWorkspace | undefined; theme: Theme; compact: boolean; deps: CatchUpDeps; navigation: Nav; gone: boolean; more: boolean; setMore: (v: boolean | ((v: boolean) => boolean)) => void;
356
- request: ContextRequest | null; waiting: boolean; onAsk: (words: string, images?: ImageUpload[]) => Promise<void>;
378
+ request: ContextRequest | null; /** An `answer` card's question (Your questions). */ answer: ContextRequest | null; waiting: boolean; onAsk: (words: string, images?: ImageUpload[]) => Promise<void>;
357
379
  sameWorkspace: string[]; onDone: () => void; onSkip: () => void; onSkipWorkspace?: () => void; wsLeft: number; onBack?: () => void; onLater: () => void;
358
380
  }) {
359
381
  const c = theme.colors; const t = text(c, compact);
@@ -377,7 +399,7 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
377
399
  <Icon name={cardIcon(card)} size={14} color={color} />
378
400
  <Text numberOfLines={1} style={[t.meta, { flex: 1 }]}>
379
401
  <Text style={{ color, fontWeight: "600" }}>{word}</Text>
380
- {[s.at ? `${age(s.at, Date.now())} ago` : "", s.project].filter(Boolean).map(x => ` · ${x}`).join("")}
402
+ {[s.at ? agoText(age(s.at, Date.now())) : "", s.project].filter(Boolean).map(x => ` · ${x}`).join("")}
381
403
  {sameWorkspace.length > 1 ? ` · ${nth + 1} of ${sameWorkspace.length} here` : ""}
382
404
  </Text>
383
405
  </View>
@@ -406,7 +428,27 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
406
428
  <Button theme={theme} compact={compact} kind="primary" icon="ArrowRight" title="Next" onPress={onSkip} />
407
429
  </View>;
408
430
 
409
- const askBlock = card.kind === "question" && q && ws
431
+ const isAnswer = card.kind === "answer";
432
+ const acts = useQuestionActs();
433
+ const [replying, setReplying] = useState(false);
434
+ const [answerBusy, setAnswerBusy] = useState<"done" | "task" | "again" | null>(null);
435
+ const [answerError, setAnswerError] = useState<string | null>(null);
436
+ const answerRun = (what: "done" | "task" | "again", work: () => Promise<unknown>) => {
437
+ setAnswerBusy(what); setAnswerError(null);
438
+ work().then(onDone, e => setAnswerError(errorText(e))).finally(() => setAnswerBusy(null));
439
+ };
440
+ const answerChat = answer?.askedOf && navigation ? () => navigation.openAgent({ agentId: answer.askedOf! }) : openChat;
441
+ const answerActions = (bar: boolean) => answer && <AnswerActions r={answer} theme={theme} compact={compact} keys bar={bar} busy={answerBusy} openChat={bar ? answerChat : undefined}
442
+ onDone={() => answerRun("done", () => acts.act(answer.id, "done"))} onReply={() => setReplying(true)}
443
+ onTask={() => answerRun("task", () => acts.act(answer.id, "task"))}
444
+ onAskAgain={() => answerRun("again", async () => { await acts.ask({ workspaceId: answer.workspaceId, agentId: answer.cardKey ? answer.agentId : answer.askedOf, cardKey: answer.cardKey, card: answer.card || undefined, ask: answer.ask, via: answer.via === "slash" ? "slash" : answer.cardKey ? "more" : "field" }); await acts.act(answer.id, "done"); })}
445
+ extra={bar ? <Button theme={theme} compact kind="ghost" icon="ArrowRight" title={`Skip ${noun}`} accessibilityLabel={skipCardHint(noun)} onPress={onSkip} /> : undefined} />;
446
+ const askBlock = isAnswer ? answer ? <View style={{ gap: 14 }}>
447
+ <AnswerView r={answer} theme={theme} compact={compact} now={Date.now()} mainAgentId={full?.mainAgentId ?? w?.mainAgentId ?? null} big />
448
+ {replying ? <ReplyForm r={answer} theme={theme} compact={compact} onCancel={() => setReplying(false)} onSent={onDone} /> : !compact && answerActions(false)}
449
+ {!!answerError && <Text accessibilityRole="alert" style={[t.meta, { color: c.statusDanger }]}>{answerError}</Text>}
450
+ </View> : <RichText selectable style={t.ask}>{card.ask || "Your question"}</RichText>
451
+ : card.kind === "question" && q && ws
410
452
  ? <View style={{ gap: 8 }}>
411
453
  <View style={{ flexDirection: "row", alignItems: "flex-start", gap: 8 }}>
412
454
  <RichText plain style={[compact ? t.ask : [t.body, { fontSize: 15, lineHeight: 21, fontWeight: "600" }], { flex: 1, minWidth: 0 }]}>{`${q.id} · ${q.title}`}</RichText>
@@ -428,7 +470,7 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
428
470
  </View>;
429
471
 
430
472
  // Add context without answering: every card that isn't a question has the agent's reply box (a question has its note).
431
- const reply = card.kind !== "question" && s.agentId && <NoteRow theme={theme} compact={compact} agentId={s.agentId} />;
473
+ const reply = card.kind !== "question" && !isAnswer && s.agentId && <NoteRow theme={theme} compact={compact} agentId={s.agentId} />;
432
474
  const contextBlock = request && <ContextAnswer theme={theme} compact={compact} request={request} waiting={waiting} agent={agentName} openChat={openChat} openAgent={navigation ? id => navigation.openAgent({ agentId: id }) : undefined} />;
433
475
  // a-move-bar-action-opens-in-view (MOVE_OPENS): More context and Later open where the eye is, a sheet above the
434
476
  // phone's bar or a popover on their button on desktop, never appended below the card.
@@ -443,7 +485,7 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
443
485
  </View>;
444
486
  const toggleMore = () => { setLaterOpen(false); setMore(v => !v); };
445
487
  const toggleLater = () => { setMore(false); setLaterOpen(v => !v); };
446
- 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>;
447
489
 
448
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
449
491
  // agent takes the bar's primary slot: the question's own Send (onSendReady), so one click, one flow. Icon-only moves
@@ -451,9 +493,11 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
451
493
  const send = ready && (compact
452
494
  ? <View style={{ flex: 1 }}><Button theme={theme} compact grow kind="primary" icon="Send" title="Send" accessibilityLabel="Send to agent" shortcut disabled={ready.busy} onPress={ready.send} /></View>
453
495
  : <Button theme={theme} kind="primary" icon="Send" title="Send to agent" shortcut disabled={ready.busy} onPress={ready.send} />);
454
- const moves = <View {...({ dataSet: { catchUpCardMoves: "1" } } as object)} style={{ flexDirection: "row", alignItems: "center", gap: 8, paddingHorizontal: compact ? 12 : 0, paddingTop: compact ? 10 : 4 }}>
496
+ // An answer on a phone: its own actions are the thumb bar (Done, Reply, Task, ⋯ with Open chat and Skip); swipes still move.
497
+ const moves = compact && isAnswer && answer && !replying ? <View {...({ dataSet: { catchUpCardMoves: "1" } } as object)} style={{ paddingHorizontal: 12, paddingTop: 10 }}>{answerActions(true)}</View>
498
+ : <View {...({ dataSet: { catchUpCardMoves: "1" } } as object)} style={{ flexDirection: "row", alignItems: "center", gap: 8, paddingHorizontal: compact ? 12 : 0, paddingTop: compact ? 10 : 4 }}>
455
499
  <IconButton theme={theme} compact={compact} icon="ChevronLeft" label={compact ? "Back" : "Back (K or ←)"} tooltip={!compact} disabled={!onBack} onPress={() => onBack?.()} />
456
- {compact ? <IconButton theme={theme} compact icon="Sparkles" label="More context" onPress={toggleMore} />
500
+ {isAnswer ? null : compact ? <IconButton theme={theme} compact icon="Sparkles" label="More context" onPress={toggleMore} />
457
501
  : <View>{popover(moreBlock, "More context", 560)}<Tip label="More context (M)"><Button theme={theme} icon="Sparkles" title="More context" accessibilityHint="M" nativeID="catch-up-more" onPress={toggleMore} /></Tip></View>}
458
502
  <View>{!compact && popover(laterBlock, "Later", 380)}<IconButton theme={theme} compact={compact} icon="AlarmClock" label={compact ? "Later" : "Later (L)"} tooltip={!compact} disabled={!s.agentId} onPress={toggleLater} /></View>
459
503
  <IconButton theme={theme} compact={compact} icon="MessageSquare" label={compact ? "Open chat" : "Open chat (O)"} tooltip={!compact} disabled={!navigation} onPress={openChat} />
@@ -533,6 +577,14 @@ export type KeySection = { title: string; keys: readonly { key: string; what: st
533
577
  * over the screen; S or its X closes it.
534
578
  */
535
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]);
536
588
  const dictation = !!hostDictation();
537
589
  const sections = given ?? catchUpSections(dictation);
538
590
  const c = theme.colors; const t = text(c, false);
@@ -540,7 +592,7 @@ export function KeysSheet({ theme, onClose, label = "Catch up keys", sections: g
540
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>
541
593
  <Text style={[t.meta, { flex: 1, minWidth: 0 }]}>{k.what}</Text>
542
594
  </View>;
543
- 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 }}>
544
596
  <View style={{ flexDirection: "row", alignItems: "center" }}>
545
597
  <Text style={[t.label, { flex: 1, fontWeight: "600" }]}>Keys</Text>
546
598
  <IconButton theme={theme} compact={false} icon="X" label="Close the keys (S)" tooltip onPress={onClose} />
@@ -548,11 +600,12 @@ export function KeysSheet({ theme, onClose, label = "Catch up keys", sections: g
548
600
  {sections.filter(s => s.keys.length).map(s => <View key={s.title} style={{ gap: 6 }}>
549
601
  <Text style={[t.small, { fontWeight: "600" }]}>{s.title}</Text>{s.keys.map(row)}
550
602
  </View>)}
551
- </View>;
603
+ </FloatingSurface>;
552
604
  }
553
605
  /** Catch up's sheet: the dictation key only where the host has a mic. */
554
606
  const catchUpSections = (dictation: boolean): readonly KeySection[] => [
555
607
  { title: "On a card", keys: CATCH_UP_KEYS.filter(k => !k.when && (!k.needs || dictation)) },
608
+ { title: "On an answer to your question", keys: CATCH_UP_KEYS.filter(k => k.when === "answer") },
556
609
  { title: "In More context", keys: CATCH_UP_KEYS.filter(k => k.when === "more") },
557
610
  { title: "In the queue", keys: CATCH_UP_KEYS.filter(k => k.when === "rail") },
558
611
  ];
@@ -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";
package/client/header.tsx CHANGED
@@ -57,7 +57,7 @@ function LiveGlyph({ icon, colors }: { icon: LiveIcon; colors: Colors }) {
57
57
  }
58
58
  }
59
59
 
60
- export function WorkspaceHeader({ workspace: w, theme, compact, now, onSettings, onRefresh, refreshing, onAuto, autoPending, notice, onOpenPr, resize, hideTitle = false, onHome, more, openAgent }: {
60
+ export function WorkspaceHeader({ workspace: w, theme, compact, now, onSettings, onRefresh, refreshing, onAuto, autoPending, notice, onOpenPr, resize, hideTitle = false, onHome, more, openAgent, agentLines = false }: {
61
61
  workspace: Workspace; theme: Theme; compact: boolean; now: number; onSettings: (category?: SettingsCategory) => void; onRefresh: () => void; refreshing: boolean; onAuto: (next: boolean) => void; autoPending: boolean; notice: string | null; onOpenPr?: (key: string) => void;
62
62
  /** Expand to the larger view, or collapse back to the panel. Absent where the panel is already as wide as it gets. */
63
63
  resize?: { icon: "Maximize2" | "Minimize2"; label: string; onPress: () => void } | null;
@@ -69,6 +69,8 @@ export function WorkspaceHeader({ workspace: w, theme, compact, now, onSettings,
69
69
  more?: ReactNode;
70
70
  /** Why it matters' Ask the Overseer opens the Overseer's chat with the draft in it. */
71
71
  openAgent?: (agentId: string) => void;
72
+ /** Each agent's line is drawn below (client/now-lines.tsx), so "Main agent is working (on 1 repair)" isn't said twice. */
73
+ agentLines?: boolean;
72
74
  }) {
73
75
  const c = theme.colors; const t = text(c, compact);
74
76
  const parts = headline(w, now);
@@ -83,12 +85,12 @@ export function WorkspaceHeader({ workspace: w, theme, compact, now, onSettings,
83
85
  <IconButton icon="Settings" label="Follow-up settings" onPress={() => onSettings()} theme={theme} compact={compact} />
84
86
  </View>;
85
87
  const tail = <>
86
- <View style={{ flexDirection: "row", gap: 6, marginTop: 2 }}>
88
+ {!(agentLines && (live.icon === "spinner" || live.icon === "sent")) && <View style={{ flexDirection: "row", gap: 6, marginTop: 2 }}>
87
89
  <View style={{ paddingTop: 3 }}><IconSwap swapKey={live.icon} size={12}><LiveGlyph icon={live.icon} colors={c} /></IconSwap></View>
88
90
  <Text accessibilityLiveRegion="polite" style={[t.meta, { flex: 1, color: live.icon === "spinner" || live.icon === "sent" ? c.foreground : c.foregroundMuted }]}>
89
91
  {live.text}{live.since ? <Text style={{ color: c.foregroundMuted }}>{` · ${ago(live.since, now)}`}</Text> : null}
90
92
  </Text>
91
- </View>
93
+ </View>}
92
94
  {notice && <View accessibilityRole="alert" style={{ flexDirection: "row", gap: 6 }}>
93
95
  <View style={{ paddingTop: 3 }}><Icon name="TriangleAlert" size={12} color={c.statusWarning} /></View>
94
96
  <Text style={[t.meta, { flex: 1, color: c.statusWarning }]}>{notice}</Text>
@@ -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
 
@@ -88,7 +88,9 @@ export function useHomeModel(sources: HomeSources): HomeModel {
88
88
  // feed), so Home's header, strip and brief line and the sidebar badge (client/live.tsx) agree (nobody-s-on-it-is-needs-you).
89
89
  const raised = useSyncExternalStore(extras.subscribe, () => extras.queue().needs.length, () => 0);
90
90
  const compass = useSyncExternalStore(extras.subscribe, extras.compass, extras.compass);
91
- return useMemo(() => buildHome({ rows: inbox.rows(), tracked: live.all(), paseo: paseo.all(), now: Date.now(), sort, priorities, hidden: overseer ? [overseer] : [], hold, compass, raised }), [a, b, c, now, sort, priorities, inbox, live, paseo, overseer, hold, raised, compass]);
91
+ // Your questions: an unread answer is a Needs-you row; a question asking is its row's line (the home feed's context).
92
+ const questions = useSyncExternalStore(extras.subscribe, extras.context, extras.context);
93
+ return useMemo(() => buildHome({ rows: inbox.rows(), tracked: live.all(), paseo: paseo.all(), now: Date.now(), sort, priorities, hidden: overseer ? [overseer] : [], hold, compass, raised, questions }), [a, b, c, now, sort, priorities, inbox, live, paseo, overseer, hold, raised, compass, questions]);
92
94
  }
93
95
 
94
96
  /** Rebuilds a value at most every `ms` while mounted (used for the brief pane's source ages). */