paseo-follow-up 2.4.0-beta.2 → 2.4.0-beta.4

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 (106) hide show
  1. package/OVERVIEW.md +1 -1
  2. package/client/action-row.tsx +97 -0
  3. package/client/agents.tsx +3 -3
  4. package/client/brief-since.tsx +307 -0
  5. package/client/chat.tsx +1 -1
  6. package/client/dismiss.tsx +6 -4
  7. package/client/display.tsx +4 -1
  8. package/client/header.tsx +1 -1
  9. package/client/home-data.ts +10 -3
  10. package/client/home-list.tsx +18 -9
  11. package/client/home-view.ts +35 -4
  12. package/client/home.tsx +45 -8
  13. package/client/host-slot.tsx +114 -0
  14. package/client/job-rows.tsx +3 -3
  15. package/client/kit.tsx +19 -12
  16. package/client/list-keys.ts +11 -3
  17. package/client/messages.tsx +165 -0
  18. package/client/morning-brief-settings.tsx +202 -7
  19. package/client/needs-you.tsx +11 -8
  20. package/client/new-entry.tsx +21 -0
  21. package/client/new-settings.tsx +223 -0
  22. package/client/new.tsx +663 -0
  23. package/client/onboarding.tsx +4 -4
  24. package/client/panel.tsx +23 -9
  25. package/client/questions.tsx +14 -7
  26. package/client/rename.tsx +9 -18
  27. package/client/report-issue.tsx +16 -27
  28. package/client/row-actions.ts +23 -8
  29. package/client/row-menu.tsx +19 -2
  30. package/client/search-key.ts +25 -5
  31. package/client/settings.tsx +16 -6
  32. package/client/tasks.tsx +112 -225
  33. package/client/theme.ts +16 -0
  34. package/client/toast-store.ts +1 -1
  35. package/index.client.tsx +29 -5
  36. package/index.server.ts +132 -31
  37. package/package.json +1 -1
  38. package/server/about.ts +8 -17
  39. package/server/agent-actions.ts +3 -3
  40. package/server/agent-hook.mjs +42 -11
  41. package/server/agent-parity.ts +20 -2
  42. package/server/agent-settings.ts +2 -2
  43. package/server/ai-jobs.ts +13 -8
  44. package/server/ask.ts +62 -0
  45. package/server/brief-sources.ts +215 -0
  46. package/server/daemon.ts +8 -4
  47. package/server/dispatch.ts +37 -27
  48. package/server/engine.ts +5 -3
  49. package/server/hook-source.ts +42 -11
  50. package/server/job-guard.ts +71 -0
  51. package/server/linear-issues.ts +6 -7
  52. package/server/linear-queue.ts +53 -10
  53. package/server/linked.ts +4 -7
  54. package/server/mcp-source.ts +10 -8
  55. package/server/mcp.mjs +10 -8
  56. package/server/message-queue.ts +17 -4
  57. package/server/morning-brief.ts +18 -17
  58. package/server/obligations.ts +38 -3
  59. package/server/ranker.ts +89 -24
  60. package/server/scopes.ts +9 -2
  61. package/server/session-prompt.ts +105 -0
  62. package/server/source-tools.ts +135 -0
  63. package/server/tasks.ts +1 -1
  64. package/shared/activity.ts +16 -5
  65. package/shared/agent-settings.ts +14 -7
  66. package/shared/ask.ts +128 -0
  67. package/shared/attention.ts +16 -8
  68. package/shared/brief-since.ts +194 -0
  69. package/shared/brief-sources.ts +396 -0
  70. package/shared/chat.ts +4 -4
  71. package/shared/contracts.ts +27 -5
  72. package/shared/dispatch.ts +44 -3
  73. package/shared/display.ts +4 -2
  74. package/shared/headline.ts +7 -6
  75. package/shared/home.ts +13 -5
  76. package/shared/issue-workspace.ts +65 -0
  77. package/shared/job-rows.ts +8 -8
  78. package/shared/linear-issues.ts +12 -3
  79. package/shared/linear-queue.ts +42 -2
  80. package/shared/list-entries.ts +10 -3
  81. package/shared/list-keys.ts +21 -3
  82. package/shared/list.ts +1 -1
  83. package/shared/model.ts +23 -18
  84. package/shared/morning-brief.ts +22 -3
  85. package/shared/new-settings.ts +81 -0
  86. package/shared/new-view.ts +280 -0
  87. package/shared/priorities.ts +2 -2
  88. package/shared/questions.ts +19 -2
  89. package/shared/queue.ts +38 -3
  90. package/shared/ranker.ts +20 -7
  91. package/shared/recommend.ts +4 -3
  92. package/shared/row-menu.ts +76 -6
  93. package/shared/search-key.ts +38 -4
  94. package/shared/send-decision.ts +1 -1
  95. package/shared/send-words.ts +21 -0
  96. package/shared/sending.ts +8 -6
  97. package/shared/settings-nav.ts +2 -1
  98. package/shared/status-invariants.ts +30 -0
  99. package/shared/status.ts +4 -3
  100. package/shared/task-due.ts +209 -0
  101. package/shared/task-dup.ts +46 -0
  102. package/shared/task-rows.ts +6 -4
  103. package/shared/task-status.ts +8 -2
  104. package/shared/task-trigger.ts +4 -1
  105. package/shared/task-view.ts +123 -0
  106. package/skills/follow-up/SKILL.md +1 -1
@@ -50,6 +50,8 @@ export type HomeListProps = {
50
50
  top?: ReactNode;
51
51
  /** Phones: a row placed right after the Needs-you group (the setup offer), so it never pushes the first ask down. */
52
52
  afterNeeds?: ReactNode;
53
+ /** Decision Q8's raised Linear issues, drawn first in Needs you when `model.raised` counts any. */
54
+ raised?: ReactNode;
53
55
  /** Phones: the action under the "Nothing followed yet" empty state. */
54
56
  emptyAction?: ReactNode;
55
57
  /** While searching: one flat ranked list instead of the groups. */
@@ -90,7 +92,10 @@ export type HomeListProps = {
90
92
 
91
93
  const noMenu: OpenRowMenu = () => undefined;
92
94
 
93
- export function HomeList({ model, theme, dense = false, touch, selectedKey, onSelect, briefLine, renderExpanded, header, footer, top, afterNeeds, emptyAction, results, hits = null, activeResult = 0, onResult, filter = null, overseer = null, stackOverseer = false, asking = false, menu, onSendNow, keys, selectedBg }: HomeListProps) {
95
+ /** Where a phone row's text starts: its 14 padding, the 18 glyph, the 10 gap. Older's explainer lines up with it. */
96
+ export const TOUCH_ROW_TEXT = 14 + 18 + 10;
97
+
98
+ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSelect, briefLine, renderExpanded, header, footer, top, afterNeeds, raised, emptyAction, results, hits = null, activeResult = 0, onResult, filter = null, overseer = null, stackOverseer = false, asking = false, menu, onSendNow, keys, selectedBg }: HomeListProps) {
94
99
  const c = theme.colors;
95
100
  const [openMenu, setOpenMenu] = useState<RowMenuOpen | null>(null);
96
101
  const build = menu.build;
@@ -122,13 +127,14 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
122
127
  switch (item.type) {
123
128
  // "Archived" heads its results like a group: small caps on desktop, sentence case at 13 on phones (GroupHeader).
124
129
  case "label": return <Text accessibilityRole={item.key === "l:archived" ? "header" : undefined} style={{ color: c.foregroundMuted, fontSize: item.key === "l:archived" && !touch ? 11 : 13, fontWeight: item.key === "l:archived" ? "600" : "400",
125
- letterSpacing: item.key === "l:archived" && !touch ? 0.6 : 0, textTransform: item.key === "l:archived" && !touch ? "uppercase" : "none", paddingHorizontal: dense ? 8 : 16, paddingTop: 12, paddingBottom: 4 }}>{item.text}</Text>;
130
+ letterSpacing: item.key === "l:archived" && !touch ? 0.6 : 0, textTransform: item.key === "l:archived" && !touch ? "uppercase" : "none", paddingHorizontal: dense ? 8 : 16, ...(item.key === "l:older" && touch ? { paddingLeft: TOUCH_ROW_TEXT } : null), paddingTop: 12, paddingBottom: 4 }}>{item.text}</Text>;
126
131
  case "empty": return <View accessibilityRole="summary" style={{ marginHorizontal: 16, marginTop: 20, gap: 6 }}>
127
132
  <Text accessibilityRole="header" style={{ color: c.foreground, fontSize: 17, lineHeight: 23, fontWeight: "600" }}>Nothing followed yet</Text>
128
133
  <Text style={{ color: c.foregroundMuted, fontSize: 14, lineHeight: 20 }}>Follow a workspace from its Follow-up panel, or turn a project on in Settings so its workspaces join on their own. They show up here once their agents work.</Text>
129
134
  {emptyAction ? <View style={{ flexDirection: "row", marginTop: 6 }}>{emptyAction}</View> : null}
130
135
  </View>;
131
136
  case "slot": return <View style={{ paddingVertical: 10 }}>{afterNeeds}</View>;
137
+ case "raised": return <>{raised}</>;
132
138
  case "hold": return <HoldLine theme={theme} text={item.text} dense={dense} touch={touch} />;
133
139
  // The list's own Row (search-row-is-the-list-row); the keyboard-active result wears the selected style.
134
140
  case "result": return <Row s={item.s} sig={item.s.sig} hit={item.hit} theme={theme} dense={dense} touch={touch} selected={item.index === activeResult} menuOpen={menuKey === item.s.key}
@@ -156,7 +162,7 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
156
162
  </View>;
157
163
  }
158
164
  }
159
- }, [theme, c, dense, touch, selectedKey, onSelect, briefLine, renderExpanded, toggle, toggleProject, activeResult, onResult, pickResult, model, overseer?.state, overseer?.line, overseer?.ranges, stackOverseer, asking, afterNeeds, emptyAction, onMenu, menuKey, onSendNow, selectedBg]);
165
+ }, [theme, c, dense, touch, selectedKey, onSelect, briefLine, renderExpanded, toggle, toggleProject, activeResult, onResult, pickResult, model, overseer?.state, overseer?.line, overseer?.ranges, stackOverseer, asking, afterNeeds, raised, emptyAction, onMenu, menuKey, onSendNow, selectedBg]);
160
166
 
161
167
  const listRef = useRef<NativeFlatList<Entry>>(null);
162
168
  const rootRef = useRef<View>(null);
@@ -293,10 +299,10 @@ function RowTime({ s, c, size }: { s: Workstream; c: Colors; size: number }) {
293
299
  * clips (so the lowest-priority chips drop, last first), and a lone chip truncates. Guarded by
294
300
  * `scripts/screenshots.mjs --only rowchips` (CDP boxes at list widths 320, 360 and 400) and tests/row-chips.test.ts.
295
301
  */
296
- function ChipRail({ s, c }: { s: Workstream; c: Colors }) {
302
+ function ChipRail({ s, c, dim = false }: { s: Workstream; c: Colors; /** An Older row: chips at 60 %, like its glyph. */ dim?: boolean }) {
297
303
  const chips = railChips(s);
298
304
  if (chips.length === 0) return null;
299
- return <View testID="follow-up-row-chips" style={{ flexShrink: 1000, minWidth: 0, height: 20, overflow: "hidden", flexDirection: "row", flexWrap: "wrap", justifyContent: "flex-end", columnGap: 10, rowGap: 4 }}>
305
+ return <View testID="follow-up-row-chips" style={{ ...(dim ? { opacity: 0.6 } : {}), flexShrink: 1000, minWidth: 0, height: 20, overflow: "hidden", flexDirection: "row", flexWrap: "wrap", justifyContent: "flex-end", columnGap: 10, rowGap: 4 }}>
300
306
  {chips.map(ch => ch.kind === "badge" ? <BadgeView key={ch.badge.text} b={ch.badge} c={c} /> : <PrChipView key="pr" s={s} c={c} />)}
301
307
  </View>;
302
308
  }
@@ -325,7 +331,10 @@ const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect, onMe
325
331
  const c = theme.colors;
326
332
  const trigger = useRowMenuTrigger(s, onMenu, touch);
327
333
  const archived = s.icon === "Archive" && s.sig.startsWith("archived:");
328
- const color = archived ? c.foregroundMuted : glyphColor(s, c, touch);
334
+ // An Older row is demoted at one level: its title muted, and its glyph and chips keep their hue at 60 % (still
335
+ // readable as an error or a review), never full red beside a grey title.
336
+ const older = s.group === "older";
337
+ const color = archived ? c.foregroundMuted : older ? withAlpha(glyphColor(s, c, touch), 0.6) : glyphColor(s, c, touch);
329
338
  const blocking = s.group === "needs" && s.tier === 0;
330
339
  const muted = s.group === "quiet" || s.group === "later" || s.group === "older";
331
340
  // Desktop rows are one line beside badges and the PR chip: the ask and the "<Field> · excerpt" line are cut around the
@@ -365,7 +374,7 @@ const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect, onMe
365
374
  {s.word && s.group === "needs" ? <Text style={{ color, fontWeight: "600" }}>{s.word}</Text> : null}{s.word && s.group === "needs" && s.line ? " · " : ""}{line}
366
375
  </Text>}
367
376
  {!!s.priority?.reason && <PriorityLine reason={s.priority.reason} source={s.priority.source} c={c} size={12} lines={2} />}
368
- {!!s.pr && <Text numberOfLines={1} style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 17, fontVariant: ["tabular-nums"] }}><PrSummaryText s={s} c={c} /></Text>}
377
+ {!!s.pr && <Text numberOfLines={1} style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 17, fontVariant: ["tabular-nums"], ...(older ? { opacity: 0.6 } : {}) }}><PrSummaryText s={s} c={c} /></Text>}
369
378
  {sendNow && <View style={{ flexDirection: "row", marginTop: 6 }}>{sendNow}</View>}
370
379
  </View> : dense ? <View style={{ flex: 1, minWidth: 0, gap: 1 }}>
371
380
  <Text numberOfLines={1} style={{ color: muted ? c.foregroundMuted : c.foreground, fontSize: 13, lineHeight: 18, fontWeight: muted ? "400" : "500" }}>{title}</Text>
@@ -387,7 +396,7 @@ const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect, onMe
387
396
  <Text numberOfLines={1} style={{ flex: 1, minWidth: 0, color: c.foregroundMuted, fontSize: 12, marginLeft: !via && s.word && s.group === "needs" ? -10 : 0 }}>
388
397
  {via ?? <>{s.word && s.group === "needs" && s.line ? "\u00a0· " : ""}{line}</>}
389
398
  </Text>
390
- <ChipRail s={s} c={c} />
399
+ <ChipRail s={s} c={c} dim={older} />
391
400
  {sendNow}
392
401
  </View>{!!s.priority?.reason && <View style={{ paddingRight: 40 }}><PriorityLine reason={s.priority.reason} source={s.priority.source} c={c} /></View>}</View>}
393
402
  {!touch && <RowTime s={s} c={c} size={dense ? 11 : 12} />}
@@ -408,6 +417,6 @@ function HoldLine({ theme, text: line, dense, touch }: { theme: Theme; text: str
408
417
  function SendNowButton({ s, theme, touch, onSendNow }: { s: Workstream; theme: Theme; touch: boolean; onSendNow: (s: Workstream) => Promise<void> }) {
409
418
  const [busy, setBusy] = useState(false);
410
419
  const n = s.sendNow!.count;
411
- return <Button theme={theme} compact={touch} kind="secondary" title="Send now" accessibilityLabel={`Send ${n} task${n === 1 ? "" : "s"} to ${s.title} now`} loading={busy} disabled={busy}
420
+ return <Button theme={theme} compact={touch} kind="secondary" title="Send now" accessibilityLabel={`Send ${s.sendNow!.what} to ${s.title} now`} loading={busy} disabled={busy}
412
421
  onPress={() => { setBusy(true); void onSendNow(s).finally(() => setBusy(false)); }} />;
413
422
  }
@@ -1,5 +1,6 @@
1
+ import type { DispatchRecord } from "../shared/dispatch";
1
2
  import type { PluginClientContext } from "@getpaseo/plugin/client";
2
- import { contextAskRpc, contextListRpc, displayFeed, homeFeed, overseerAskRpc, overseerRestartRpc, overseerStartRpc, overseerStatusRpc, prioritiesRpc, prStatsSettingsRpc, rankNowRpc, rankStatusRpc, usageRpc } from "../shared/contracts";
3
+ import { contextAskRpc, contextListRpc, dispatchRecordsRpc, displayFeed, homeFeed, queueNeedsSchema, overseerAskRpc, overseerRestartRpc, overseerStartRpc, overseerStatusRpc, prioritiesRpc, prStatsSettingsRpc, rankNowRpc, rankStatusRpc, usageRpc } from "../shared/contracts";
3
4
  import { openFeed } from "./feeds";
4
5
  import type { RpcInput, RpcOutput } from "@getpaseo/plugin";
5
6
  import type { Priority } from "../shared/priorities";
@@ -7,6 +8,10 @@ import { DEFAULT_SORT, isSortMode, type SortMode } from "../shared/sort";
7
8
  import { homeSortSync } from "../shared/display";
8
9
  import type { AgentLite } from "../shared/search";
9
10
  import { NO_USAGE, USAGE_POLL_MS, type Usage } from "../shared/usage";
11
+ import type { z } from "zod";
12
+
13
+ export type QueueNeeds = z.infer<typeof queueNeedsSchema>;
14
+ const NO_QUEUE: QueueNeeds = { raised: [], timeZone: "UTC", revision: "" };
10
15
  import { onVisible, whileVisible } from "./visibility";
11
16
  import type { ContextRequest } from "../shared/catch-up";
12
17
 
@@ -44,8 +49,16 @@ export function createHomeExtras(client: PluginClientContext) {
44
49
  let rank: RpcOutput<typeof rankStatusRpc> | null = null;
45
50
  /** Catch up's More context asks: pushed on the home feed; read when Catch up opens or moves, never on a timer of their own. */
46
51
  let context: ContextRequest[] = [];
52
+ /** New's recent dispatches, pushed on the home feed (Home's row); nothing reads them on a timer. */
53
+ let dispatches: DispatchRecord[] = [];
47
54
  /** Whether any repository has PR statistics: Home's PR stats icon. Pushed on the home feed; on 0.15, read once at start. */
48
55
  let prStatsOn = false;
56
+ /**
57
+ * The raised Linear issues in Needs you (Q8) and the queue's revision: the worker's one answer, pushed on the home
58
+ * feed (on 0.15, carried by the priorities poll). Home's model, the sidebar badge and the brief pane all read it.
59
+ */
60
+ let queue: QueueNeeds = NO_QUEUE;
61
+ const setQueue = (next: QueueNeeds | undefined) => { if (!next || JSON.stringify(next) === JSON.stringify(queue)) return false; queue = next; return true; };
49
62
  const setContext = (next: ContextRequest[]) => { if (JSON.stringify(next) === JSON.stringify(context)) return false; context = next; return true; };
50
63
  const readContext = async () => setContext((await client.rpc(contextListRpc, {})).requests);
51
64
  const agents = new Map<string, AgentLite>();
@@ -90,9 +103,10 @@ export function createHomeExtras(client: PluginClientContext) {
90
103
  const pollSort = () => poll(PRIORITY_POLL_MS, readSort);
91
104
  const pollHome = () => together([
92
105
  poll(PRIORITY_POLL_MS, async () => {
93
- const next = (await client.rpc(prioritiesRpc, {})).items;
94
- if (JSON.stringify(next) === JSON.stringify(priorities)) return false;
95
- priorities = next; return true;
106
+ const answer = await client.rpc(prioritiesRpc, {});
107
+ const queued = setQueue(answer.queue);
108
+ if (JSON.stringify(answer.items) === JSON.stringify(priorities)) return queued;
109
+ priorities = answer.items; return true;
96
110
  }),
97
111
  // The ranker's last run and source health, with the priorities (the ranker runs at most hourly).
98
112
  poll(PRIORITY_POLL_MS, readRank),
@@ -120,7 +134,9 @@ export function createHomeExtras(client: PluginClientContext) {
120
134
  if (stopped) return;
121
135
  priorities = event.priorities; rank = event.rank; overseer = event.overseer;
122
136
  if (event.context) setContext(event.context);
137
+ if (event.dispatches) dispatches = event.dispatches;
123
138
  if (event.prStats !== undefined) prStatsOn = event.prStats;
139
+ setQueue(event.queue);
124
140
  if (event.usage) usage = { ...event.usage, resources: usage.resources };
125
141
  if (!event.rank.running) { for (const done of rankWaiters) done(); rankWaiters.clear(); }
126
142
  // Smart Session's files can't be watched: read the meters once a minute instead.
@@ -145,6 +161,13 @@ export function createHomeExtras(client: PluginClientContext) {
145
161
  // 0.15 (no home feed): whether Home shows the PR stats icon, read once when the app starts (Settings' read; no poll).
146
162
  void client.rpc(prStatsSettingsRpc, {}).then(v => { const on = v.repos.some(r => r.state !== "off"); if (on !== prStatsOn) { prStatsOn = on; emit(); } }).catch(() => undefined);
147
163
  }
164
+ // Without the feed (Paseo 0.15, or while it's down) New's dispatches are read once now and when New closes
165
+ // (refreshDispatches), never on a timer: they only change when someone starts one.
166
+ const readDispatches = () => client.rpc(dispatchRecordsRpc, {}).then(r => {
167
+ if (stopped || JSON.stringify(r.records) === JSON.stringify(dispatches)) return;
168
+ dispatches = r.records; emit();
169
+ }).catch(() => undefined);
170
+ if (!home) void readDispatches();
148
171
 
149
172
  const putAgent = (a: AgentEntry["agent"]) => {
150
173
  if (!a?.id) return;
@@ -238,8 +261,16 @@ export function createHomeExtras(client: PluginClientContext) {
238
261
  async restartOverseer() { overseer = await client.rpc(overseerRestartRpc, {}); emit(); return overseer; },
239
262
  /** Catch up's More context asks and their answers. */
240
263
  context: () => context,
264
+ /** New's recent dispatches (client/new.tsx's Home row). */
265
+ dispatches: () => dispatches,
266
+ /** New closed: without the feed, read the dispatches it may have started (the feed pushes them itself). */
267
+ refreshDispatches: () => { if (!home || homePolls) void readDispatches(); },
241
268
  /** Whether Home shows the PR stats icon (some repository has PR statistics). */
242
269
  prStatsOn: () => prStatsOn,
270
+ /** The raised Linear issues in Needs you and the queue's revision (Q8), from the worker. */
271
+ queue: () => queue,
272
+ /** A dismissal on a 0.15 host (or with the feed down): read the answer once now; the feed pushes it itself. */
273
+ refreshQueue: () => { if (home && !homePolls) return; void client.rpc(prioritiesRpc, {}).then(a => { if (!stopped && setQueue(a.queue)) emit(); }).catch(() => undefined); },
243
274
  /** Reads the asks once (Catch up opening or moving on, so a 0.15 host or a dropped feed is never stale for long). */
244
275
  async refreshContext() { if (await readContext().catch(() => false)) emit(); },
245
276
  /** Asks the Overseer or the card's agent; the ask shows at once, its answer arrives on the feed. */
package/client/home.tsx CHANGED
@@ -17,6 +17,9 @@ import { BriefCard, type BriefDeps } from "./brief";
17
17
  import { SummaryLine } from "./about";
18
18
  import { ReferencesLine } from "./linked";
19
19
  import { bottomGap, bottomInset, Button, focusSoon, IconButton, space, text, type Theme } from "./kit";
20
+ import { DispatchRows, NewHost, openNew, useNewOpen } from "./new";
21
+ import { QueueScreen, RaisedRows, SinceBlock } from "./brief-since";
22
+ import type { NewKey } from "./search-key";
20
23
  import { DockedPane } from "./docked-pane";
21
24
  import type { DockState } from "./dock";
22
25
  import { NeedsYouBlock } from "./needs-you";
@@ -70,6 +73,8 @@ export type HomeDeps = {
70
73
  /** Docks the workspace's own panel in its explorer column. */
71
74
  openPanel(workspaceId: string): void;
72
75
  openLog(): void;
76
+ /** The Morning brief's Linear queue screen (`?view=queue`, client/brief-since.tsx). */
77
+ openQueue?(): void;
73
78
  /** Catch up: Needs you one card at a time (`?view=catchup`). */
74
79
  openCatchUp?(): void;
75
80
  /** The PR stats page (`?view=stats`, docs/pr-stats.md#the-page); a phone's person opens as its own screen. */
@@ -80,6 +85,8 @@ export type HomeDeps = {
80
85
  briefDeps: BriefDeps;
81
86
  /** The search-from-anywhere key (client/search-key.ts), for the search field's chip. */
82
87
  searchKey?: SearchKey;
88
+ /** New from anywhere's key, for Home's + New tooltip. */
89
+ newKey?: NewKey;
83
90
  };
84
91
 
85
92
  /**
@@ -104,11 +111,15 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
104
111
  const { inbox } = deps.sources;
105
112
  const c = theme.colors;
106
113
  const compact = layout.compact;
114
+ // Decision Q8: raised Linear issues are Needs-you items with no workspace row. The worker sends them on the home
115
+ // feed; the model counts them (model.raised) and they head the group. Catch up's deck and model.needs stay workspaces.
107
116
  const model = useHomeModel(deps.sources);
117
+ const queue = useSyncExternalStore(deps.sources.extras.subscribe, deps.sources.extras.queue, deps.sources.extras.queue);
118
+ const raisedKeys = useMemo(() => new Set(queue.raised.map(r => r.key)), [queue.raised]);
108
119
  const omnibox = useOmnibox(model, deps.sources);
109
120
  const searchKey = deps.searchKey;
110
121
  const anywhereKey = useSyncExternalStore(searchKey?.subscribe ?? noSubscribe, searchKey?.label ?? noLabel, searchKey?.label ?? noLabel);
111
- useSlashToFocus(omnibox, params.view !== "log" && params.view !== "catchup" && params.view !== "stats");
122
+ useSlashToFocus(omnibox, params.view !== "log" && params.view !== "catchup" && params.view !== "stats" && params.view !== "queue");
112
123
  const [filter, setFilter] = useState<HomeGroupId | null>(null);
113
124
  const [selected, setSelected] = useState<string | null>(() => params.item ?? (params.select ? `agent:${params.select}` : null));
114
125
  const openAgentRow = useMemo(() => navigation ? (row: InboxRow) => navigation.openAgent({ agentId: row.agentId }) : undefined, [navigation]);
@@ -176,6 +187,17 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
176
187
  }, [asking, deps.sources.extras, omnibox, inbox, toast, route, model]);
177
188
  // ⌘K "Follow-up: Ask the Overseer" opens Home with `?ask=<nonce>`: select it and focus its reply box. A param, not
178
189
  // shared state, so it works whether Home was already open or mounts fresh.
190
+ // New (client/new.tsx): every entry point opens Home with `?new=<nonce>` (and `source` when it carries one).
191
+ // It never navigates again: the request already brought Home here (new-opens-where-you-are).
192
+ useEffect(() => { if (params.new) openNew(params.source ? { source: params.source } : {}, { navigate: null }); }, [params.new]); // eslint-disable-line react-hooks/exhaustive-deps
193
+ const newLabel = useSyncExternalStore(deps.newKey?.subscribe ?? noSubscribe, deps.newKey?.label ?? noLabel, deps.newKey?.label ?? noLabel);
194
+ const dispatches = useSyncExternalStore(deps.sources.extras.subscribe, deps.sources.extras.dispatches, deps.sources.extras.dispatches);
195
+ // New closing may have started one: without the feed, Home reads them then (home-view refreshDispatches).
196
+ const newOpen = useNewOpen();
197
+ const wasOpen = useRef(newOpen);
198
+ useEffect(() => { if (wasOpen.current && !newOpen) deps.sources.extras.refreshDispatches(); wasOpen.current = newOpen; }, [newOpen]); // eslint-disable-line react-hooks/exhaustive-deps
199
+ const dispatchRows = <DispatchRows records={dispatches} theme={theme} compact={compact} navigation={navigation} />;
200
+ const newHost = <NewHost theme={theme} layout={layout} navigation={navigation} openSettings={() => deps.openSettings()} />;
179
201
  const [replyFocus, setReplyFocus] = useState(0);
180
202
  useEffect(() => {
181
203
  if (!params.ask) return;
@@ -223,13 +245,19 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
223
245
  deps={{ onHome: deps.openHome, openSettings: () => deps.openSettings("following"), openStats: p => deps.openStats?.(p) }} />
224
246
  {updateSheets}
225
247
  </View>;
248
+ if (params.view === "queue") return <View style={{ flex: 1 }}>
249
+ <QueueScreen theme={theme} compact={compact} onHome={deps.openHome} navigation={navigation} />
250
+ {newHost}
251
+ {updateSheets}
252
+ </View>;
226
253
  if (params.view === "log") return <LogView theme={theme} compact={compact} sources={deps.sources} onHome={deps.openHome} onOpen={key => { setSelected(key); deps.openHome(); }} />;
227
254
 
228
255
  const detail = selected === OVERSEER_KEY && overseer
229
256
  ? <OverseerPane theme={theme} compact={compact} o={overseer} focus={replyFocus} pending={pendingAsk} agentId={overseerStatus?.agentId ?? null} model={overseerStatus?.model ?? null} restartWith={overseerStatus?.restartWith ?? null} configured={overseerStatus?.configured ?? null} deps={deps} navigation={navigation} onBack={compact && !route ? () => setSelected(null) : undefined} />
230
257
  : current
231
258
  ? <DetailPane key={current.key} s={current} model={model} theme={theme} compact={compact} deps={deps} openFull={openFull} signOffNext={signOffNext} ask={ask?.key === current.key ? ask : null} onBack={compact && !route ? () => setSelected(null) : undefined} />
232
- : <BriefPane theme={theme} compact={compact} pane={pane} catchUp={deps.openCatchUp} deckSize={deckSize} onSelect={key => route ? route(key) : setSelected(key)} openLog={deps.openLog} sources={deps.sources} />;
259
+ : <BriefPane theme={theme} compact={compact} pane={pane} catchUp={deps.openCatchUp} deckSize={deckSize} onSelect={key => route ? route(key) : setSelected(key)} openLog={deps.openLog} sources={deps.sources}
260
+ queue={deps.openQueue ? <SinceBlock theme={theme} compact={compact} openQueue={deps.openQueue} onStarted={() => deps.sources.extras.refreshDispatches()} navigation={navigation} raised={raisedKeys} revision={queue.revision} /> : null} />;
233
261
  // Nothing followed at all: no sort, no meters, just the empty state and its action.
234
262
  const nothing = model.groups.every(g => !g.items.length);
235
263
  // Enter on a row: its chat, as Open full does. The brief has nothing to open; the Overseer opens once it runs.
@@ -251,18 +279,21 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
251
279
  <View style={{ flexDirection: "row", paddingHorizontal: 6 }}><VersionMark theme={theme} touch openSettings={deps.openSettings} /></View></View>
252
280
  : undefined}
253
281
  // Phones: the setup offer goes after the Needs-you group when there is one, so the first ask stays high.
254
- afterNeeds={compact && model.needs > 0 ? <SetupOffer theme={theme} compact view={props.onboarding} /> : undefined}
282
+ raised={<RaisedRows theme={theme} compact={compact} data={queue} onDismissed={deps.sources.extras.refreshQueue} />}
283
+ afterNeeds={compact && model.needs > 0 && props.onboarding?.offer ? <SetupOffer theme={theme} compact view={props.onboarding} /> : undefined}
255
284
  emptyAction={compact ? <Button theme={theme} compact kind="secondary" icon="Settings" title="Project settings" onPress={deps.openSettings} /> : undefined}
256
- top={<ListTop theme={theme} dense={compact} title={compact ? undefined : <ListHeader theme={theme} compact={compact} onSettings={deps.openSettings} onKeys={() => setKeysOpen(v => !v)} onStats={openStats} />}>
285
+ top={<ListTop theme={theme} dense={compact} title={compact ? undefined : <ListHeader theme={theme} compact={compact} onSettings={deps.openSettings} onKeys={() => setKeysOpen(v => !v)} onStats={openStats} onNew={() => openNew()} newLabel={newLabel} />}>
257
286
  {/* zIndex: on web every View is its own stacking context, so the sort menu only paints and hit-tests above the
258
287
  strip and meters below if this row sits above them. */}
259
288
  <View style={{ zIndex: 2, flexDirection: "row", alignItems: "center", gap: compact ? 2 : 6, paddingLeft: compact ? 16 : 16, paddingRight: compact ? 6 : 16 }}>
260
289
  <SearchField theme={theme} omnibox={omnibox} dense={compact} onEnter={item => void pick(item)} anywhereKey={anywhereKey} />
290
+ {compact && <IconButton theme={theme} compact icon="Plus" label="New" onPress={() => openNew()} />}
261
291
  {!(compact && nothing) && <SortMenu theme={theme} mode={model.sort} onChange={deps.sources.extras.setSort} rankedAt={model.rankedAt} touch={compact} rank={rank} onRerank={deps.sources.extras.rankNow} />}
262
292
  {compact && openStats && <IconButton theme={theme} compact icon="ChartNoAxesColumn" label="PR stats" onPress={openStats} />}
263
293
  {compact && <IconButton theme={theme} compact icon="Settings" label="Follow-up settings" onPress={deps.openSettings} />}
264
294
  </View>
265
295
  <View style={{ paddingHorizontal: 16 }}><LayoutNotice theme={theme} query={omnibox.layoutHint} dense={compact} /></View>
296
+ {!omnibox.results && dispatchRows}
266
297
  {!compact && !omnibox.results && <StatusStrip theme={theme} model={model} filter={filter} onFilter={setFilter} touch={compact} dense={compact} />}
267
298
  {!compact && !omnibox.results && <UsageMeters theme={theme} sources={deps.sources} dense={compact} hold={!!model.hold} />}
268
299
  {!compact && !omnibox.results && <SetupOffer theme={theme} compact={compact} view={props.onboarding} />}
@@ -282,6 +313,7 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
282
313
  {current || selected === OVERSEER_KEY && overseer || selected === BRIEF_KEY ? detail : list}
283
314
  {updateSheets}
284
315
  <View style={{ position: "absolute", left: 12, right: 12, bottom: bottomGap(true) + (current || selected === OVERSEER_KEY ? 132 : 0) }}><UndoBar store={inbox} theme={theme} touch /></View>
316
+ {newHost}
285
317
  </View>;
286
318
  return <View ref={homeRef} style={{ flex: 1, flexDirection: "row", backgroundColor: c.surface0 }}>
287
319
  <HomeSplit theme={theme} detail={detail} main={<View style={{ flex: 1, minWidth: 0 }}>
@@ -294,6 +326,7 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
294
326
  { title: "In the search", keys: HOME_KEYS.filter(k => k.when === "search").map(k => k.key === "/" && anywhereKey ? { ...k, key: `/ or ${anywhereKey}` } : k) },
295
327
  { title: "Answering", keys: HOME_KEYS.filter(k => k.when === "pane") },
296
328
  ]} />}
329
+ {newHost}
297
330
  </View>;
298
331
  }
299
332
 
@@ -334,7 +367,7 @@ export function DisplaySplit({ theme, main, side, field, defaultFraction, range,
334
367
  const HOME_DETAIL_MIN_PX = 360;
335
368
  const HOME_LIST_MIN_PX = 480;
336
369
 
337
- function ListHeader({ theme, compact, onSettings, onKeys, onStats }: { theme: Theme; compact: boolean; onSettings: () => void; onKeys?: () => void; onStats?: () => void }) {
370
+ function ListHeader({ theme, compact, onSettings, onKeys, onStats, onNew, newLabel }: { theme: Theme; compact: boolean; onSettings: () => void; onKeys?: () => void; onStats?: () => void; onNew?: () => void; newLabel?: string | null }) {
338
371
  const c = theme.colors;
339
372
  return <View style={{ flexDirection: "row", alignItems: "center", gap: 8, paddingHorizontal: 16 }}>
340
373
  {/* Home first, the version second: a muted caption on the title's line, never a control beside the cog. */}
@@ -342,6 +375,8 @@ function ListHeader({ theme, compact, onSettings, onKeys, onStats }: { theme: Th
342
375
  <Text accessibilityRole="header" style={{ color: c.foreground, fontSize: compact ? 17 : 15, fontWeight: "600" }}>Home</Text>
343
376
  <VersionMark theme={theme} touch={compact} openSettings={onSettings} />
344
377
  </View>
378
+ {/* New first, then the other header controls. */}
379
+ {onNew && <Button theme={theme} compact={compact} kind="secondary" icon="Plus" title="New" keyHint={newLabel ?? undefined} accessibilityLabel={newLabel ? `New (${newLabel})` : "New"} onPress={onNew} />}
345
380
  {/* The keys sheet's way in for the mouse (S from the keyboard); desktop web, where the keys are. */}
346
381
  {onKeys && Platform.OS === "web" && <IconButton theme={theme} compact={compact} icon="Keyboard" label="Keys (S)" tooltip onPress={onKeys} />}
347
382
  {/* Shown once a repository has PR statistics (docs/pr-stats.md#where-it-opens-from). */}
@@ -430,7 +465,7 @@ function DetailSendNow({ s, theme, compact, deps }: { s: Workstream; theme: Them
430
465
  } catch (e) { toast.error(errorText(e)); } finally { setBusy(false); deps.sources.live.refresh(); }
431
466
  };
432
467
  return <View style={{ flexDirection: "row" }}>
433
- <Button theme={theme} compact={compact} kind="secondary" title="Send now" accessibilityLabel={`Send ${n} task${n === 1 ? "" : "s"} to ${s.title} now`} loading={busy} disabled={busy} onPress={() => void press()} />
468
+ <Button theme={theme} compact={compact} kind="secondary" title="Send now" accessibilityLabel={`Send ${s.sendNow!.what} to ${s.title} now`} loading={busy} disabled={busy} onPress={() => void press()} />
434
469
  </View>;
435
470
  }
436
471
 
@@ -821,7 +856,7 @@ function ReplyBox({ theme, compact, agentName, onSend, placeholder = "Answer in
821
856
 
822
857
  // ---------- brief pane ----------
823
858
 
824
- function BriefPane({ theme, compact, pane, onSelect, openLog, sources, catchUp, deckSize = 0 }: { theme: Theme; compact: boolean; pane: ReturnType<typeof briefPane>; onSelect: (key: string) => void; openLog: () => void; sources: HomeSources; catchUp?: () => void; deckSize?: number }) {
859
+ function BriefPane({ theme, compact, pane, onSelect, openLog, sources, catchUp, deckSize = 0, queue = null }: { theme: Theme; compact: boolean; pane: ReturnType<typeof briefPane>; onSelect: (key: string) => void; openLog: () => void; sources: HomeSources; catchUp?: () => void; deckSize?: number; queue?: ReactNode }) {
825
860
  const c = theme.colors; const t = text(c, compact);
826
861
  useTick(30_000);
827
862
  const now = Date.now();
@@ -839,6 +874,8 @@ function BriefPane({ theme, compact, pane, onSelect, openLog, sources, catchUp,
839
874
  <Text accessibilityRole="header" style={t.headline}>{pane.headline}</Text>
840
875
  {compact && <Text style={t.meta}>Morning brief · {date} · {time}</Text>}
841
876
  {catchUp && deckSize > 0 ? <CatchUpButton theme={theme} compact={compact} count={deckSize} onPress={catchUp} /> : pane.first && <Button theme={theme} compact={compact} grow={compact} kind="primary" icon="ArrowRight" title={`Open ${pane.first.title.length > 40 ? `${pane.first.title.slice(0, 40)}…` : pane.first.title}`} onPress={() => onSelect(pane.first!.key)} />}
877
+ {/* The Morning brief's Linear queue: what moved since the developer last read it (client/brief-since.tsx). */}
878
+ {queue}
842
879
  {!!pane.waiting && <Text style={t.body}><Text style={{ color: c.foregroundMuted }}>Waiting on others: </Text>{pane.waiting}</Text>}
843
880
  <Text style={t.body}><Text style={{ color: c.foregroundMuted }}>Cleared since {sinceLabel(now)}: </Text>{pane.cleared ?? "nothing yet"}.</Text>
844
881
 
@@ -894,7 +931,7 @@ function LogView({ theme, compact, sources, onHome, onOpen }: { theme: Theme; co
894
931
  <Button theme={theme} compact={compact} kind="ghost" icon="House" title="Home" onPress={onHome} />
895
932
  </View>
896
933
  <Text accessibilityRole="header" style={[t.title, { fontSize: 20, lineHeight: 26 }]}>Done while you were away</Text>
897
- <Text style={t.meta}>What Follow-up did on its own {days ? `in the last ${days} days` : `since ${sinceLabel(Date.now())}`}: tasks it sent and how they went. It never merges, messages people, starts or archives workspaces.</Text>
934
+ <Text style={t.meta}>What Follow-up did on its own {days ? `in the last ${days} days` : `since ${sinceLabel(Date.now())}`}: messages it sent and how they went. It never merges, messages people, starts or archives workspaces.</Text>
898
935
  <Pressable accessibilityRole="button" onPress={onHome} style={{ flexDirection: "row", alignItems: "center", gap: 8, padding: 10, borderRadius: 8, backgroundColor: c.surface1 }}>
899
936
  <Icon name="Inbox" size={14} color={needs ? c.statusWarning : c.foregroundMuted} />
900
937
  <Text style={[t.body, { flex: 1 }]}>{needs ? `${needs} thing${needs === 1 ? "" : "s"} it left for you are on Home.` : "Nothing is waiting for you on Home."}</Text>
@@ -0,0 +1,114 @@
1
+ import { useEffect, useRef, useState, useSyncExternalStore, type ReactElement } from "react";
2
+ import { Platform, View } from "react-native";
3
+ import { surfaceVisible } from "../shared/list-keys";
4
+
5
+ /**
6
+ * One request shown by one of several mounted hosts (new-opens-where-you-are): New, Report an issue and Rename title
7
+ * with AI. A dialog asks to open; every Follow-up surface that can draw it mounts a host; the host on screen shows it.
8
+ * Paseo keeps a screen mounted behind another (Home opened again, a chat in front) as display:none, so "the first
9
+ * mounted host" can be one the developer can't see: 2026-11-23 on Paseo 0.17.1, New landed on Home and nothing opened,
10
+ * because the dialog was drawn in a Home hidden behind the one on screen.
11
+ */
12
+
13
+ /**
14
+ * Which host shows the request. The one showing it keeps it while it's on screen (a second host mounting never moves
15
+ * an open dialog and what was typed in it); otherwise the most recently mounted host that's on screen. A hidden host
16
+ * never does: null, and the request waits for one.
17
+ */
18
+ export function pickHost(list: readonly { id: number; visible: boolean }[], keep: number | null): number | null {
19
+ if (keep !== null && list.some(h => h.id === keep && h.visible)) return keep;
20
+ for (let i = list.length - 1; i >= 0; i--) if (list[i].visible) return list[i].id;
21
+ return null;
22
+ }
23
+
24
+ /**
25
+ * Whether a host's probe is on screen. Web: laid out and the page visible (`surfaceVisible`). Native has no DOM and
26
+ * keeps no hidden screen to draw in, so a mounted host is on screen. No probe yet on web: not on screen.
27
+ */
28
+ export function probeOnScreen(el: unknown): boolean {
29
+ if (!el) return Platform.OS !== "web";
30
+ const node = el as { checkVisibility?(): boolean; getClientRects?(): { length: number } };
31
+ if (typeof node.checkVisibility !== "function" && typeof node.getClientRects !== "function") return true;
32
+ return surfaceVisible(node, (globalThis as { document?: { visibilityState?: string } }).document ?? {});
33
+ }
34
+
35
+ /** How often an open request looks again for a host coming on screen or leaving it (only while open). */
36
+ export const HOST_LOOK_MS = 250;
37
+ /** How long a shown request may sit with no host on screen before it's dropped. */
38
+ export const LEFT_BEHIND_MS = 1000;
39
+
40
+ export type HostSlot<R extends object> = ReturnType<typeof createHostSlot<R>>;
41
+
42
+ export function createHostSlot<R extends object>() {
43
+ let current: (R & { token: number }) | null = null;
44
+ let token = 0;
45
+ const listeners = new Set<() => void>();
46
+ let version = 0;
47
+ const hosts: { id: number; visible: () => boolean }[] = [];
48
+ let hostIds = 0;
49
+ let owner: number | null = null;
50
+ /** When the open request was last on screen (null: never shown yet, so it waits for a host). */
51
+ let shownAt: number | null = null;
52
+ let fallback: ((r: R) => void) | null = null;
53
+ let watch: ReturnType<typeof setInterval> | null = null;
54
+
55
+ const pick = (keep: number | null) => pickHost(hosts.map(h => ({ id: h.id, visible: h.visible() })), keep);
56
+ const notify = () => { version++; for (const l of listeners) l(); };
57
+ const settle = () => {
58
+ owner = current ? pick(owner) : null;
59
+ if (current && owner !== null) shownAt = Date.now();
60
+ // Shown, then off screen for good (the developer left that Home): drop it, so it never comes back on its own on a
61
+ // later screen nor swallows the next New. A short grace covers a host hidden for a frame mid-navigation.
62
+ if (current && owner === null && shownAt !== null && Date.now() - shownAt >= LEFT_BEHIND_MS) { current = null; shownAt = null; }
63
+ if (!current) shownAt = null;
64
+ // A host can come on screen or leave it without mounting (Paseo brings a kept screen forward): while a request is
65
+ // open, look again a few times a second. Closed, nothing runs.
66
+ if (current && !watch) {
67
+ watch = setInterval(() => { const before = owner; settle(); if (owner !== before) notify(); }, HOST_LOOK_MS);
68
+ (watch as { unref?: () => void }).unref?.();
69
+ }
70
+ if (!current && watch) { clearInterval(watch); watch = null; }
71
+ };
72
+ const emit = () => { settle(); notify(); };
73
+ const subscribe = (l: () => void) => { listeners.add(l); return () => { listeners.delete(l); }; };
74
+ const snapshot = () => version;
75
+
76
+ return {
77
+ /**
78
+ * Opens the request on the host on screen. With none on screen it is kept, and `navigate` (default: the fallback)
79
+ * is asked to bring a surface that mounts one; the first host on screen then shows it. `navigate: null` never
80
+ * navigates (a surface opened for this request, taking it on mount).
81
+ */
82
+ open(request: R, opts: { navigate?: ((r: R) => void) | null } = {}): void {
83
+ current = { ...request, token: ++token };
84
+ shownAt = null;
85
+ emit();
86
+ if (owner === null) (opts.navigate === undefined ? fallback : opts.navigate)?.(request);
87
+ },
88
+ close(): void { current = null; emit(); },
89
+ now: () => current,
90
+ /** Whether any host is on screen now. */
91
+ shown: () => pick(null) !== null,
92
+ /** Whether the open request is on screen now (a toggle closes only what the developer can see). */
93
+ showing: () => !!current && pick(owner) !== null,
94
+ setFallback(open: ((r: R) => void) | null): void { fallback = open; },
95
+ /** Whether a request is open (shown or waiting for a host). */
96
+ useOpen(): boolean { useSyncExternalStore(subscribe, snapshot, snapshot); return !!current; },
97
+ /**
98
+ * A host: registers while mounted and returns the request when it's this host's to show (else null), plus the
99
+ * probe to render (always, so the host can tell whether it's on screen).
100
+ */
101
+ useHost(): { request: (R & { token: number }) | null; probe: ReactElement } {
102
+ const [id] = useState(() => ++hostIds);
103
+ const ref = useRef<unknown>(null);
104
+ useEffect(() => {
105
+ hosts.push({ id, visible: () => probeOnScreen(ref.current) });
106
+ emit();
107
+ return () => { const i = hosts.findIndex(h => h.id === id); if (i >= 0) hosts.splice(i, 1); emit(); };
108
+ }, [id]);
109
+ useSyncExternalStore(subscribe, snapshot, snapshot);
110
+ const probe = <View ref={ref as never} pointerEvents="none" accessibilityElementsHidden importantForAccessibility="no-hide-descendants" style={{ position: "absolute", width: 0, height: 0 }} />;
111
+ return { request: current && owner === id ? current : null, probe };
112
+ },
113
+ };
114
+ }
@@ -6,7 +6,7 @@ import { Icon, SettingsSelect, useToast } from "@getpaseo/plugin/client/ui";
6
6
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
7
7
  import { agentSettingsRpc, setAgentSettingRpc } from "../shared/contracts";
8
8
  import { displayPreferences } from "../shared/display";
9
- import { ROLE_DEFAULTS, ROLE_INFO, isJobRole, modelName, providerName, type AgentRole, type AgentSettingsView, type CatalogProvider, type SavedRole } from "../shared/agent-settings";
9
+ import { ROLE_DEFAULTS, ROLE_INFO, SAME_LABEL, hasSame, isJobRole, modelName, providerName, type AgentRole, type AgentSettingsView, type CatalogProvider, type SavedRole } from "../shared/agent-settings";
10
10
  import { NO_PROMPT_MODE, jobRow, jobsHeader, preselect as toPreselect, recommendedEntry, type JobRowModel } from "../shared/job-rows";
11
11
  import { Button, Chip, Switch, errorText, text, type Theme } from "./kit";
12
12
  import { Spinner } from "./motion";
@@ -172,12 +172,12 @@ export function RolePickers({ r, catalog, busy, save }: { r: RoleView; catalog:
172
172
  const jobs = isJobRole(role);
173
173
  const usable = catalog.filter(p => p.available);
174
174
  const current = catalog.find(p => p.id === r.provider);
175
- const base: SavedRole = { provider: r.provider, model: r.model, thinking: r.thinking, ...(jobs ? {} : { mode: r.mode }), ...(role === "recovery" ? { same: r.same } : {}),
175
+ const base: SavedRole = { provider: r.provider, model: r.model, thinking: r.thinking, ...(jobs ? {} : { mode: r.mode }), ...(hasSame(role) ? { same: r.same } : {}),
176
176
  ...(jobs ? { dailyCap: r.dailyCap ?? undefined, maxPromptChars: r.maxPromptChars ?? undefined } : {}), ...(role === "ranker" ? { cadenceMinutes: r.cadenceMinutes ?? undefined } : {}) };
177
177
  const set = (patch: SavedRole) => save({ ...base, ...patch });
178
178
  const providerLabel = providerName(r.provider, current?.label);
179
179
  const providerOptions = [
180
- ...(role === "recovery" ? [{ value: SAME, label: "Same as main agent" }] : []),
180
+ ...(hasSame(role) ? [{ value: SAME, label: SAME_LABEL[role]! }] : []),
181
181
  ...usable.map(p => ({ value: p.id, label: p.label })),
182
182
  ...(!r.same && !usable.some(p => p.id === r.provider) ? [{ value: r.provider, label: `${providerLabel} · unavailable` }] : []),
183
183
  ];
package/client/kit.tsx CHANGED
@@ -173,22 +173,29 @@ export type CardTone = "plain" | "attention" | "success";
173
173
  * A raised container with an icon title. Attention cards trade the ring for a warning border. `search`: the section
174
174
  * is being searched (client/section-search.tsx), and its field takes the title's place in the header.
175
175
  */
176
- export function Card({ theme, icon, title, tone = "plain", count, right, children, compact = false, style, search }: {
176
+ export function Card({ theme, icon, title, tone = "plain", count, right, children, compact = false, style, search, fold }: {
177
177
  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 };
178
180
  }) {
179
181
  const c = theme.colors;
180
182
  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
+ {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} />}
186
+ {search ?? <>
187
+ <Text accessibilityRole="header" style={{ color: accent ?? c.foreground, fontSize: compact ? 14 : 13, lineHeight: compact ? 20 : 18, fontWeight: "600" }}>{title}</Text>
188
+ {count !== undefined && count !== "" && <Chip theme={theme} color={accent ?? c.foregroundMuted} label={String(count)} />}
189
+ <View style={{ flex: 1 }} />
190
+ {right}
191
+ {fold && <Icon name={fold.open ? "ChevronUp" : "ChevronDown"} size={14} color={c.foregroundMuted} />}
192
+ </>}
193
+ </>;
181
194
  return <View style={[{ marginHorizontal: compact ? 16 : 12, marginTop: 12, borderRadius: 8, overflow: "hidden", backgroundColor: c.surface0 },
182
195
  accent ? { borderWidth: 1, borderColor: withAlpha(accent, 0.7) } : raised(c), style]}>
183
- <View style={{ flexDirection: "row", alignItems: "center", gap: compact ? 8 : 7, paddingHorizontal: compact ? 14 : 12, paddingTop: 10, paddingBottom: 8, minHeight: compact ? 44 : undefined }}>
184
- {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} />}
185
- {search ?? <>
186
- <Text accessibilityRole="header" style={{ color: accent ?? c.foreground, fontSize: compact ? 14 : 13, lineHeight: compact ? 20 : 18, fontWeight: "600" }}>{title}</Text>
187
- {count !== undefined && count !== "" && <Chip theme={theme} color={accent ?? c.foregroundMuted} label={String(count)} />}
188
- <View style={{ flex: 1 }} />
189
- {right}
190
- </>}
191
- </View>
196
+ {fold ? <Pressable accessibilityRole="button" aria-expanded={fold.open} accessibilityState={{ expanded: fold.open }} accessibilityLabel={`${title}: ${fold.label}. ${fold.open ? "Hide" : "Show"} them`} onPress={fold.onToggle}
197
+ style={state => ({ ...head, backgroundColor: state.pressed ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>{inner}</Pressable>
198
+ : <View style={head}>{inner}</View>}
192
199
  {children}
193
200
  </View>;
194
201
  }
@@ -208,8 +215,8 @@ export function Switch({ theme, label, value, onChange, disabled = false, access
208
215
  return <Pressable accessibilityRole="switch" aria-checked={value === null ? "mixed" : on} accessibilityLabel={accessibilityLabel ?? label} accessibilityHint={hint}
209
216
  accessibilityState={{ checked: value === null ? "mixed" : on, disabled: inactive }} accessibilityValue={{ text: value === null ? "Unknown" : on ? "On" : "Off" }}
210
217
  disabled={inactive} onPress={() => onChange(!on)} hitSlop={compact ? 0 : 4}
211
- style={({ pressed }) => ({ minHeight: compact ? 44 : 28, flexDirection: "row", alignItems: "center", gap: 8, opacity: inactive ? 0.5 : pressed ? 0.8 : 1 })}>
212
- <Text numberOfLines={1} style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{label}</Text>
218
+ style={({ pressed }) => ({ minHeight: compact ? 44 : 28, minWidth: compact ? 44 : undefined, justifyContent: "center", flexDirection: "row", alignItems: "center", gap: 8, opacity: inactive ? 0.5 : pressed ? 0.8 : 1 })}>
219
+ {label ? <Text numberOfLines={1} style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{label}</Text> : null}
213
220
  <View style={{ width: 30, height: 18, borderRadius: 9, backgroundColor: on ? c.accent : c.surface2, borderWidth: 1, borderColor: on ? c.accent : c.border, justifyContent: "center" }}>
214
221
  <View style={{ width: 12, height: 12, borderRadius: 6, marginLeft: value === null ? 8 : on ? 14 : 2, backgroundColor: on ? c.accentForeground : value === null ? c.border : c.foregroundMuted }} />
215
222
  </View>
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useRef } from "react";
2
2
  import { Platform } from "react-native";
3
- import { enterTarget, listMove, ownsKey, surfaceVisible, walkTarget } from "../shared/list-keys";
3
+ import { enterTarget, listMove, overlayOver, ownsKey, surfaceVisible, walkTarget } from "../shared/list-keys";
4
4
  import { rowDomId } from "./kit";
5
5
 
6
6
  type Row = { focus(o?: { preventScroll?: boolean }): void; scrollIntoView?(o?: { block?: string }): void };
@@ -8,8 +8,16 @@ type Node = { contains(other: unknown): boolean; querySelector?(selector: string
8
8
  type Target = { tagName?: string; isContentEditable?: boolean; id?: string; closest?(selector: string): unknown } | null;
9
9
  type DomKey = { key: string; metaKey: boolean; ctrlKey: boolean; altKey: boolean; shiftKey: boolean; target: unknown; preventDefault(): void; stopPropagation(): void };
10
10
  type Doc = { body: unknown; activeElement: unknown; visibilityState?: string; querySelector(selector: string): Row | null;
11
+ querySelectorAll?(selector: string): Iterable<Node>;
11
12
  addEventListener(t: string, f: (e: DomKey) => void, capture?: boolean): void; removeEventListener(t: string, f: (e: DomKey) => void, capture?: boolean): void };
12
13
 
14
+ /**
15
+ * A row menu, its confirm step or a modal dialog over the list: while one is drawn over it, it keeps every key. A
16
+ * non-modal dialog (Home's keys sheet, which S opens and closes) leaves the page its keys; keys typed inside one stay
17
+ * its own (the focus check below).
18
+ */
19
+ const OVERLAYS = '[role="menu"],[role="alertdialog"],[aria-modal="true"]';
20
+
13
21
  export type ListKeysOptions = {
14
22
  enabled: boolean;
15
23
  /** The rows in the order the list draws them (brief, Overseer, then every row of an open group). */
@@ -53,11 +61,11 @@ export function useListKeys(options: ListKeysOptions): void {
53
61
  if (typing && !target?.closest?.("[data-list-keys]")) return;
54
62
  // A row menu or a dialog over the list keeps its own keys, and so does a control whose keys move it (Home's
55
63
  // divider: arrows, Home and End resize the pane, never walk the list).
56
- if (target?.closest?.('[role="menu"],[role="dialog"],[aria-modal="true"],[role="separator"],[role="slider"]')) return;
64
+ if (target?.closest?.('[role="menu"],[role="alertdialog"],[role="dialog"],[aria-modal="true"],[role="separator"],[role="slider"]')) return;
57
65
  const root = scope();
58
66
  const onBody = !target || target === doc.body;
59
67
  if (!ownsKey({ inside: !!target && !!root?.contains(target), onBody, claimBody: !!claimBody,
60
- visible: !!claimBody && surfaceVisible(root, doc) })) return;
68
+ visible: !!claimBody && surfaceVisible(root, doc), overlayOpen: overlayOver(doc.querySelectorAll?.(OVERLAYS) ?? [], root) })) return;
61
69
  const move = listMove(e, typing);
62
70
  if (!move) return;
63
71
  const focused = !typing && target?.id ? order.find(k => rowDomId(k) === target.id) ?? null : null;