paseo-follow-up 1.4.0-beta.32 → 1.4.0-beta.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -238,7 +238,7 @@ This replaces the separate **Wait** plugin (`paseo-wait`). While that plugin is
238
238
  Install the beta:
239
239
 
240
240
  ```sh
241
- paseo plugin update follow-through --version 1.4.0-beta.32
241
+ paseo plugin update follow-through --version 1.4.0-beta.34
242
242
  # or, for a fresh install:
243
243
  paseo plugin install npm:paseo-follow-up@beta
244
244
  ```
@@ -293,7 +293,7 @@ npm run test:install
293
293
  paseo plugin reload follow-through # after changes
294
294
  ```
295
295
 
296
- Integration checks use a separate Paseo home with synthetic agents.
296
+ Integration checks use a separate Paseo home with synthetic agents. Working on Follow-up with an agent? Start at [AGENTS.md](AGENTS.md): the architecture map, a file index per subsystem, the invariants, and the docs in [docs/](docs/).
297
297
 
298
298
  Release notes: a PR that changes something users see adds `changes/<branch>.md` with one to three plain-language bullets ([rules](changes/README.md)). Before a stable version bump, `npm run release:notes <version>` moves them into CHANGELOG.md (`-- --allow-empty` for a release with nothing user-facing). For a beta it writes nothing and the fragments wait for the next stable release. `npm run verify` fails if a stable package version has no notes.
299
299
 
@@ -0,0 +1,44 @@
1
+ import type { ToastApi } from "@getpaseo/plugin/client/ui";
2
+ import { errorText } from "../shared/errors";
3
+
4
+ /**
5
+ * Quick actions: the control that started one closes at once, and the outcome shows as a toast.
6
+ *
7
+ * STAND-IN. The real `runAction` and its global toast come with feat/quick-actions (a1b411b0's PR2). This file has the
8
+ * same signature, `runAction({ label, run, success, failure, reopen? })`, so whichever PR lands second deletes this
9
+ * stand-in and keeps its callers unchanged.
10
+ */
11
+ export type ActionSpec<T> = {
12
+ /** What runs, for the error toast's fallback and for logs ("Later", "Send repairs"). */
13
+ label: string;
14
+ run: () => Promise<T>;
15
+ /** The success toast, or null for none (Sign off, whose Undo bar already says it). */
16
+ success: string | null | ((result: T) => string | null);
17
+ /** The failure toast; defaults to "<label> didn't work: <reason>". */
18
+ failure?: string | ((error: unknown) => string);
19
+ /** Called after a failure so the person can try again where they were (reopen the menu or card). */
20
+ reopen?: () => void;
21
+ };
22
+
23
+ let toast: ToastApi | null = null;
24
+ const inflight = new Set<string>();
25
+
26
+ /** The host's toast, bound once by a mounted surface (Home binds it with useToast). */
27
+ export function bindToast(api: ToastApi | null): void { toast = api; }
28
+
29
+ /** Runs a quick action and reports it. Resolves true on success. A second identical action while one runs is dropped. */
30
+ export async function runAction<T>(spec: ActionSpec<T>, key: string = spec.label): Promise<boolean> {
31
+ if (inflight.has(key)) return false;
32
+ inflight.add(key);
33
+ try {
34
+ const result = await spec.run();
35
+ const line = typeof spec.success === "function" ? spec.success(result) : spec.success;
36
+ if (line) toast?.show(line, { variant: "success" });
37
+ return true;
38
+ } catch (error) {
39
+ const line = typeof spec.failure === "function" ? spec.failure(error) : spec.failure ?? `${spec.label} didn't work: ${errorText(error)}`;
40
+ toast?.error(line);
41
+ spec.reopen?.();
42
+ return false;
43
+ } finally { inflight.delete(key); }
44
+ }
@@ -10,11 +10,12 @@ import { meters, meterText, type Meter } from "../shared/usage";
10
10
  import { resourceMeter, type Resources } from "../shared/resources";
11
11
  import type { HomeSources } from "./home-data";
12
12
  import type { Workstream } from "../shared/home";
13
- import { Age, glyphColor, PrChipView, PrSummaryText } from "./home-list";
13
+ import { Age, glyphColor, PrChipView, PrSummaryText, quickActionsHint } from "./home-list";
14
14
  import { useMinute } from "./home-data";
15
15
  import { Spinner } from "./motion";
16
16
  import { withAlpha, type Colors } from "./theme";
17
17
  import type { Theme } from "./kit";
18
+ import { useRowMenuTrigger, type OpenRowMenu } from "./row-menu";
18
19
 
19
20
  /**
20
21
  * Home's chrome above the list (1.3.0-beta.2): the omnibox, the sort menu, the status strip and the provider
@@ -285,8 +286,9 @@ export function GroupChip({ group, c }: { group: HomeGroupId | "archived"; c: Co
285
286
  </View>;
286
287
  }
287
288
 
288
- export function ResultRow({ item, theme, active, dense, touch, onPress, s: row }: { item: WorkspaceItem; theme: Theme; active: boolean; dense: boolean; touch: boolean; onPress: () => void; s?: Workstream }) {
289
+ export function ResultRow({ item, theme, active, dense, touch, onPress, s: row, onMenu }: { item: WorkspaceItem; theme: Theme; active: boolean; dense: boolean; touch: boolean; onPress: () => void; s?: Workstream; onMenu?: OpenRowMenu }) {
289
290
  const c = theme.colors;
291
+ const trigger = useRowMenuTrigger(row, onMenu, touch);
290
292
  const { hit } = item;
291
293
  const via = hit.via ? excerpt(hit.via.text, hit.via.ranges, dense ? 56 : 90) : null;
292
294
  const archived = hit.group === "archived";
@@ -294,7 +296,7 @@ export function ResultRow({ item, theme, active, dense, touch, onPress, s: row }
294
296
  // with the match highlighted. No group pill: the state word already says it.
295
297
  if (touch) {
296
298
  const tone = row ? glyphColor(row, c, true) : c.foregroundMuted;
297
- return <Pressable accessibilityRole="button" accessibilityState={{ selected: active }} accessibilityLabel={`${hit.title}${row?.word ? `. ${row.word}` : ""}${hit.via ? `, ${FIELD_LABEL[hit.via.field]}: ${hit.via.text}` : ""}`} onPress={onPress}
299
+ return <Pressable ref={trigger.ref} onLongPress={trigger.onLongPress} delayLongPress={450} accessibilityHint={onMenu && row ? quickActionsHint(touch) : undefined} accessibilityRole="button" accessibilityState={{ selected: active }} accessibilityLabel={`${hit.title}${row?.word ? `. ${row.word}` : ""}${hit.via ? `, ${FIELD_LABEL[hit.via.field]}: ${hit.via.text}` : ""}`} onPress={onPress}
298
300
  style={state => ({ flexDirection: "row", alignItems: "flex-start", gap: 10, minHeight: 56, paddingLeft: 14, paddingRight: 16, paddingVertical: 12, borderBottomWidth: 1, borderBottomColor: withAlpha(c.border, 0.6),
299
301
  backgroundColor: active || state.pressed ? c.surface2 : "transparent" })}>
300
302
  <View style={{ paddingTop: 2 }}><Icon name={archived ? "Archive" : row?.icon ?? "Circle"} size={17} color={archived ? c.foregroundMuted : tone} /></View>
@@ -312,7 +314,7 @@ export function ResultRow({ item, theme, active, dense, touch, onPress, s: row }
312
314
  </View>
313
315
  </Pressable>;
314
316
  }
315
- return <Pressable accessibilityRole="button" accessibilityState={{ selected: active }} accessibilityLabel={`${hit.title}${hit.via ? `, ${FIELD_LABEL[hit.via.field]}: ${hit.via.text}` : ""}`} onPress={onPress}
317
+ return <Pressable ref={trigger.ref} onLongPress={trigger.onLongPress} delayLongPress={450} accessibilityHint={onMenu && row ? quickActionsHint(touch) : undefined} accessibilityRole="button" accessibilityState={{ selected: active }} accessibilityLabel={`${hit.title}${hit.via ? `, ${FIELD_LABEL[hit.via.field]}: ${hit.via.text}` : ""}`} onPress={onPress}
316
318
  style={state => ({ flexDirection: "row", alignItems: "center", gap: 10, minHeight: touch ? 56 : dense ? 40 : 44, paddingHorizontal: dense ? 8 : 16, paddingVertical: 4,
317
319
  borderLeftWidth: 2, borderLeftColor: active ? withAlpha(c.foreground, 0.5) : "transparent",
318
320
  backgroundColor: active ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
@@ -9,6 +9,8 @@ import { headlineColor, mergedColor, readable, runningColor, tint, toneColor, wi
9
9
  import { useMinute } from "./home-data";
10
10
  import { Spinner } from "./motion";
11
11
  import type { Theme } from "./kit";
12
+ import { RowMenu, useRowMenuTrigger, type OpenRowMenu, type RowMenuOpen } from "./row-menu";
13
+ import type { RowMenuItem, RowMenuSection } from "../shared/row-menu";
12
14
 
13
15
  /**
14
16
  * The one list: Home's left side and (on hosts that have it) the sidebar
@@ -65,10 +67,19 @@ export type HomeListProps = {
65
67
  overseer?: OverseerRowState | null;
66
68
  /** An omnibox ask is on its way to the Overseer. */
67
69
  asking?: boolean;
70
+ /** The row menu (right-click, long-press, the menu key): what a row offers, and what a pick does. Absent: no menu. */
71
+ menu?: { build: (s: Workstream) => RowMenuSection[]; pick: (s: Workstream, item: RowMenuItem) => void };
68
72
  };
69
73
 
70
- export function HomeList({ model, theme, dense = false, touch, selectedKey, onSelect, briefLine, renderExpanded, header, footer, top, afterNeeds, emptyAction, results, activeResult = 0, onResult, filter = null, overseer = null, asking = false }: HomeListProps) {
74
+ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSelect, briefLine, renderExpanded, header, footer, top, afterNeeds, emptyAction, results, activeResult = 0, onResult, filter = null, overseer = null, asking = false, menu }: HomeListProps) {
71
75
  const c = theme.colors;
76
+ const [openMenu, setOpenMenu] = useState<RowMenuOpen | null>(null);
77
+ const build = menu?.build;
78
+ const onMenu = useMemo<OpenRowMenu | undefined>(() => build ? (s, anchor, node, keyboard) => {
79
+ const sections = build(s);
80
+ if (sections.length) setOpenMenu({ s, anchor, sections, returnTo: node, keyboard });
81
+ } : undefined, [build]);
82
+ const menuKey = openMenu?.s.key ?? null;
72
83
  const [closed, setClosed] = useState<Set<string>>(new Set(["quiet"]));
73
84
  const [openProjects, setOpenProjects] = useState<Set<string>>(new Set());
74
85
  const [pages, setPages] = useState<Record<string, number>>({});
@@ -128,7 +139,7 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
128
139
  {emptyAction ? <View style={{ flexDirection: "row", marginTop: 6 }}>{emptyAction}</View> : null}
129
140
  </View>;
130
141
  case "slot": return <View style={{ paddingVertical: 10 }}>{afterNeeds}</View>;
131
- case "result": return <ResultRow item={item.item} s={model.byKey.get(item.item.key)} theme={theme} active={item.index === activeResult} dense={dense} touch={touch} onPress={() => onResult?.(item.item)} />;
142
+ case "result": return <ResultRow item={item.item} s={model.byKey.get(item.item.key)} theme={theme} active={item.index === activeResult || menuKey === item.item.key} dense={dense} touch={touch} onPress={() => onResult?.(item.item)} onMenu={onMenu} />;
132
143
  case "ask": return <AskRow ask={item.ask} theme={theme} active={item.index === activeResult} dense={dense} touch={touch} sending={!!asking} onPress={() => onResult?.({ provider: "overseer", key: ASK_KEY, ask: item.ask })} />;
133
144
  case "brief": return <BriefRow theme={theme} line={briefLine ?? ""} selected={!touch && (selectedKey === null || selectedKey === BRIEF_KEY)} touch={touch} onSelect={onSelect} />;
134
145
  case "overseer": return overseer ? <OverseerRow theme={theme} o={overseer} selected={selectedKey === OVERSEER_KEY} touch={touch} onSelect={onSelect} /> : null;
@@ -147,12 +158,12 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
147
158
  case "row": {
148
159
  const selected = selectedKey === item.key;
149
160
  return <View>
150
- <Row s={item.s} theme={theme} dense={dense} touch={touch} selected={selected} onSelect={onSelect} sig={item.s.sig} />
161
+ <Row s={item.s} theme={theme} dense={dense} touch={touch} selected={selected} onSelect={onSelect} sig={item.s.sig} onMenu={onMenu} menuOpen={menuKey === item.key} />
151
162
  {selected && renderExpanded ? renderExpanded(item.s) : null}
152
163
  </View>;
153
164
  }
154
165
  }
155
- }, [theme, c, dense, touch, selectedKey, onSelect, briefLine, renderExpanded, toggle, toggleProject, activeResult, onResult, model, overseer?.state, overseer?.line, asking, afterNeeds, emptyAction]);
166
+ }, [theme, c, dense, touch, selectedKey, onSelect, briefLine, renderExpanded, toggle, toggleProject, activeResult, onResult, model, overseer?.state, overseer?.line, asking, afterNeeds, emptyAction, onMenu, menuKey]);
156
167
 
157
168
  const listRef = useRef<FlatList<Entry>>(null);
158
169
  // Keep the keyboard-active result in view.
@@ -161,11 +172,13 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
161
172
  const at = data.findIndex(e => (e.type === "result" || e.type === "ask") && e.index === activeResult);
162
173
  if (at >= 0) listRef.current?.scrollToIndex({ index: at, viewPosition: 0.5, animated: false });
163
174
  }, [activeResult, results, data]);
164
- const list = <FlatList ref={listRef} data={data} keyExtractor={e => e.key} renderItem={render} extraData={`${selectedKey}:${activeResult}:${asking}`} onScrollToIndexFailed={() => undefined}
175
+ const list = <FlatList ref={listRef} data={data} keyExtractor={e => e.key} renderItem={render} extraData={`${selectedKey}:${activeResult}:${asking}:${menuKey}`} onScrollToIndexFailed={() => undefined}
165
176
  initialNumToRender={30} maxToRenderPerBatch={30} windowSize={9} removeClippedSubviews={false}
166
177
  ListHeaderComponent={header ? <>{header}</> : null} ListFooterComponent={footer ? <>{footer}</> : <View style={{ height: 32 }} />}
167
178
  style={{ flex: 1 }} contentContainerStyle={{ paddingBottom: 8 }} keyboardShouldPersistTaps="handled" />;
168
- return top ? <View style={{ flex: 1, minHeight: 0 }}>{top}{list}</View> : list;
179
+ const overlay = openMenu && menu ? <RowMenu key={`${openMenu.s.key}:${openMenu.anchor?.x ?? "sheet"}:${openMenu.anchor?.y ?? ""}`} menu={openMenu} theme={theme} onClose={() => setOpenMenu(null)} onPick={item => menu.pick(openMenu.s, item)} /> : null;
180
+ // With a menu the wrapper is always there, so opening one never remounts the list (and its scroll).
181
+ return top || menu ? <View style={{ flex: 1, minHeight: 0 }}>{top}{list}{overlay}</View> : list;
169
182
  }
170
183
 
171
184
  function GroupHeader({ theme, title, count, open, tone, dense, touch, onPress }: { theme: Theme; title: string; count: number; open: boolean; tone?: string; dense: boolean; touch: boolean; onPress: () => void }) {
@@ -210,6 +223,9 @@ function OverseerRow({ theme, o, selected, touch, onSelect }: { theme: Theme; o:
210
223
  * `text`: the colour carries the state word on its own (phones), so it's lifted to 4.5:1 on dark grounds. Finished
211
224
  * uses the host accent and success green, both fill colours at about 3:1 as 12px text.
212
225
  */
226
+ /** The row's hint, the same on Home rows and search results. */
227
+ export const quickActionsHint = (touch: boolean) => touch ? "Long-press for quick actions" : "Quick actions: Shift+F10";
228
+
213
229
  export function glyphColor(s: Pick<Workstream, "tone">, c: Colors, text = false): string {
214
230
  const base = s.tone === "running" ? runningColor(c) : s.tone === "success" ? c.statusSuccess : headlineColor(s.tone, c);
215
231
  return text ? readable(base, c) : base;
@@ -248,9 +264,10 @@ export function Age({ iso, c, size = 12 }: { iso: string | null; c: Colors; size
248
264
  return text ? <Text style={{ color: c.foregroundMuted, fontSize: size, fontVariant: ["tabular-nums"], minWidth: 26, textAlign: "right" }}>{text}</Text> : null;
249
265
  }
250
266
 
251
- type RowProps = { s: Workstream; sig: string; theme: Theme; dense: boolean; touch: boolean; selected: boolean; onSelect: (key: string) => void };
252
- const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect }: RowProps) {
267
+ type RowProps = { s: Workstream; sig: string; theme: Theme; dense: boolean; touch: boolean; selected: boolean; onSelect: (key: string) => void; onMenu?: OpenRowMenu; menuOpen?: boolean };
268
+ const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect, onMenu, menuOpen = false }: RowProps) {
253
269
  const c = theme.colors;
270
+ const trigger = useRowMenuTrigger(s, onMenu, touch);
254
271
  const color = glyphColor(s, c, touch);
255
272
  const blocking = s.group === "needs" && s.tier === 0;
256
273
  const muted = s.group === "quiet" || s.group === "later";
@@ -258,11 +275,12 @@ const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect }: Ro
258
275
  // Phones: "Working" under every row of a "Running 9" group says nothing the header didn't; one line per row instead.
259
276
  const generic = touch && !s.word && (s.line === "Working" || s.line === "Fixing");
260
277
  const label = [s.title + (s.agent ? ` › ${s.agent}` : ""), s.word, s.line].filter(Boolean).join(". ");
261
- return <Pressable accessibilityRole="button" accessibilityState={{ selected }} accessibilityLabel={label} onPress={() => onSelect(s.key)}
278
+ return <Pressable ref={trigger.ref} accessibilityRole="button" accessibilityState={{ selected }} accessibilityLabel={label} accessibilityHint={onMenu ? quickActionsHint(touch) : undefined}
279
+ onPress={() => onSelect(s.key)} onLongPress={trigger.onLongPress} delayLongPress={450}
262
280
  style={state => ({ flexDirection: "row", alignItems: dense ? "flex-start" : "center", gap: touch ? 10 : dense ? 8 : 10, minHeight: touch ? 56 : dense ? 36 : 38, paddingLeft: touch ? 14 : dense ? 8 : 16, paddingRight: touch ? 16 : dense ? 8 : 16, paddingVertical: touch ? 12 : dense ? 6 : 0,
263
281
  ...(touch ? { borderBottomWidth: 1, borderBottomColor: withAlpha(c.border, 0.6) } : {}),
264
282
  borderLeftWidth: 2, borderLeftColor: blocking ? withAlpha(color, 0.9) : "transparent",
265
- backgroundColor: selected ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
283
+ backgroundColor: selected || menuOpen || state.pressed && touch ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
266
284
  <View style={{ width: touch ? 18 : 16, alignItems: "center", paddingTop: touch ? 2 : dense ? 1 : 0 }}>
267
285
  {s.tone === "running" && s.icon === "LoaderCircle" ? <Spinner color={color} size={13} label="Running" /> : <Icon name={s.icon} size={touch ? 17 : 15} color={color} />}
268
286
  </View>
@@ -296,4 +314,4 @@ const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect }: Ro
296
314
  </View>{!!s.priority?.reason && <View style={{ paddingRight: 40 }}><PriorityLine reason={s.priority.reason} source={s.priority.source} c={c} /></View>}</View>}
297
315
  {!touch && <Age iso={s.at} c={c} size={dense ? 11 : 12} />}
298
316
  </Pressable>;
299
- }, (a, b) => a.sig === b.sig && a.selected === b.selected && a.theme === b.theme && a.dense === b.dense && a.touch === b.touch && a.onSelect === b.onSelect);
317
+ }, (a, b) => a.sig === b.sig && a.selected === b.selected && a.theme === b.theme && a.dense === b.dense && a.touch === b.touch && a.onSelect === b.onSelect && a.onMenu === b.onMenu && a.menuOpen === b.menuOpen);
package/client/home.tsx CHANGED
@@ -28,6 +28,8 @@ import type { OnboardingView } from "../shared/onboarding";
28
28
  import { withAlpha, isLight, mergedColor, type Colors } from "./theme";
29
29
  import { UpdateNotice } from "./updates";
30
30
  import { ReleaseNotesSheet, VersionLine, WhatsNewGate } from "./release-notes";
31
+ import { useRowMenu } from "./row-actions";
32
+ import { laterChoices } from "../shared/row-menu";
31
33
 
32
34
  export const HOME_SCREEN = "follow-through";
33
35
 
@@ -42,7 +44,7 @@ export type HomeDeps = {
42
44
  openLog(): void;
43
45
  openHome(): void;
44
46
  /** Phones: open one Home item as its own screen, so the host's ← (and Android back) returns to the list. */
45
- openItem?(key: string): void;
47
+ openItem?(key: string, extra?: { question?: string }): void;
46
48
  briefDeps: BriefDeps;
47
49
  };
48
50
 
@@ -114,6 +116,15 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
114
116
  // The explorer needs the workspace route first; then dock that workspace's panel beside the chat.
115
117
  if (!compact && s.workspaceId) { const id = s.workspaceId; setTimeout(() => deps.openPanel(id), 900); }
116
118
  }, [navigation, compact, deps]);
119
+ // The row menu's Answer: select the row (phones: open its screen) with that question's card open.
120
+ const [ask, setAsk] = useState<{ key: string; id: string; n: number } | null>(() => params.question && params.item ? { key: params.item, id: params.question, n: 1 } : null);
121
+ const openQuestion = useCallback((s: Workstream, id: string) => {
122
+ if (route) { deps.openItem?.(s.key, { question: id }); return; }
123
+ setSelected(s.key); setAsk(a => ({ key: s.key, id, n: (a?.n ?? 0) + 1 }));
124
+ }, [route, deps]);
125
+ const omniRef = useRef(omnibox); omniRef.current = omnibox;
126
+ const prefillAsk = useCallback((text: string) => { omniRef.current.setQuery(text); setTimeout(() => omniRef.current.inputRef.current?.focus(), 0); }, []);
127
+ const rowMenu = useRowMenu({ sources: deps.sources, openFull, openQuestion, prefillAsk, overseerOn: !!overseerStatus?.enabled });
117
128
  const signOffNext = useCallback((s: Workstream) => {
118
129
  if (s.agentId) void inbox.signOff([s.agentId]);
119
130
  const next = nextNeeds(model, s.key);
@@ -133,12 +144,12 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
133
144
  const detail = selected === OVERSEER_KEY && overseer
134
145
  ? <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} />
135
146
  : current
136
- ? <DetailPane key={current.key} s={current} model={model} theme={theme} compact={compact} deps={deps} openFull={openFull} signOffNext={signOffNext} onBack={compact && !route ? () => setSelected(null) : undefined} />
147
+ ? <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} />
137
148
  : <BriefPane theme={theme} compact={compact} pane={pane} onSelect={key => route ? route(key) : setSelected(key)} openLog={deps.openLog} sources={deps.sources} />;
138
149
  // Nothing followed at all: no sort, no meters, just the empty state and its action.
139
150
  const nothing = model.groups.every(g => !g.items.length);
140
151
  const list = <HomeList model={model} theme={theme} dense={compact} touch={compact} selectedKey={selected} onSelect={onSelect} briefLine={briefLine}
141
- results={omnibox.results} activeResult={omnibox.active} onResult={item => void pick(item)} filter={filter} overseer={overseer} asking={asking}
152
+ results={omnibox.results} activeResult={omnibox.active} onResult={item => void pick(item)} filter={filter} overseer={overseer} asking={asking} menu={rowMenu}
142
153
  // Phones: the host header already says Follow-up, so no "Home" title row; search, sort and settings share one row and
143
154
  // the meters move to the end of the list.
144
155
  footer={omnibox.results ? undefined : compact
@@ -250,9 +261,11 @@ function useTail(handle: ReturnType<typeof useAgentLive>["handle"], key: string,
250
261
  return { steps, error, seenAt, asleep, loading, woken: wake > 0, load: () => setWake(n => n + 1) };
251
262
  }
252
263
 
253
- function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, onBack }: {
264
+ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask, onBack }: {
254
265
  s: Workstream; model: HomeModel; theme: Theme; compact: boolean; deps: HomeDeps;
255
266
  openFull: (s: Workstream) => void; signOffNext: (s: Workstream) => void; onBack?: () => void;
267
+ /** The row menu's Answer: open this question's card (n changes on every pick, so the same question reopens). */
268
+ ask?: { id: string; n: number } | null;
256
269
  }) {
257
270
  const c = theme.colors; const t = text(c, compact);
258
271
  const toast = useToast();
@@ -266,7 +279,8 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, onB
266
279
  const browserRead = useRpc(browserStatusRpc);
267
280
  const [sheet, setSheet] = useState<{ key: string; intent: "merge" | "reviewers" } | null>(null);
268
281
  const browser = useQuery({ queryKey: browserKey, queryFn: () => browserRead({}), refetchInterval: BROWSER_POLL_MS, enabled: !!sheet });
269
- const [question, setQuestion] = useState<string | null>(null);
282
+ const [question, setQuestion] = useState<string | null>(() => ask?.id ?? null);
283
+ useEffect(() => { if (ask) setQuestion(ask.id); }, [ask?.n]); // eslint-disable-line react-hooks/exhaustive-deps
270
284
  const [laterOpen, setLaterOpen] = useState(false);
271
285
  const [busy, setBusy] = useState<string | null>(null);
272
286
  const b = brief.data?.brief?.state === "open" ? brief.data.brief : null;
@@ -330,12 +344,12 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, onB
330
344
  <Button theme={theme} compact={compact} icon="AlarmClock" title="Later…" onPress={() => setLaterOpen(v => !v)} />
331
345
  </View>
332
346
  {laterOpen && <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 6 }}>
333
- {([["hour", "In 1 hour"], ["tonight", "Tonight 18:00"], ["tomorrow", "Tomorrow 09:00"], ["next-event", "Next event"]] as const).map(([k, label]) =>
347
+ {laterChoices(new Date()).map(([k, label]) =>
334
348
  <Button key={k} theme={theme} compact={compact} kind="ghost" title={label} onPress={() => { setLaterOpen(false); void inbox.snooze([s.agentId!], snoozeUntil(k, new Date())); }} />)}
335
349
  </View>}
336
350
  </View>;
337
351
 
338
- const laterTimes = [["hour", "In 1 hour"], ["tonight", "Tonight 18:00"], ["tomorrow", "Tomorrow 09:00"], ["next-event", "Next event"]] as const;
352
+ const laterTimes = laterChoices(new Date());
339
353
  // Phones: the moves sit in the dock above the composer, in thumb reach, on one row: Sign off, Sign off & next, Later.
340
354
  const narrow = useWindowDimensions().width < 380;
341
355
  const moves = compact && canMove && !typing && <View style={{ flexDirection: "row", gap: 8, paddingHorizontal: 12, paddingTop: 10 }}>
package/client/pill.tsx CHANGED
@@ -9,6 +9,7 @@ import { browserStatusRpc } from "../shared/contracts";
9
9
  import { needsYou, type NeedItem } from "../shared/attention";
10
10
  import { briefQuestionIds, HEADLINE_ICON, HEADLINE_TONE, pillState, todoLabel, withoutBriefQuestions, type PillState } from "../shared/headline";
11
11
  import { snoozeUntil, type InboxRow } from "../shared/inbox";
12
+ import { laterChoices } from "../shared/row-menu";
12
13
  import { isOpen as questionOpen } from "../shared/questions";
13
14
  import type { Workspace } from "../shared/model";
14
15
  import { Button, errorText, text, type Theme } from "./kit";
@@ -127,7 +128,6 @@ function FooterLink({ title, icon, onPress, theme, compact, hint }: { title: str
127
128
  </Pressable>;
128
129
  }
129
130
 
130
- const LATER = [["hour", "In 1 hour"], ["tonight", "Tonight 18:00"], ["tomorrow", "Tomorrow 09:00"], ["next-event", "Next event"]] as const;
131
131
 
132
132
  /**
133
133
  * The popover. Paseo mounts popover content twice on web (#9103) and may leave a stray copy (#7235), so it
@@ -191,12 +191,12 @@ export function PillPopover(props: PluginButtonContentProps & { deps: Deps }) {
191
191
  ? <View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
192
192
  <Text style={t.meta}>Later</Text>
193
193
  <ScrollView horizontal showsHorizontalScrollIndicator={false} style={{ flex: 1 }} contentContainerStyle={{ gap: 6, paddingRight: 8 }}>
194
- {LATER.map(([id, title]) => <Chip key={id} title={title.replace(/^In 1 hour$/, "1 hour")} theme={props.theme} compact onPress={() => done(() => void deps.inbox.snooze([agentId], snoozeUntil(id, new Date())))} />)}
194
+ {laterChoices(new Date()).map(([id, title]) => <Chip key={id} title={title.replace(/^In 1 hour$/, "1 hour")} theme={props.theme} compact onPress={() => done(() => void deps.inbox.snooze([agentId], snoozeUntil(id, new Date())))} />)}
195
195
  </ScrollView>
196
196
  </View>
197
197
  : <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 6 }}>
198
198
  <Text style={[t.meta, { marginRight: 2 }]}>Later</Text>
199
- {LATER.map(([id, title]) => <Chip key={id} title={title} theme={props.theme} compact={touch} onPress={() => done(() => void deps.inbox.snooze([agentId], snoozeUntil(id, new Date())))} />)}
199
+ {laterChoices(new Date()).map(([id, title]) => <Chip key={id} title={title} theme={props.theme} compact={touch} onPress={() => done(() => void deps.inbox.snooze([agentId], snoozeUntil(id, new Date())))} />)}
200
200
  </View>}
201
201
  </View>}
202
202
 
@@ -0,0 +1,79 @@
1
+ import { useEffect, useMemo, useRef } from "react";
2
+ import { useRpc } from "@getpaseo/plugin/client";
3
+ import { copyText, useToast } from "@getpaseo/plugin/client/ui";
4
+ import { useQueryClient } from "@tanstack/react-query";
5
+ import { controlRpc, sendRpc, setFollowSettingsRpc, workspaceAboutRpc } from "../shared/contracts";
6
+ import { needsYou } from "../shared/attention";
7
+ import { snoozeUntil, wakeLabel } from "../shared/inbox";
8
+ import { LATER_CHOICES, rowMenu, type LaterChoice, type RowMenuItem } from "../shared/row-menu";
9
+ import type { Workstream } from "../shared/home";
10
+ import { aboutKey } from "./about";
11
+ import { bindToast, runAction } from "./actions";
12
+ import type { HomeSources } from "./home-data";
13
+
14
+ /** What the surface showing the menu does for the moves that leave the list (open, answer, ask). */
15
+ export type RowMenuHost = {
16
+ sources: HomeSources;
17
+ openFull: (s: Workstream) => void;
18
+ openQuestion: (s: Workstream, questionId: string) => void;
19
+ /** Pre-fills an Overseer ask; absent where there's no omnibox. */
20
+ prefillAsk?: (text: string) => void;
21
+ /** The Overseer is on, so an ask has somewhere to go. */
22
+ overseerOn: boolean;
23
+ };
24
+
25
+ /**
26
+ * The row menu for a Home list: `build` lists what applies to a row, `pick` runs one move. Every move goes through
27
+ * `runAction` (the menu is already closed; the result shows as a toast) and reuses the RPC its usual button calls.
28
+ */
29
+ export function useRowMenu(host: RowMenuHost) {
30
+ const toast = useToast();
31
+ useEffect(() => { bindToast(toast); }, [toast]);
32
+ const cache = useQueryClient();
33
+ const send = useRpc(sendRpc); const control = useRpc(controlRpc); const about = useRpc(workspaceAboutRpc); const setFollow = useRpc(setFollowSettingsRpc);
34
+ // Read through a ref so build and pick stay one stable pair: the list's memoised rows compare them by identity.
35
+ const current = useRef({ host, send, control, about, setFollow, cache });
36
+ current.current = { host, send, control, about, setFollow, cache };
37
+ return useMemo(() => {
38
+ const deps = () => current.current;
39
+ const build = (s: Workstream) => {
40
+ const { sources: { inbox, live, paseo }, prefillAsk, overseerOn } = deps().host;
41
+ const row = s.agentId ? inbox.rows().find(r => r.agentId === s.agentId) ?? null : null;
42
+ const w = s.workspaceId ? live.get(s.workspaceId) ?? null : null;
43
+ return rowMenu({ s, flagged: !!row?.needs, snoozedUntil: row?.needs && row.snooze ? wakeLabel(row.snooze, Date.now()) || null : null, w, needs: w ? needsYou(w) : [], branch: s.workspaceId ? paseo.get(s.workspaceId)?.branch ?? null : null, canAsk: !!prefillAsk && overseerOn });
44
+ };
45
+ const pick = (s: Workstream, item: RowMenuItem): Promise<boolean> => {
46
+ const { host: { sources: { inbox, live }, openFull, openQuestion, prefillAsk }, send, control, about, setFollow, cache } = deps();
47
+ const after = () => { live.refresh(); inbox.refresh(); };
48
+ const workspaceId = s.workspaceId ?? "";
49
+ const arg = item.arg ?? "";
50
+ switch (item.action) {
51
+ case "later": {
52
+ const label = LATER_CHOICES.find(([id]) => id === arg)?.[1] ?? "Later";
53
+ return runAction({ label: "Later", run: () => inbox.snooze([s.agentId!], snoozeUntil(arg as LaterChoice, new Date())), success: `Later · ${label}` }, `later:${s.key}`);
54
+ }
55
+ // The Undo bar already says it and offers Undo; no toast on top.
56
+ case "sign_off": return runAction({ label: "Sign off", run: () => inbox.signOff([s.agentId!]), success: null }, `sign_off:${s.key}`);
57
+ case "answer": return runAction({ label: "Answer", run: async () => openQuestion(s, arg), success: null });
58
+ case "send_repairs": return runAction({ label: "Send repairs", run: async () => { const r = await send({ workspaceId, batchId: arg }); after(); return r; },
59
+ success: r => {
60
+ const b = r.batches.find(x => x.id === arg);
61
+ if (!b || ["sent", "sending", "completed"].includes(b.state)) return "Sent to the main agent";
62
+ if (b.state === "pending") return "Queued. It goes out when the agent is free.";
63
+ if (b.state === "uncertain") return "Delivery wasn't confirmed. Check the agent before retrying.";
64
+ throw new Error(b.result || "The repairs couldn't be sent.");
65
+ } }, `send:${workspaceId}`);
66
+ case "retry_batch": return runAction({ label: "Retry repairs", run: async () => { await control({ workspaceId, retryBatchId: arg }); after(); }, success: "Repairs queued again" }, `retry:${workspaceId}`);
67
+ case "clear_hold": return runAction({ label: "Resume follow-up", run: async () => { await control({ workspaceId, clearHold: true }); after(); }, success: "Follow-up resumed" }, `hold:${workspaceId}`);
68
+ case "open_chat": return runAction({ label: "Open", run: async () => openFull(s), success: null });
69
+ case "ask_overseer": return runAction({ label: "Ask the Overseer", run: async () => prefillAsk?.(`About ${s.title}: `), success: null });
70
+ case "copy_branch": return runAction({ label: "Copy branch", run: () => copyText(arg), success: "Branch name copied", failure: "Couldn't copy here" });
71
+ case "copy_pr": return runAction({ label: "Copy PR link", run: () => copyText(arg), success: arg.includes("\n") ? "PR links copied" : "PR link copied", failure: "Couldn't copy here" });
72
+ case "rewrite_summary": return runAction({ label: "Rewrite Summary", run: async () => cache.setQueryData(aboutKey(workspaceId), await about({ workspaceId, open: true, refresh: true })), success: "Summary rewritten" }, `about:${workspaceId}`);
73
+ case "make_main": return runAction({ label: "Make main agent", run: async () => { await control({ workspaceId, mainAgentId: arg }); after(); }, success: `${s.agent ?? "That agent"} is now the main agent` }, `main:${workspaceId}`);
74
+ case "stop_following": return runAction({ label: "Stop following", run: async () => { await setFollow({ workspace: { workspaceId, follow: false } }); after(); }, success: `Stopped following ${s.title}` }, `follow:${workspaceId}`);
75
+ }
76
+ };
77
+ return { build, pick: (s: Workstream, item: RowMenuItem) => { void pick(s, item); } };
78
+ }, []);
79
+ }