paseo-follow-up 1.4.0-beta.33 → 1.4.0-beta.35

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.33
241
+ paseo plugin update follow-through --version 1.4.0-beta.35
242
242
  # or, for a fresh install:
243
243
  paseo plugin install npm:paseo-follow-up@beta
244
244
  ```
@@ -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
+ }
package/client/agents.tsx CHANGED
@@ -1,4 +1,3 @@
1
- import type { ReactNode } from "react";
2
1
  import { ActivityIndicator, Text, View } from "react-native";
3
2
  import type { PluginSurfaceProps } from "@getpaseo/plugin/client";
4
3
  import { useRpc } from "@getpaseo/plugin/client";
@@ -6,52 +5,38 @@ import { SettingsAction, SettingsCard, SettingsSection, SettingsSelect, Settings
6
5
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
7
6
  import { agentSettingsRpc, setAgentSettingRpc, setWaitRpc } from "../shared/contracts";
8
7
  import { WAIT_HINT, WAIT_NOT_ATTACHED, WAIT_TITLE, waitNote } from "../shared/wait";
9
- import { AGENT_ROLES, JOB_PROVIDERS, ROLE_DEFAULTS, ROLE_INFO, isJobRole, modelName, providerName, type AgentRole, type AgentSettingsView, type CatalogProvider, type SavedRole } from "../shared/agent-settings";
8
+ import { isJobRole, type AgentRole, type AgentSettingsView, type SavedRole } from "../shared/agent-settings";
9
+ import { NO_PROMPT_MODE, SETTINGS_ORDER, isReset, resetEntry } from "../shared/job-rows";
10
+ import { JobRows, agentSettingsKey, useAgentSettings, type JobExtra } from "./job-rows";
10
11
  import { Button, errorText, text, type Theme } from "./kit";
11
12
 
12
- export const agentSettingsKey = ["follow-through", "agent-settings"];
13
+ export { agentSettingsKey } from "./job-rows";
13
14
  const key = agentSettingsKey;
14
- const SAME = "__same";
15
15
  const DEFAULT = "__default";
16
- /** Each provider's "don't ask" mode, used when a Paseo agent role moves to it. */
17
- const BYPASS: Record<string, string> = { claude: "bypassPermissions", codex: "full-access" };
18
16
 
19
17
  type Role = AgentSettingsView["roles"][number];
20
18
 
21
19
  /**
22
- * Settings → Agents: one card per special role. What it does and what it uses now, then provider, model, effort,
23
- * mode and limits. The provider catalog is read once when this screen opens (cached on the server), never polled.
20
+ * Settings → Agents: the same job rows as setup's Helper agents step (client/job-rows.tsx), plus each row's More with
21
+ * what only Settings has: permissions, limits, schedule and Reset to defaults. The provider catalog is read once when
22
+ * this screen opens (cached on the server), never polled.
24
23
  */
25
- export function AgentSettings({ theme, compact, toggles = {} }: Pick<PluginSurfaceProps, "theme"> & { compact: boolean; toggles?: Partial<Record<AgentRole, ReactNode>> }) {
24
+ export function AgentSettings({ theme, compact }: Pick<PluginSurfaceProps, "theme"> & { compact: boolean }) {
26
25
  const c = theme.colors; const t = text(c);
27
- const read = useRpc(agentSettingsRpc); const write = useRpc(setAgentSettingRpc); const cache = useQueryClient(); const toast = useToast();
28
- const query = useQuery({ queryKey: key, queryFn: () => read({ catalog: true }), staleTime: 5 * 60_000,
29
- // Only while Paseo is still discovering providers (right after it starts): ask again until they settle.
30
- refetchInterval: q => (q.state.data as AgentSettingsView | undefined)?.catalog?.providers.some(p => p.reason === "Still loading") && q.state.dataUpdateCount < 10 ? 5000 : false });
31
- const change = useMutation({
32
- mutationFn: (input: { role: AgentRole; entry: SavedRole | null }) => write(input),
33
- onSuccess: (value, input) => {
34
- cache.setQueryData(key, value);
35
- void cache.invalidateQueries({ queryKey: ["follow-through", "about"] });
36
- const r = value.roles.find(x => x.role === input.role);
37
- if (r) toast.show(input.role === "overseer" ? `Overseer: ${r.summary}. Restart it from Home to switch.` : `${ROLE_INFO[input.role].title}: ${r.summary}`, { variant: "success" });
38
- },
39
- onError: error => toast.error(errorText(error)),
40
- });
26
+ const { query } = useAgentSettings();
41
27
  const data = query.data;
42
- const info = "Which agent Follow-up uses for each of its own jobs. Defaults: Claude Haiku for summaries, Claude Opus for the Overseer, the main agent's own setup for recovery, Claude Sonnet for priority ranking. Summaries and the ranker are one-shot jobs, so they run on Claude or Codex only; the Overseer and recovery can use any provider Paseo has. Changes apply from the next call; the Overseer switches when you restart it.";
43
- return <SettingsSection title="Models" info={info}>
44
- {query.isPending && <ActivityIndicator accessibilityLabel="Loading agent settings" color={c.foregroundMuted} style={{ alignSelf: "flex-start", marginVertical: 8 }} />}
45
- {query.error && <SettingsCard><SettingsAction label="Couldn't load agent settings" hint={errorText(query.error)} actionLabel="Retry" onPress={() => void query.refetch()} /></SettingsCard>}
46
- {data?.catalog?.error && <SettingsCard><SettingsAction label="Couldn't read Paseo's providers" hint={`${data.catalog.error} The current choices still work; pickers show only what's saved.`} actionLabel="Retry" onPress={() => void read({ catalog: true, fresh: true }).then(v => cache.setQueryData(key, v), e => toast.error(errorText(e)))} /></SettingsCard>}
47
- {data && AGENT_ROLES.map(role => {
48
- const r = data.roles.find(x => x.role === role);
49
- return r ? <RoleCard key={role} r={r} invalid={data.invalid.includes(role)} catalog={data.catalog?.providers ?? []} busy={change.isPending} toggle={toggles[role]}
50
- save={entry => change.mutate({ role, entry })} theme={theme} compact={compact} /> : null;
51
- })}
52
- {/* Once, after the cards: what can't be picked and why (the pickers only list what can). */}
53
- {!!data?.catalog?.providers.some(p => !p.available) && <Text style={[t.meta, { paddingHorizontal: 4 }]}>{`Not available in Paseo: ${data.catalog.providers.filter(p => !p.available).map(p => `${p.label} (${(p.reason ?? "unavailable").replace(/\.$/, "")})`).join(", ")}.`}</Text>}
54
-
28
+ const more: JobExtra = {
29
+ // The toggle names what's inside, so nobody opens it to find out.
30
+ label: r => r.role === "ranker" ? "Schedule, limits and reset" : isJobRole(r.role) ? "Limits and reset" : r.same ? null : "Permissions and reset",
31
+ render: (r, save, busy) => <RoleMore r={r} save={save} busy={busy} theme={theme} compact={compact} invalid={!!data?.invalid.includes(r.role)} />,
32
+ };
33
+ const info = "Which agent Follow-up uses for each of its own jobs. Recommended picks come from what Paseo has: with Claude, Haiku for summaries, Sonnet for AI priority, the newest Opus for the Overseer and the main agent's setup for recovery; otherwise a model of the size each job needs. Summaries and AI priority are one-shot jobs: on a provider other than Claude or Codex, each runs as a short hidden agent that's archived when it answers. Changes apply from the next call; the Overseer switches when you restart it.";
34
+ return <SettingsSection title="Helper agents" info={info}>
35
+ <SettingsCard>
36
+ <JobRows theme={theme} compact={compact} order={SETTINGS_ORDER} extra={more} />
37
+ </SettingsCard>
38
+ {/* Once, after the rows: what can't be picked and why (the pickers only list what can). */}
39
+ {!!data?.catalog && unavailableLine(data.catalog.providers) && <Text style={[t.meta, { paddingHorizontal: 4 }]}>{unavailableLine(data.catalog.providers)}</Text>}
55
40
  </SettingsSection>;
56
41
  }
57
42
 
@@ -82,64 +67,27 @@ export function WaitSettings({ theme }: Pick<PluginSurfaceProps, "theme">) {
82
67
  </SettingsSection>;
83
68
  }
84
69
 
85
- function RoleCard({ r, invalid, catalog, busy, save, theme, compact, toggle }: { r: Role; invalid: boolean; catalog: CatalogProvider[]; busy: boolean; save: (entry: SavedRole | null) => void; theme: Theme; compact: boolean; toggle?: ReactNode }) {
70
+ /** A row's More in Settings: permissions (Paseo agents), limits and schedule (jobs), and Reset to defaults. */
71
+ function RoleMore({ r, save, busy, theme, compact, invalid }: { r: Role; save: (entry: SavedRole | null) => void; busy: boolean; theme: Theme; compact: boolean; invalid: boolean }) {
86
72
  const c = theme.colors; const t = text(c);
73
+ const { query } = useAgentSettings();
74
+ const catalog = query.data?.catalog?.providers ?? [];
87
75
  const role = r.role;
88
76
  const jobs = isJobRole(role);
89
- const usable = catalog.filter(p => p.available && (!jobs || (JOB_PROVIDERS as readonly string[]).includes(p.id)));
90
77
  const current = catalog.find(p => p.id === r.provider);
91
78
  const base: SavedRole = { provider: r.provider, model: r.model, thinking: r.thinking, ...(jobs ? {} : { mode: r.mode }), ...(role === "recovery" ? { same: r.same } : {}),
92
79
  ...(jobs ? { dailyCap: r.dailyCap ?? undefined, maxPromptChars: r.maxPromptChars ?? undefined } : {}), ...(role === "ranker" ? { cadenceMinutes: r.cadenceMinutes ?? undefined } : {}) };
93
80
  const set = (patch: SavedRole) => save({ ...base, ...patch });
94
- const providerLabel = providerName(r.provider, current?.label);
95
- // Saved on a provider Paseo can't use right now: say so plainly, with what happens and the way out.
96
- const blocked = !r.same && catalog.length > 0 && !usable.some(p => p.id === r.provider);
97
- const blockedReason = !current ? "not in Paseo's provider list" : !current.available ? (current.reason ?? "unavailable").replace(/\.$/, "") : "can't run one-shot jobs";
98
-
99
- const providerOptions = [
100
- ...(role === "recovery" ? [{ value: SAME, label: "Same as main agent" }] : []),
101
- ...usable.map(p => ({ value: p.id, label: p.label })),
102
- ...(!r.same && !usable.some(p => p.id === r.provider) ? [{ value: r.provider, label: `${providerLabel} · unavailable` }] : []),
103
- ];
104
- const pickProvider = (value: string) => {
105
- if (value === SAME) return set({ same: true });
106
- const p = catalog.find(x => x.id === value);
107
- const defaults = ROLE_DEFAULTS[role];
108
- const same = value === defaults.provider;
109
- set({ same: false, provider: value, model: same ? defaults.model : null, thinking: null, ...(jobs ? {} : { mode: same ? defaults.mode : BYPASS[value] ?? p?.defaultMode ?? null }) });
110
- };
111
-
112
- const models = current?.models ?? [];
113
- const model = r.model ? models.find(m => m.id === r.model) : null;
114
- const providerDefault = models.find(m => m.isDefault);
115
- const defaultModel = role === "overseer" && r.provider === "claude" ? "Default (newest Opus)" : providerDefault ? `Default (${providerDefault.label})` : "Default";
116
- const modelOptions = [{ value: DEFAULT, label: defaultModel }, ...models.map(m => ({ value: m.id, label: m.label })),
117
- ...(r.model && !model ? [{ value: r.model, label: modelName(r.model) }] : [])];
118
- const thinking = (model ?? providerDefault)?.thinking ?? [];
119
- const thinkingDefault = thinking.find(o => o.isDefault);
120
81
  const modes = current?.modes ?? [];
121
82
  const modeDefault = modes.find(m => m.id === current?.defaultMode);
122
- const modeLabel = (m: { id: string; label: string }) => BYPASS[r.provider] === m.id ? `${m.label} · no prompts` : m.label;
123
-
124
- const reset = <Button theme={theme} compact={compact} kind="ghost" icon="RotateCcw" title="Reset to default" accessibilityHint={`Back to ${roleDefaultText(role)}`} disabled={busy || (r.isDefault && !invalid)} onPress={() => save(null)} />;
125
- return <SettingsCard>
126
- <View style={{ paddingHorizontal: 16, paddingTop: 14, paddingBottom: 10, gap: 2 }}>
127
- <View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
128
- <Text accessibilityRole="header" style={[t.title, { flex: 1 }]}>{ROLE_INFO[role].title}</Text>
129
- {!compact && reset}
130
- </View>
131
- <Text style={t.meta}>{ROLE_INFO[role].does}{role === "overseer" ? " A running Overseer keeps its model until you restart it from Home." : ""}</Text>
132
- {invalid && <Text style={t.meta}>Part of the saved setting wasn't valid, so its default is used.</Text>}
133
- {blocked && <Text accessibilityRole="alert" style={[t.meta, { color: c.statusWarning }]}>{`${providerLabel} isn't available (${blockedReason}). ${role === "about" ? "Summaries will fail" : role === "ranker" ? "Ranking will fail" : role === "overseer" ? "Starting or restarting the Overseer will fail" : "Recovery agents won't start"} until you pick another provider or reset.`}</Text>}
134
- </View>
135
- {/* The role's own on/off (Overseer, AI priority) leads its card; the model rows follow. */}
136
- {toggle}
137
- <SettingsSelect label="Provider" value={r.same ? SAME : r.provider} options={providerOptions} disabled={busy || !catalog.length} onValueChange={pickProvider} />
138
- {!r.same && <SettingsSelect label="Model" value={r.model ?? DEFAULT} options={modelOptions} disabled={busy || !catalog.length}
139
- onValueChange={value => set({ model: value === DEFAULT ? null : value, thinking: null })} />}
140
- {!r.same && (thinking.length > 0 || !!r.thinking) && <SettingsSelect label="Effort" hint={!thinking.length && !blocked && model ? "This model lists no effort levels in Paseo; the saved one is still passed on." : undefined} value={r.thinking ?? DEFAULT}
141
- options={[{ value: DEFAULT, label: thinkingDefault ? `Default (${thinkingDefault.label})` : "Default" }, ...thinking.map(o => ({ value: o.id, label: o.label })), ...(r.thinking && !thinking.some(o => o.id === r.thinking) ? [{ value: r.thinking, label: r.thinking }] : [])]} disabled={busy}
142
- onValueChange={value => set({ thinking: value === DEFAULT ? null : value })} />}
83
+ const modeLabel = (m: { id: string; label: string }) => NO_PROMPT_MODE[r.provider] === m.id ? `${m.label} · no prompts` : m.label;
84
+ // Reset puts back the declared defaults, unless they can't run here: then the recommendation, with default limits.
85
+ const reset = resetEntry(role, query.data?.catalog);
86
+ const resetDone = isReset(r, query.data?.catalog);
87
+ const schedule = role === "ranker" ? "limits and schedule" : jobs ? "limits" : "permissions";
88
+ const resetText = reset.entry ? `Back to the recommended ${reset.label}, with the default ${schedule}.` : `Everything back to ${roleDefaultText(role)}, ${schedule} too.`;
89
+ return <>
90
+ {invalid && <Text style={[t.meta, { paddingHorizontal: 16, paddingTop: 10 }]}>Part of the saved setting wasn't valid, so its default is used.</Text>}
143
91
  {!jobs && !r.same && modes.length > 0 && <SettingsSelect label="Permissions" hint="It runs unattended, so pick a mode that doesn't prompt." value={r.mode ?? DEFAULT}
144
92
  options={[{ value: DEFAULT, label: modeDefault ? `Default (${modeLabel(modeDefault)})` : "Default" }, ...modes.map(m => ({ value: m.id, label: modeLabel(m) }))]} disabled={busy}
145
93
  onValueChange={value => set({ mode: value === DEFAULT ? null : value })} />}
@@ -152,9 +100,26 @@ function RoleCard({ r, invalid, catalog, busy, save, theme, compact, toggle }: {
152
100
  {role === "ranker" && <SettingsSelect label="At most per day" value={String(r.dailyCap ?? 24)} disabled={busy}
153
101
  options={withCurrent([6, 12, 24, 48, 96], r.dailyCap ?? 24).map(n => ({ value: String(n), label: String(n) }))}
154
102
  onValueChange={value => set({ dailyCap: Number(value) })} />}
155
- {compact && <View style={{ flexDirection: "row", paddingHorizontal: 8, paddingVertical: 6 }}>{reset}</View>}
156
- </SettingsCard>;
103
+ <View style={{ flexDirection: "row", alignItems: "center", gap: 8, paddingHorizontal: compact ? 14 : 16, paddingVertical: 8, borderTopWidth: 1, borderTopColor: c.border }}>
104
+ <Text style={[t.meta, { flex: 1 }]}>{resetText}</Text>
105
+ <Button theme={theme} compact={compact} kind="ghost" title="Reset to defaults" disabled={busy || (resetDone && !invalid)} onPress={() => save(reset.entry)} />
106
+ </View>
107
+ </>;
157
108
  }
158
109
 
159
110
  const roleDefaultText = (role: AgentRole) => role === "recovery" ? "the main agent's setup" : role === "overseer" ? "Claude, newest Opus" : role === "about" ? "Claude Haiku" : "Claude Sonnet, hourly";
111
+ /** "Not available in Paseo: Claude and Pi (turned off in Paseo); Antigravity (not installed)." Grouped by reason; a
112
+ * provider whose name is also on a ready one isn't listed, so the line never contradicts the rows. */
113
+ function unavailableLine(providers: readonly { label: string; available: boolean; reason: string | null }[]): string | null {
114
+ const ready = new Set(providers.filter(p => p.available).map(p => p.label));
115
+ const groups = new Map<string, string[]>();
116
+ for (const p of providers) if (!p.available && !ready.has(p.label)) {
117
+ // Paseo's reasons can name binaries and PATH; developers here only need "not installed".
118
+ const why = /not found|PATH|not installed/i.test(p.reason ?? "") ? "not installed" : (p.reason ?? "unavailable").replace(/\.$/, "");
119
+ groups.set(why, [...(groups.get(why) ?? []), p.label]);
120
+ }
121
+ if (!groups.size) return null;
122
+ const list = (names: string[]) => names.length < 2 ? names.join("") : `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`;
123
+ return `Not available in Paseo: ${[...groups].map(([why, names]) => `${list(names)} (${why[0].toLowerCase()}${why.slice(1)})`).join("; ")}.`;
124
+ }
160
125
  const withCurrent = (list: number[], value: number) => [...new Set([...list, value])].sort((a, b) => a - b);
@@ -36,19 +36,6 @@ function TrustCount({ theme, inCard = false }: Pick<PluginSurfaceProps, "theme">
36
36
  * The Overseer and AI priority switches, at the top of their cards in Settings → Agents. Same Display preferences as
37
37
  * before (enable_overseer, enable_ranker); only where they show moved.
38
38
  */
39
- export function PreferenceSwitch({ field, theme }: { field: "enable_overseer" | "enable_ranker"; theme: PluginSurfaceProps["theme"] }) {
40
- const settings = useSettings(displayPreferences);
41
- if (settings.status !== "ready") return null;
42
- const copy = field === "enable_overseer"
43
- ? { label: "Run the Overseer", hint: "Off hides its row on Home and stops its digest. An Overseer you already started stays in its workspace; Follow-up never archives it." }
44
- : { label: "Rank with AI", hint: "Ranks Home's Priority sort from Linear, Slack, GitHub and the weekly plan. Read-only; runs hourly on workdays when something changed." };
45
- return <>
46
- <SettingsSwitch label={copy.label} hint={copy.hint} value={settings.values[field]} disabled={settings.saving}
47
- onValueChange={value => void settings.save({ ...settings.values, [field]: value }, settings.revision)} />
48
- {settings.saveError && <Text accessibilityRole="alert" style={{ color: theme.colors.statusDanger, paddingHorizontal: 16, paddingBottom: 8 }}>{settings.saveError}</Text>}
49
- </>;
50
- }
51
-
52
39
  /**
53
40
  * Permissions, in Settings → Following after Defaults: Trust bypass agents and how many prompts it approved.
54
41
  * Same Display preference as before (enable_trust_bypass); only where it shows moved.
@@ -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 }}>