paseo-follow-up 2.4.0-beta.3 → 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 (61) hide show
  1. package/client/brief-since.tsx +15 -5
  2. package/client/chat.tsx +1 -1
  3. package/client/header.tsx +1 -1
  4. package/client/home-data.ts +6 -2
  5. package/client/home-list.tsx +5 -2
  6. package/client/home.tsx +4 -3
  7. package/client/host-slot.tsx +114 -0
  8. package/client/list-keys.ts +11 -3
  9. package/client/messages.tsx +8 -9
  10. package/client/needs-you.tsx +2 -1
  11. package/client/new.tsx +64 -48
  12. package/client/onboarding.tsx +4 -4
  13. package/client/panel.tsx +18 -7
  14. package/client/questions.tsx +9 -5
  15. package/client/rename.tsx +9 -18
  16. package/client/report-issue.tsx +16 -27
  17. package/client/row-actions.ts +23 -8
  18. package/client/row-menu.tsx +19 -2
  19. package/client/settings.tsx +2 -2
  20. package/client/tasks.tsx +18 -10
  21. package/client/theme.ts +16 -0
  22. package/client/toast-store.ts +1 -1
  23. package/index.client.tsx +9 -14
  24. package/index.server.ts +38 -19
  25. package/package.json +1 -1
  26. package/server/agent-hook.mjs +10 -5
  27. package/server/ai-jobs.ts +13 -8
  28. package/server/daemon.ts +8 -4
  29. package/server/dispatch.ts +10 -2
  30. package/server/engine.ts +5 -3
  31. package/server/hook-source.ts +10 -5
  32. package/server/job-guard.ts +71 -0
  33. package/server/linear-queue.ts +12 -9
  34. package/server/mcp-source.ts +2 -2
  35. package/server/mcp.mjs +2 -2
  36. package/server/message-queue.ts +17 -4
  37. package/server/ranker.ts +7 -3
  38. package/server/session-prompt.ts +105 -0
  39. package/shared/activity.ts +8 -1
  40. package/shared/attention.ts +7 -6
  41. package/shared/brief-since.ts +36 -0
  42. package/shared/chat.ts +3 -3
  43. package/shared/dispatch.ts +5 -1
  44. package/shared/headline.ts +7 -6
  45. package/shared/home.ts +5 -2
  46. package/shared/issue-workspace.ts +65 -0
  47. package/shared/linear-issues.ts +10 -3
  48. package/shared/linear-queue.ts +14 -1
  49. package/shared/list-keys.ts +21 -3
  50. package/shared/model.ts +6 -2
  51. package/shared/new-view.ts +35 -12
  52. package/shared/questions.ts +4 -2
  53. package/shared/queue.ts +38 -3
  54. package/shared/row-menu.ts +76 -6
  55. package/shared/send-decision.ts +1 -1
  56. package/shared/send-words.ts +21 -0
  57. package/shared/sending.ts +8 -6
  58. package/shared/settings-nav.ts +1 -1
  59. package/shared/status.ts +4 -3
  60. package/shared/task-rows.ts +6 -4
  61. package/shared/task-view.ts +7 -1
@@ -1,10 +1,10 @@
1
1
  import { useCallback, useEffect, useRef, useState } from "react";
2
- import { View } from "react-native";
2
+ import { Platform, View } from "react-native";
3
3
  import { Pressable, Text } from "./text";
4
4
  import { useRpc } from "@getpaseo/plugin/client";
5
5
  import { Icon, ScrollView, useToast } from "@getpaseo/plugin/client/ui";
6
6
  import { dispatchActionsRpc, dispatchRpc, linearQueueRpc, sweepQueueRpc } from "../shared/contracts";
7
- import { changeChip, queueRowMeta, raisedRow, sinceBlock, type SinceChange, type SinceLine } from "../shared/brief-since";
7
+ import { changeChip, openedLine, queueRowMeta, raisedRow, sinceBlock, type SinceChange, type SinceLine } from "../shared/brief-since";
8
8
  import { actionIcon, stateIcon } from "../shared/new-view";
9
9
  import type { RaisedNeed } from "../shared/linear-queue";
10
10
  import type { QueueNeeds } from "./home-view";
@@ -25,7 +25,8 @@ import { withAlpha, type Colors } from "./theme";
25
25
  */
26
26
 
27
27
  type Workspace = { workspaceId: string; title: string } | null;
28
- type QueueIssueRow = { key: string; title: string; priority: number; state: string | null; stateType: string | null; due: string | null; url: string | null; workspace: Workspace; change: string | null };
28
+ type QueueIssueRow = { key: string; title: string; priority: number; state: string | null; stateType: string | null; due: string | null; url: string | null; workspace: Workspace; change: string | null;
29
+ createdAt?: string | null; creator?: string | null; openedByYou?: boolean | null };
29
30
  type QueueViewData = {
30
31
  status: { sweptAt: string | null; complete: boolean | null; running: boolean; total: number; stale: boolean; timeZone: string; sweepAt: string; last: { ok: boolean; error: string | null } | null };
31
32
  since: string | null;
@@ -150,20 +151,29 @@ const FILTERS: { id: Filter; label: string; count: (v: QueueViewData) => number
150
151
  { id: "changed", label: "Changed", count: v => v.counts.changed },
151
152
  ];
152
153
 
154
+ /** "opened by Dana · 12 days ago", with the exact time as the desktop tooltip (React Native Web drops `title`, so it goes on the node). */
155
+ function OpenedText({ text: words, tooltip }: { text: string; tooltip: string }) {
156
+ const ref = useRef<View | null>(null);
157
+ useEffect(() => { if (Platform.OS === "web") (ref.current as unknown as { setAttribute?: (k: string, v: string) => void } | null)?.setAttribute?.("title", tooltip); }, [tooltip]);
158
+ return <Text ref={ref as never}>{words}</Text>;
159
+ }
160
+
153
161
  function QueueRow({ i, change, c, compact, timeZone, navigation }: { i: QueueIssueRow; change: SinceChange | undefined; c: Colors; compact: boolean; timeZone: string; navigation: Nav }) {
154
162
  const t = text(c, compact);
155
163
  const now = Date.now();
156
164
  const chip = changeChip(change ?? null, now, timeZone);
157
165
  const meta = queueRowMeta(i, now, timeZone, change);
166
+ const opened = openedLine({ createdAt: i.createdAt ?? null, creator: i.creator ?? null }, i.openedByYou ?? null, now, timeZone);
158
167
  const ws = i.workspace;
159
168
  const open = ws ? () => navigation?.openWorkspace({ workspaceId: ws.workspaceId }) : () => openNew({ source: i.key });
160
- const label = `${i.key} ${i.title}. ${meta}${chip ? `. ${chip.text}` : ""}${ws ? `. In ${ws.title}` : ". No workspace"}`;
169
+ const label = `${i.key} ${i.title}. ${meta}${opened ? `. ${opened.label}` : ""}${chip ? `. ${chip.text}` : ""}${ws ? `. In ${ws.title}` : ". No workspace"}`;
161
170
  const body = <View style={{ flexDirection: "row", alignItems: "flex-start", gap: 10, flex: 1, minWidth: 0 }}>
162
171
  <View style={{ paddingTop: 2 }}><Icon name={stateIcon(i.stateType)} size={15} color={c.foregroundMuted} /></View>
163
172
  <View style={{ flex: 1, minWidth: 0, gap: 2 }}>
164
173
  <Text style={t.body}><Text style={{ color: c.foregroundMuted }}>{i.key}</Text> {i.title}</Text>
165
174
  <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", columnGap: 8, rowGap: 4 }}>
166
- {!!meta && <Text style={t.meta}>{meta}</Text>}
175
+ {/* One run of quiet ink, so a phone wraps it word by word and never cuts the state: "Todo · due Wed · opened by Dana · 12 days ago". */}
176
+ {(!!meta || !!opened) && <Text style={t.meta}>{meta}{opened && <OpenedText text={`${meta ? " · " : ""}${opened.text}`} tooltip={opened.label} />}</Text>}
167
177
  {/* The change since the brief: a tinted chip, so the Changed filter's subjects stand out from the plain meta. */}
168
178
  {chip && <View style={{ flexDirection: "row", alignItems: "center", gap: 4, paddingHorizontal: 6, paddingVertical: 1, borderRadius: 5, backgroundColor: withAlpha(chip.warn ? c.statusWarning : c.foregroundMuted, chip.warn ? 0.12 : 0.1) }}>
169
179
  {chip.icon && <Icon name={chip.icon} size={12} color={chip.warn ? c.statusWarning : c.foregroundMuted} />}
package/client/chat.tsx CHANGED
@@ -82,7 +82,7 @@ function BatchCardView({ item, theme }: PluginTimelineItemProps<BatchCard>) {
82
82
  <View style={{ borderRadius: 10, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1, overflow: "hidden" }}>
83
83
  <View style={{ flexDirection: "row", alignItems: "center", gap: 8, paddingHorizontal: 12, paddingTop: 10, paddingBottom: recovery ? 10 : 6 }}>
84
84
  <Icon name={recovery ? "History" : "Send"} size={14} color={c.foregroundMuted} />
85
- <Text style={{ flex: 1, color: c.foreground, fontSize: 13, lineHeight: 18, fontWeight: "600" }}>{recovery ? "Follow-up recovery brief" : `Follow-up sent ${card.tasks.length} task${card.tasks.length === 1 ? "" : "s"}`}</Text>
85
+ <Text style={{ flex: 1, color: c.foreground, fontSize: 13, lineHeight: 18, fontWeight: "600" }}>{recovery ? "Follow-up recovery brief" : "Follow-up sent a message"}</Text>
86
86
  <Pressable accessibilityRole="button" aria-expanded={expanded} accessibilityLabel={expanded ? "Hide the full message" : "Show the full message"} onPress={() => setExpanded(v => !v)} hitSlop={6}
87
87
  style={state => ({ paddingHorizontal: 6, paddingVertical: 2, borderRadius: 4, backgroundColor: state.pressed ? c.surface2 : "transparent" })}>
88
88
  <Text style={{ color: c.foregroundMuted, fontSize: 12 }}>{expanded ? "Hide" : "Full message"}</Text>
package/client/header.tsx CHANGED
@@ -94,7 +94,7 @@ export function WorkspaceHeader({ workspace: w, theme, compact, now, onSettings,
94
94
  <Text numberOfLines={1} style={[t.small, { flexShrink: 1 }, stale ? { color: c.statusWarning } : null]}>{checked ? `Checked ${ago(checked, now)}${stale ? " · may be out of date" : ""}` : "Checks GitHub every 15s"}</Text>
95
95
  <IconButton icon="RefreshCw" label="Refresh PR status" onPress={onRefresh} theme={theme} compact={compact} disabled={refreshing} spinning={refreshing} />
96
96
  <View style={{ flex: 1 }} />
97
- <Switch theme={theme} compact={compact} label="Auto-send" accessibilityLabel="Auto-send tasks" hint="Send tasks to the main agent on its own when the agent is idle. Off means each message waits for your click."
97
+ <Switch theme={theme} compact={compact} label="Auto-send" accessibilityLabel="Auto-send repairs" hint="Send repairs to the main agent on its own when the agent is idle. Off means each message waits for your click."
98
98
  value={w.enable_auto_sends} disabled={autoPending} onChange={onAuto} />
99
99
  </View>
100
100
  </>;
@@ -2,16 +2,20 @@ import { autoSendHold } from "../shared/sending";
2
2
  import { useEffect, useMemo, useState, useSyncExternalStore } from "react";
3
3
  import type { PluginClientContext } from "@getpaseo/plugin/client";
4
4
  import { buildHome, type HomeModel, type PaseoWorkspaceLite } from "../shared/home";
5
+ import type { ArchiveFacts } from "../shared/row-menu";
5
6
  import type { InboxStore } from "./inbox-store";
6
7
  import type { LiveStore } from "./live";
7
8
  import type { HomeExtras } from "./home-view";
8
9
 
9
10
  type Descriptor = { id: string; name?: string | null; title?: string | null; projectDisplayName?: string | null; projectCustomName?: string | null; activityAt?: string | null; archivingAt?: string | null;
10
- gitRuntime?: { currentBranch?: string | null } | null; githubRuntime?: { pullRequest?: { number?: number; title?: string } | null } | null };
11
+ workspaceKind?: ArchiveFacts["kind"]; status?: string | null; diffStat?: { additions: number; deletions: number } | null;
12
+ gitRuntime?: { currentBranch?: string | null; isPaseoOwnedWorktree?: boolean; isDirty?: boolean | null; aheadOfOrigin?: number | null } | null; githubRuntime?: { pullRequest?: { number?: number; title?: string } | null } | null };
11
13
  const lite = (w: Descriptor): PaseoWorkspaceLite => {
12
14
  const pr = w.githubRuntime?.pullRequest;
13
15
  return { id: w.id, name: w.title || w.name || "Workspace", project: w.projectCustomName || w.projectDisplayName || null, activityAt: w.activityAt ?? null,
14
- branch: w.gitRuntime?.currentBranch ?? null, pr: pr?.title ? { number: pr.number ?? null, title: pr.title } : null };
16
+ branch: w.gitRuntime?.currentBranch ?? null, pr: pr?.title ? { number: pr.number ?? null, title: pr.title } : null,
17
+ archive: { kind: w.workspaceKind ?? null, ownedWorktree: w.gitRuntime?.isPaseoOwnedWorktree ?? null, dirty: w.gitRuntime?.isDirty ?? null, diff: w.diffStat ?? null,
18
+ ahead: w.gitRuntime?.aheadOfOrigin ?? null, running: w.status === "running" } };
15
19
  };
16
20
 
17
21
  /**
@@ -92,6 +92,9 @@ export type HomeListProps = {
92
92
 
93
93
  const noMenu: OpenRowMenu = () => undefined;
94
94
 
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
+
95
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) {
96
99
  const c = theme.colors;
97
100
  const [openMenu, setOpenMenu] = useState<RowMenuOpen | null>(null);
@@ -124,7 +127,7 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
124
127
  switch (item.type) {
125
128
  // "Archived" heads its results like a group: small caps on desktop, sentence case at 13 on phones (GroupHeader).
126
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",
127
- 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>;
128
131
  case "empty": return <View accessibilityRole="summary" style={{ marginHorizontal: 16, marginTop: 20, gap: 6 }}>
129
132
  <Text accessibilityRole="header" style={{ color: c.foreground, fontSize: 17, lineHeight: 23, fontWeight: "600" }}>Nothing followed yet</Text>
130
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>
@@ -414,6 +417,6 @@ function HoldLine({ theme, text: line, dense, touch }: { theme: Theme; text: str
414
417
  function SendNowButton({ s, theme, touch, onSendNow }: { s: Workstream; theme: Theme; touch: boolean; onSendNow: (s: Workstream) => Promise<void> }) {
415
418
  const [busy, setBusy] = useState(false);
416
419
  const n = s.sendNow!.count;
417
- 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}
418
421
  onPress={() => { setBusy(true); void onSendNow(s).finally(() => setBusy(false)); }} />;
419
422
  }
package/client/home.tsx CHANGED
@@ -188,7 +188,8 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
188
188
  // ⌘K "Follow-up: Ask the Overseer" opens Home with `?ask=<nonce>`: select it and focus its reply box. A param, not
189
189
  // shared state, so it works whether Home was already open or mounts fresh.
190
190
  // New (client/new.tsx): every entry point opens Home with `?new=<nonce>` (and `source` when it carries one).
191
- useEffect(() => { if (params.new) openNew(params.source ? { source: params.source } : {}); }, [params.new]); // eslint-disable-line react-hooks/exhaustive-deps
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
192
193
  const newLabel = useSyncExternalStore(deps.newKey?.subscribe ?? noSubscribe, deps.newKey?.label ?? noLabel, deps.newKey?.label ?? noLabel);
193
194
  const dispatches = useSyncExternalStore(deps.sources.extras.subscribe, deps.sources.extras.dispatches, deps.sources.extras.dispatches);
194
195
  // New closing may have started one: without the feed, Home reads them then (home-view refreshDispatches).
@@ -464,7 +465,7 @@ function DetailSendNow({ s, theme, compact, deps }: { s: Workstream; theme: Them
464
465
  } catch (e) { toast.error(errorText(e)); } finally { setBusy(false); deps.sources.live.refresh(); }
465
466
  };
466
467
  return <View style={{ flexDirection: "row" }}>
467
- <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()} />
468
469
  </View>;
469
470
  }
470
471
 
@@ -930,7 +931,7 @@ function LogView({ theme, compact, sources, onHome, onOpen }: { theme: Theme; co
930
931
  <Button theme={theme} compact={compact} kind="ghost" icon="House" title="Home" onPress={onHome} />
931
932
  </View>
932
933
  <Text accessibilityRole="header" style={[t.title, { fontSize: 20, lineHeight: 26 }]}>Done while you were away</Text>
933
- <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>
934
935
  <Pressable accessibilityRole="button" onPress={onHome} style={{ flexDirection: "row", alignItems: "center", gap: 8, padding: 10, borderRadius: 8, backgroundColor: c.surface1 }}>
935
936
  <Icon name="Inbox" size={14} color={needs ? c.statusWarning : c.foregroundMuted} />
936
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
+ }
@@ -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;
@@ -21,7 +21,6 @@ import { RichText } from "./rich-text";
21
21
  const AUTO_OFF_HINT = "Off: it stays here for you";
22
22
  /** "14:32": a time on this device's clock. */
23
23
  const clock = (iso: string | null | undefined) => iso ? new Date(iso).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : "";
24
- const tasks = (n: number) => `${n} task${n === 1 ? "" : "s"}`;
25
24
 
26
25
  /** The status column reads one way for every task: dashed ring = queued, send glyph = sent (accent while the agent works on it). Never Running's spinner (Q51). */
27
26
  export function DeliveryGlyph({ state, w, colors }: { state: "queued" | "sent"; w: Workspace; colors: Colors }) {
@@ -31,8 +30,8 @@ export function DeliveryGlyph({ state, w, colors }: { state: "queued" | "sent";
31
30
 
32
31
  /** The strip's one line: who, how many, and when and why (Queued), or when it went out and what Follow-up waits for (Sent). */
33
32
  export function stripLine(s: MessageStrip): { lead: string; rest: string } {
34
- if (s.phase === "sent") return { lead: `Sent to ${s.to}`, rest: `${s.at ? ` at ${clock(s.at)}` : ""} · ${tasks(s.count)} · ${s.reason}` };
35
- return { lead: `Next message to ${s.to}`, rest: ` · ${tasks(s.count)} · ${s.reason === SETTLE_REASON && s.at ? `sends at ${clock(s.at)} · ` : ""}${s.reason}` };
33
+ if (s.phase === "sent") return { lead: `Sent to ${s.to}`, rest: `${s.at ? ` at ${clock(s.at)}` : ""} · ${s.what} · ${s.reason}` };
34
+ return { lead: `Next message to ${s.to}`, rest: ` · ${s.what} · ${s.reason === SETTLE_REASON && s.at ? `sends at ${clock(s.at)} · ` : ""}${s.reason}` };
36
35
  }
37
36
 
38
37
  /** Always the first row of Tasks while a message is queued or out. Preview and Send now are quiet; the normal case needs no click. */
@@ -56,7 +55,7 @@ function StripRow({ strip, w, theme, compact, onPreview, openAgent }: { strip: M
56
55
  <Text style={[t.meta, { flexGrow: 1, flexShrink: 1, flexBasis: compact ? "80%" : 240, minWidth: 0 }]}><Text style={{ color: c.foreground, fontWeight: "500" }}>{line.lead}</Text>{line.rest}</Text>
57
56
  <View style={{ flexDirection: "row", gap: 8, marginLeft: "auto" }}>
58
57
  {strip.phase === "queued" && <Button theme={theme} compact={compact} title="Preview" accessibilityLabel={`Preview the next message to ${strip.to}`} onPress={onPreview} />}
59
- {strip.phase === "queued" && strip.sendNow && <Button theme={theme} compact={compact} title="Send now" accessibilityLabel={`Send ${tasks(strip.count)} to ${strip.to} now`} loading={busy} disabled={busy} onPress={() => void sendNow()} />}
58
+ {strip.phase === "queued" && strip.sendNow && <Button theme={theme} compact={compact} title="Send now" accessibilityLabel={`Send ${strip.what} to ${strip.to} now`} loading={busy} disabled={busy} onPress={() => void sendNow()} />}
60
59
  {strip.phase === "sent" && openAgent && <Button theme={theme} compact={compact} title="Open agent" accessibilityLabel={`Open ${strip.to}`} onPress={() => openAgent(strip.recipientId)} />}
61
60
  </View>
62
61
  </View>;
@@ -90,11 +89,11 @@ function RepairGlyph({ row, w, colors }: { row: RepairRow; w: Workspace; colors:
90
89
  return <DeliveryGlyph state={row.state} w={w} colors={colors} />;
91
90
  }
92
91
 
93
- /** A task Follow-up found on a PR, in the same row as every other task: status glyph, title, PR chip and one state. */
92
+ /** A repair Follow-up found on a PR: status glyph, title, PR chip and one state. */
94
93
  function RepairTaskRow({ row, w, theme, compact, onOpen }: { row: RepairRow; w: Workspace; theme: Theme; compact: boolean; onOpen: () => void }) {
95
94
  const c = theme.colors; const t = text(c);
96
95
  const label = row.state === "done" && row.at ? `${row.text} ${clock(row.at)}` : row.text;
97
- return <Pressable accessibilityRole="button" accessibilityLabel={`Task: ${row.task.title}. ${label}. Open details`} onPress={onOpen}
96
+ return <Pressable accessibilityRole="button" accessibilityLabel={`Repair: ${row.task.title}. ${label}. Open details`} onPress={onOpen}
98
97
  style={state => ({ flexDirection: "row", gap: 10, paddingHorizontal: 12, paddingVertical: 9, minHeight: compact ? 52 : 44, borderTopWidth: 1, borderTopColor: c.border, backgroundColor: state.pressed ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
99
98
  <View style={{ width: 16, paddingTop: 2, alignItems: "center" }}><RepairGlyph row={row} w={w} colors={c} /></View>
100
99
  <View style={{ flex: 1, minWidth: 0, gap: 3 }}>
@@ -119,12 +118,12 @@ function RepairSheet({ row, w, strip, theme, compact, onClose }: { row: RepairRo
119
118
  const setAuto = async (auto: boolean) => {
120
119
  if (!row) return;
121
120
  setSaving(true);
122
- try { await control({ workspaceId: w.id, taskAuto: { key: row.task.key, auto } }); toast.show(auto ? "Follow-up sends this task" : "This task stays with you"); }
123
- catch (error) { toast.error(error instanceof Error ? error.message : "Couldn't change Auto-send for this task."); }
121
+ try { await control({ workspaceId: w.id, taskAuto: { key: row.task.key, auto } }); toast.show(auto ? "Follow-up sends this repair" : "This repair stays with you"); }
122
+ catch (error) { toast.error(error instanceof Error ? error.message : "Couldn't change Auto-send for this repair."); }
124
123
  finally { setSaving(false); void cache.invalidateQueries(); }
125
124
  };
126
125
  const where = row?.state === "queued" && strip?.phase === "queued" ? ` · in the next message to ${strip.to}${strip.reason === SETTLE_REASON && strip.at ? `, at ${clock(strip.at)}` : ""}` : row?.state === "sent" && strip?.phase === "sent" ? ` · ${stripLine(strip).lead.toLowerCase()}${strip.at ? ` at ${clock(strip.at)}` : ""}` : "";
127
- return <Modal title="Task" icon={<Icon name="ListTodo" size={18} color={c.foreground} />} open={!!row} onOpenChange={next => { if (!next) onClose(); }}>
126
+ return <Modal title="Repair" icon={<Icon name="Wrench" size={18} color={c.foreground} />} open={!!row} onOpenChange={next => { if (!next) onClose(); }}>
128
127
  <Modal.Content contentContainerStyle={{ padding: compact ? 16 : 20, gap: 14 }}>
129
128
  {row && <>
130
129
  <View style={{ gap: 6 }}>
@@ -1,3 +1,4 @@
1
+ import { sendButton } from "../shared/send-words";
1
2
  import { FINISH_ASK } from "../shared/status";
2
3
  import { View, type StyleProp, type ViewStyle } from "react-native";
3
4
  import { Pressable, Text } from "./text";
@@ -137,7 +138,7 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
137
138
  <Button theme={theme} compact={compact} kind="primary" icon="RotateCcw" title="Retry" accessibilityLabel={`Send your ${item.questionId} answer again`} loading={resendAnswer.isPending} disabled={busy} onPress={() => resendAnswer.mutate(item.questionId)} />
138
139
  {actions.openAgent && <Button theme={theme} compact={compact} kind="ghost" icon="MessageSquare" title="Open agent" accessibilityLabel={`Open the agent's chat to check for your ${item.questionId} answer`} onPress={() => { const q = w.questions.find(x => x.id === item.questionId); actions.openAgent!(q?.askedBy ?? w.mainAgentId); }} />}
139
140
  </>;
140
- case "send": return <Button theme={theme} compact={compact} kind="primary" icon="Send" title={item.finish ? "Ask to finish" : `Send ${item.tasks.length} task${item.tasks.length === 1 ? "" : "s"}`} accessibilityLabel={item.finish ? `Ask to finish: ${FINISH_ASK}` : `Send ${item.tasks.length} task${item.tasks.length === 1 ? "" : "s"} to ${agentName(w)}`} accessibilityHint={item.blocker ?? undefined} loading={deliver.isPending} disabled={busy || !!item.blocker} onPress={() => deliver.mutate(item.batchId)} />;
141
+ case "send": return <Button theme={theme} compact={compact} kind="primary" icon="Send" title={item.finish ? "Ask to finish" : sendButton(item.what)} accessibilityLabel={item.finish ? `Ask to finish: ${FINISH_ASK}` : `Send ${item.what} to ${agentName(w)}`} accessibilityHint={item.blocker ?? undefined} loading={deliver.isPending} disabled={busy || !!item.blocker} onPress={() => deliver.mutate(item.batchId)} />;
141
142
  // One click merges what the button names (a-click-on-merge-merges); the sheet's confirm only when the scope can't be known.
142
143
  case "merge": return mergeControl(item.prKey, { theme, compact, fallback: actions.openPr ? () => actions.openPr!(item.prKey, "merge") : undefined }).button;
143
144
  case "reviewers": return actions.openPr && <Button theme={theme} compact={compact} icon="UserPlus" title="Add reviewers" onPress={() => actions.openPr!(item.prKey, "reviewers")} />;