paseo-follow-up 1.4.0-beta.2 → 1.4.0-beta.21

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 (92) hide show
  1. package/OVERVIEW.md +15 -4
  2. package/README.md +59 -6
  3. package/client/about.tsx +22 -12
  4. package/client/agents.tsx +132 -0
  5. package/client/brief.tsx +200 -72
  6. package/client/chat.tsx +12 -4
  7. package/client/display.tsx +62 -11
  8. package/client/header.tsx +40 -19
  9. package/client/home-chrome.tsx +135 -40
  10. package/client/home-list.tsx +90 -35
  11. package/client/home-view.ts +66 -8
  12. package/client/home.tsx +268 -77
  13. package/client/inbox-store.ts +15 -7
  14. package/client/keys.ts +3 -0
  15. package/client/kit.tsx +46 -15
  16. package/client/large.tsx +9 -10
  17. package/client/live.tsx +8 -6
  18. package/client/needs-you.tsx +36 -8
  19. package/client/onboarding.tsx +455 -0
  20. package/client/panel.tsx +98 -23
  21. package/client/pill.tsx +41 -21
  22. package/client/pr-controls.tsx +38 -14
  23. package/client/pr-sheet.tsx +8 -6
  24. package/client/questions.tsx +6 -4
  25. package/client/reviewers.tsx +63 -21
  26. package/client/settings-shell.tsx +77 -0
  27. package/client/settings.tsx +145 -49
  28. package/client/shipping.tsx +186 -0
  29. package/client/spec.tsx +1 -1
  30. package/client/stacks.tsx +4 -3
  31. package/client/tasks.tsx +1 -1
  32. package/client/theme.ts +21 -0
  33. package/client/visibility.ts +7 -0
  34. package/client/workspace-data.ts +37 -0
  35. package/docs/screenshots/decision-card-answered-phone-light.png +0 -0
  36. package/docs/screenshots/decision-card-expanded-chat-light.png +0 -0
  37. package/docs/screenshots/decision-card-partial-phone-dark.png +0 -0
  38. package/docs/screenshots/decision-card-unanswered-phone-dark.png +0 -0
  39. package/index.client.tsx +27 -8
  40. package/index.server.ts +257 -24
  41. package/package.json +5 -3
  42. package/server/about.ts +15 -4
  43. package/server/agent-actions.ts +75 -6
  44. package/server/agent-hook.mjs +54 -16
  45. package/server/agent-parity.ts +149 -0
  46. package/server/agent-settings.ts +124 -0
  47. package/server/ai-jobs.ts +88 -23
  48. package/server/daemon.ts +165 -105
  49. package/server/directory.ts +165 -0
  50. package/server/discovery.ts +34 -6
  51. package/server/engine.ts +31 -9
  52. package/server/etag.ts +14 -0
  53. package/server/github.ts +66 -5
  54. package/server/hook-source.ts +1 -1
  55. package/server/inbox-directory.ts +14 -19
  56. package/server/inbox.ts +28 -1
  57. package/server/mcp-source.ts +1 -1
  58. package/server/mcp.d.mts +3 -1
  59. package/server/mcp.mjs +83 -10
  60. package/server/native-tools.ts +3 -2
  61. package/server/onboarding.ts +101 -0
  62. package/server/overseer-prompt-source.ts +1 -1
  63. package/server/overseer-prompt.md +1 -0
  64. package/server/overseer.ts +72 -8
  65. package/server/pr-actions.ts +91 -15
  66. package/server/pr-workflow.ts +188 -0
  67. package/server/questions.ts +1 -1
  68. package/server/ranker.ts +431 -0
  69. package/server/recovery-config.ts +17 -0
  70. package/server/scopes.ts +20 -8
  71. package/server/tasks.ts +9 -3
  72. package/server/trust-bypass.ts +125 -0
  73. package/shared/about.ts +8 -3
  74. package/shared/activity.ts +3 -1
  75. package/shared/agent-settings.ts +169 -0
  76. package/shared/attention.ts +8 -4
  77. package/shared/brief.ts +44 -0
  78. package/shared/chat.ts +3 -1
  79. package/shared/contracts.ts +42 -4
  80. package/shared/display.ts +16 -1
  81. package/shared/headline.ts +5 -0
  82. package/shared/home.ts +6 -0
  83. package/shared/model.ts +12 -1
  84. package/shared/onboarding.ts +243 -0
  85. package/shared/overseer.ts +10 -2
  86. package/shared/pr-actions.ts +26 -4
  87. package/shared/pr-workflow.ts +133 -0
  88. package/shared/questions.ts +17 -0
  89. package/shared/ranker.ts +237 -0
  90. package/shared/search.ts +25 -5
  91. package/shared/settings-nav.ts +97 -0
  92. package/skills/follow-through/SKILL.md +3 -1
package/client/home.tsx CHANGED
@@ -1,38 +1,46 @@
1
- import { useCallback, useEffect, useMemo, useState, useSyncExternalStore } from "react";
2
- import { Platform, Pressable, ScrollView, Text, TextInput, View } from "react-native";
1
+ import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
2
+ import { browserKey, BROWSER_POLL_MS } from "./keys";
3
+ import { Platform, Pressable, ScrollView, Text, TextInput, useWindowDimensions, View } from "react-native";
3
4
  import { usePaseo, useRpc, type PluginScreenProps } from "@getpaseo/plugin/client";
4
- import { Icon, useToast } from "@getpaseo/plugin/client/ui";
5
+ import { Icon, Modal, useToast } from "@getpaseo/plugin/client/ui";
5
6
  import { useQuery } from "@tanstack/react-query";
6
7
  import { browserStatusRpc, inboxBriefRpc } from "../shared/contracts";
7
8
  import { needsYou } from "../shared/attention";
8
- import { briefPane, followUpLog, lastWorkdayEnd, nextNeeds, paneButtons, sinceLabel, tailSteps, type HomeGroupId, type HomeModel, type LogLine, type TailStep, type Workstream } from "../shared/home";
9
+ import { briefPane, followUpLog, lastWorkdayEnd, nextNeeds, paneButtons, sameText, sinceLabel, tailSteps, type HomeGroupId, type HomeModel, type LogLine, type TailStep, type Workstream } from "../shared/home";
9
10
  import { age, snoozeUntil, type InboxRow } from "../shared/inbox";
10
11
  import { errorText } from "../shared/errors";
11
12
  import { isLoaded, type LoadSignals } from "../shared/agent-load";
12
13
  import { BriefCard, type BriefDeps } from "./brief";
13
14
  import { AboutSection } from "./about";
14
- import { Button, IconButton, text, type Theme } from "./kit";
15
+ import { bottomGap, bottomInset, Button, IconButton, space, text, type Theme } from "./kit";
15
16
  import { NeedsYouList } from "./needs-you";
16
17
  import { PrSheet } from "./pr-sheet";
17
18
  import { QuestionSheet } from "./questions";
18
- import { Age, BadgeView, BRIEF_KEY, glyphColor, HomeList, OVERSEER_KEY, PrChipView, type OverseerRowState } from "./home-list";
19
+ import { Age, BadgeView, BRIEF_KEY, glyphColor, HomeList, OVERSEER_KEY, PrChipView, PrSummaryText, type OverseerRowState } from "./home-list";
19
20
  import { answerLine, overseerRowState } from "../shared/overseer";
21
+ import type { OmniboxItem } from "../shared/search";
20
22
  import { ListTop, SearchField, SortMenu, StatusStrip, UsageMeters, useOmnibox, useSlashToFocus } from "./home-chrome";
21
23
  import { useHomeModel, useTick, type HomeSources } from "./home-data";
22
24
  import { useInbox, UndoBar, useNextRelay } from "./inbox";
23
25
  import { Spinner } from "./motion";
26
+ import { Setup, SetupOffer, useOnboarding } from "./onboarding";
27
+ import type { OnboardingView } from "../shared/onboarding";
24
28
  import { withAlpha, isLight, mergedColor, type Colors } from "./theme";
25
29
 
26
30
  export const HOME_SCREEN = "follow-through";
31
+
27
32
  const mono = Platform.OS === "ios" ? "Menlo" : "ui-monospace, SFMono-Regular, Menlo, monospace";
28
33
 
29
34
  export type HomeDeps = {
30
35
  sources: HomeSources;
31
- openSettings(): void;
36
+ /** Follow-up's settings, on a category when given (the setup flow's deep links). */
37
+ openSettings(category?: string): void;
32
38
  /** Docks the workspace's own panel in its explorer column. */
33
39
  openPanel(workspaceId: string): void;
34
40
  openLog(): void;
35
41
  openHome(): void;
42
+ /** Phones: open one Home item as its own screen, so the host's ← (and Android back) returns to the list. */
43
+ openItem?(key: string): void;
36
44
  briefDeps: BriefDeps;
37
45
  };
38
46
 
@@ -41,6 +49,16 @@ export type HomeDeps = {
41
49
  * With nothing selected the right side is the brief. `?view=log` shows what Follow-up did on its own.
42
50
  */
43
51
  export function FollowHome(props: PluginScreenProps & { deps: HomeDeps }) {
52
+ // Getting started takes Home's place on a fresh install (or after "Set up Follow-up again") until finished or skipped.
53
+ const onboarding = useOnboarding();
54
+ // Opened from "Set up again": read the flow's state afresh.
55
+ const { refetch } = onboarding;
56
+ useEffect(() => { if (props.params?.setup) void refetch(); }, [props.params?.setup, refetch]);
57
+ if (onboarding.data?.show) return <Setup theme={props.theme} compact={props.layout.compact} view={onboarding.data} deps={{ openSettings: props.deps.openSettings }} />;
58
+ return <HomeBody {...props} onboarding={onboarding.data} />;
59
+ }
60
+
61
+ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: OnboardingView | undefined }) {
44
62
  const { theme, layout, navigation, params = {}, deps } = props;
45
63
  const { inbox } = deps.sources;
46
64
  const c = theme.colors;
@@ -49,18 +67,43 @@ export function FollowHome(props: PluginScreenProps & { deps: HomeDeps }) {
49
67
  const omnibox = useOmnibox(model, deps.sources);
50
68
  useSlashToFocus(omnibox, params.view !== "log");
51
69
  const [filter, setFilter] = useState<HomeGroupId | null>(null);
52
- const [selected, setSelected] = useState<string | null>(() => params.select ? `agent:${params.select}` : null);
70
+ const [selected, setSelected] = useState<string | null>(() => params.item ?? (params.select ? `agent:${params.select}` : null));
53
71
  const openAgentRow = useMemo(() => navigation ? (row: InboxRow) => navigation.openAgent({ agentId: row.agentId }) : undefined, [navigation]);
54
72
  useNextRelay(inbox, params, openAgentRow);
55
73
  useEffect(() => { if (params.select) setSelected(`agent:${params.select}`); }, [params.select]);
56
- const onSelect = useCallback((key: string) => setSelected(key === BRIEF_KEY ? null : key), []);
74
+ // Phones show one thing at a time. A row opens its own screen (pushed by the host) instead of swapping in place, so the
75
+ // host's ← is the only back control and it lands on the list. Desktop selects in place beside the list.
76
+ const route = compact && deps.openItem ? deps.openItem : null;
77
+ const onSelect = useCallback((key: string) => { if (route) route(key); else setSelected(key === BRIEF_KEY ? null : key); }, [route]);
57
78
  const current = selected ? model.byKey.get(selected) ?? (selected.startsWith("agent:") ? [...model.byKey.values()].find(x => x.agentId === selected.slice(6)) ?? null : null) : null;
58
79
  const tracked = useSyncExternalStore(deps.sources.live.subscribe, deps.sources.live.version, deps.sources.live.version);
59
80
  const rows = useInbox(inbox, () => inbox.rows());
60
81
  const pane = useMemo(() => briefPane({ model, rows, tracked: deps.sources.live.all(), now: Date.now() }), [model, rows, tracked, deps.sources.live]);
82
+ const rank = useSyncExternalStore(deps.sources.extras.subscribe, deps.sources.extras.rank, deps.sources.extras.rank);
61
83
  const overseerStatus = useSyncExternalStore(deps.sources.extras.subscribe, deps.sources.extras.overseer, deps.sources.extras.overseer);
62
84
  const overseerInbox = useInbox(inbox, () => inbox.overseer());
63
85
  const overseer = overseerRowState(overseerStatus, overseerInbox);
86
+ const toast = useToast();
87
+ // The omnibox's "Ask the Overseer" row: send, then show the conversation it lands in.
88
+ const [asking, setAsking] = useState(false);
89
+ const [pendingAsk, setPendingAsk] = useState<string | null>(null);
90
+ const pick = useCallback(async (item: OmniboxItem) => {
91
+ if (item.ask === undefined) { if (route) route(item.key); else setSelected(item.key); return; }
92
+ if (asking) return;
93
+ setAsking(true);
94
+ // No toast: the conversation opens on the sent words, which says it more plainly.
95
+ try { await deps.sources.extras.askOverseer(item.ask); omnibox.setQuery(""); omnibox.inputRef.current?.blur(); setPendingAsk(item.ask); if (route) route(OVERSEER_KEY); else setSelected(OVERSEER_KEY); inbox.refresh(); }
96
+ catch (e) { toast.error(errorText(e)); } finally { setAsking(false); }
97
+ }, [asking, deps.sources.extras, omnibox, inbox, toast, route]);
98
+ // ⌘K "Follow-up: Ask the Overseer" opens Home with `?ask=<nonce>`: select it and focus its reply box. A param, not
99
+ // shared state, so it works whether Home was already open or mounts fresh.
100
+ const [replyFocus, setReplyFocus] = useState(0);
101
+ useEffect(() => {
102
+ if (!params.ask) return;
103
+ if (overseerStatus && !overseerStatus.enabled) { toast.show("The Overseer is off. Turn it on in Follow-up settings."); return; }
104
+ setSelected(OVERSEER_KEY); setReplyFocus(n => n + 1);
105
+ // eslint-disable-next-line react-hooks/exhaustive-deps
106
+ }, [params.ask]);
64
107
  const briefLine = [pane.counts.needs ? `${pane.counts.needs} need you` : "Nothing needs you", pane.counts.fixing ? `${pane.counts.fixing} being fixed` : "", pane.away.count ? `${pane.away.count} done while away` : ""].filter(Boolean).join(" · ");
65
108
 
66
109
  const openFull = useCallback((s: Workstream) => {
@@ -78,26 +121,42 @@ export function FollowHome(props: PluginScreenProps & { deps: HomeDeps }) {
78
121
  if (params.view === "log") return <LogView theme={theme} compact={compact} sources={deps.sources} onHome={deps.openHome} onOpen={key => { setSelected(key); deps.openHome(); }} />;
79
122
 
80
123
  const detail = selected === OVERSEER_KEY && overseer
81
- ? <OverseerPane theme={theme} compact={compact} o={overseer} agentId={overseerStatus?.agentId ?? null} deps={deps} navigation={navigation} onBack={compact ? () => setSelected(null) : undefined} />
124
+ ? <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} />
82
125
  : current
83
- ? <DetailPane key={current.key} s={current} model={model} theme={theme} compact={compact} deps={deps} openFull={openFull} signOffNext={signOffNext} onBack={compact ? () => setSelected(null) : undefined} />
84
- : <BriefPane theme={theme} compact={compact} pane={pane} onSelect={key => setSelected(key)} openLog={deps.openLog} sources={deps.sources} />;
126
+ ? <DetailPane key={current.key} s={current} model={model} theme={theme} compact={compact} deps={deps} openFull={openFull} signOffNext={signOffNext} onBack={compact && !route ? () => setSelected(null) : undefined} />
127
+ : <BriefPane theme={theme} compact={compact} pane={pane} onSelect={key => route ? route(key) : setSelected(key)} openLog={deps.openLog} sources={deps.sources} />;
128
+ // Nothing followed at all: no sort, no meters, just the empty state and its action.
129
+ const nothing = model.groups.every(g => !g.items.length);
85
130
  const list = <HomeList model={model} theme={theme} dense={compact} touch={compact} selectedKey={selected} onSelect={onSelect} briefLine={briefLine}
86
- results={omnibox.results} activeResult={omnibox.active} onResult={item => setSelected(item.key)} filter={filter} overseer={overseer}
87
- top={<ListTop theme={theme} dense={compact} title={<ListHeader theme={theme} compact={compact} onSettings={deps.openSettings} />}>
131
+ results={omnibox.results} activeResult={omnibox.active} onResult={item => void pick(item)} filter={filter} overseer={overseer} asking={asking}
132
+ // Phones: the host header already says Follow-up, so no "Home" title row; search, sort and settings share one row and
133
+ // the meters move to the end of the list.
134
+ footer={compact ? <View style={{ paddingTop: 16, paddingBottom: 96 }}>{!omnibox.results && !nothing && <UsageMeters theme={theme} sources={deps.sources} dense />}</View> : undefined}
135
+ // Phones: the setup offer goes after the Needs-you group when there is one, so the first ask stays high.
136
+ afterNeeds={compact && model.needs > 0 ? <SetupOffer theme={theme} compact view={props.onboarding} /> : undefined}
137
+ emptyAction={compact ? <Button theme={theme} compact kind="secondary" icon="Settings" title="Project settings" onPress={deps.openSettings} /> : undefined}
138
+ top={<ListTop theme={theme} dense={compact} title={compact ? undefined : <ListHeader theme={theme} compact={compact} onSettings={deps.openSettings} />}>
88
139
  {/* zIndex: on web every View is its own stacking context, so the sort menu only paints and hit-tests above the
89
140
  strip and meters below if this row sits above them. */}
90
- <View style={{ zIndex: 2, flexDirection: "row", alignItems: "center", gap: 6, paddingHorizontal: compact ? 12 : 16 }}>
91
- <SearchField theme={theme} omnibox={omnibox} dense={compact} onEnter={item => setSelected(item.key)} />
92
- <SortMenu theme={theme} mode={model.sort} onChange={deps.sources.extras.setSort} rankedAt={model.rankedAt} touch={compact} />
141
+ <View style={{ zIndex: 2, flexDirection: "row", alignItems: "center", gap: compact ? 2 : 6, paddingLeft: compact ? 16 : 16, paddingRight: compact ? 6 : 16 }}>
142
+ <SearchField theme={theme} omnibox={omnibox} dense={compact} onEnter={item => void pick(item)} />
143
+ {!(compact && nothing) && <SortMenu theme={theme} mode={model.sort} onChange={deps.sources.extras.setSort} rankedAt={model.rankedAt} touch={compact} rank={rank} onRerank={deps.sources.extras.rankNow} />}
144
+ {compact && <IconButton theme={theme} compact icon="Settings" label="Follow-up settings" onPress={deps.openSettings} />}
93
145
  </View>
94
- {!omnibox.results && <StatusStrip theme={theme} model={model} filter={filter} onFilter={setFilter} touch={compact} dense={compact} />}
95
- {!omnibox.results && <UsageMeters theme={theme} sources={deps.sources} dense={compact} />}
96
- </ListTop>} />;
146
+ {!compact && !omnibox.results && <StatusStrip theme={theme} model={model} filter={filter} onFilter={setFilter} touch={compact} dense={compact} />}
147
+ {!compact && !omnibox.results && <UsageMeters theme={theme} sources={deps.sources} dense={compact} />}
148
+ {!compact && !omnibox.results && <SetupOffer theme={theme} compact={compact} view={props.onboarding} />}
149
+ </ListTop>}
150
+ // Phones: only the search row stays pinned; the status chips and the setup offer scroll away with the list, so a
151
+ // scrolled list keeps the screen instead of sitting under a 250px block.
152
+ header={compact && !omnibox.results ? <View style={{ gap: 8, paddingTop: 6, paddingBottom: 6 }}>
153
+ <StatusStrip theme={theme} model={model} filter={filter} onFilter={setFilter} touch dense />
154
+ {model.needs === 0 && <SetupOffer theme={theme} compact view={props.onboarding} />}
155
+ </View> : undefined} />;
97
156
 
98
157
  if (compact) return <View style={{ flex: 1, backgroundColor: c.surface0 }}>
99
- {current || selected === OVERSEER_KEY && overseer ? detail : list}
100
- <View style={{ position: "absolute", left: 12, right: 12, bottom: 12 }}><UndoBar store={inbox} theme={theme} touch /></View>
158
+ {current || selected === OVERSEER_KEY && overseer || selected === BRIEF_KEY ? detail : list}
159
+ <View style={{ position: "absolute", left: 12, right: 12, bottom: bottomGap(true) + (current || selected === OVERSEER_KEY ? 132 : 0) }}><UndoBar store={inbox} theme={theme} touch /></View>
101
160
  </View>;
102
161
  return <View style={{ flex: 1, flexDirection: "row", backgroundColor: c.surface0 }}>
103
162
  <View style={{ flex: 1, minWidth: 0, borderRightWidth: 1, borderRightColor: c.border }}>
@@ -180,7 +239,7 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, onB
180
239
  s: Workstream; model: HomeModel; theme: Theme; compact: boolean; deps: HomeDeps;
181
240
  openFull: (s: Workstream) => void; signOffNext: (s: Workstream) => void; onBack?: () => void;
182
241
  }) {
183
- const c = theme.colors; const t = text(c);
242
+ const c = theme.colors; const t = text(c, compact);
184
243
  const toast = useToast();
185
244
  const { inbox, live } = deps.sources;
186
245
  const row = useInbox(inbox, () => s.agentId ? inbox.rows().find(r => r.agentId === s.agentId) ?? null : null);
@@ -191,12 +250,19 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, onB
191
250
  const tail = useTail(agent.handle, `${row?.seq ?? 0}:${agent.status ?? ""}`);
192
251
  const browserRead = useRpc(browserStatusRpc);
193
252
  const [sheet, setSheet] = useState<{ key: string; intent: "merge" | "reviewers" } | null>(null);
194
- const browser = useQuery({ queryKey: ["follow-through", "browser"], queryFn: () => browserRead({}), refetchInterval: 5000, enabled: !!sheet });
253
+ const browser = useQuery({ queryKey: browserKey, queryFn: () => browserRead({}), refetchInterval: BROWSER_POLL_MS, enabled: !!sheet });
195
254
  const [question, setQuestion] = useState<string | null>(null);
196
255
  const [laterOpen, setLaterOpen] = useState(false);
197
256
  const [busy, setBusy] = useState<string | null>(null);
198
257
  const b = brief.data?.brief?.state === "open" ? brief.data.brief : null;
199
- const items = w ? needsYou(w).map(i => i.kind) : [];
258
+ const asks = w ? needsYou(w) : [];
259
+ const items = asks.map(i => i.kind);
260
+ // Say it once: when a Needs-you row already carries the row's line (a question's title or detail), skip the headline.
261
+ const echoed = !!s.line && asks.some(i => sameText(i.title, s.line) || ("detail" in i && sameText(i.detail, s.line)));
262
+ // Phones: one primary per screen. An actionable Needs-you item (Answer, Merge…) outranks Sign off.
263
+ const itemFirst = compact && asks.length > 0;
264
+ const [laterSheet, setLaterSheet] = useState(false);
265
+ const [typing, setTyping] = useState(false);
200
266
  const flagged = !!row?.needs && !row.snooze;
201
267
  const plan = paneButtons({ permissions: agent.permissions.length, decisions: !!b?.decisions.some(d => d.options.length), items, flagged, hasAgent: !!s.agentId });
202
268
  const run = async (key: string, work: () => Promise<unknown>, done?: string) => {
@@ -205,9 +271,24 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, onB
205
271
  };
206
272
  const respond = (p: Permission, response: { behavior: "allow" | "deny"; selectedActionId?: string; message?: string }) =>
207
273
  run(`perm:${p.id}`, () => agent.handle!.respondToPermission({ requestId: p.id, response: response as never }), response.behavior === "allow" ? "Allowed" : "Denied");
208
- const color = glyphColor(s, c);
274
+ const color = glyphColor(s, c, compact);
209
275
 
210
- const header = <View style={{ paddingHorizontal: compact ? 16 : 20, paddingTop: 12, paddingBottom: 12, gap: 6, borderBottomWidth: 1, borderBottomColor: c.border }}>
276
+ const ago = s.at ? age(s.at, Date.now()) : "";
277
+ const metaRest = [ago === "now" ? "just now" : ago, s.project].filter(Boolean).join(" · ");
278
+ // Phones: the host header already says Follow-up and carries ←. The pane head is the full-width title, then one meta
279
+ // line (state, age, project, PRs as text) that ellipsizes instead of wrapping, with Open full as an icon at its end.
280
+ const header = compact ? <View style={{ paddingHorizontal: 16, paddingTop: 10, paddingBottom: 6, gap: 2, borderBottomWidth: 1, borderBottomColor: c.border }}>
281
+ <Text accessibilityRole="header" numberOfLines={3} style={t.title}>{s.title}</Text>
282
+ <View style={{ flexDirection: "row", alignItems: "center", gap: 6, minHeight: 44 }}>
283
+ <Icon name={s.icon} size={14} color={color} />
284
+ <Text numberOfLines={1} style={[t.meta, { flex: 1, minWidth: 0 }]}>
285
+ {!!s.word && <Text style={{ color, fontWeight: "600" }}>{s.word}</Text>}
286
+ {metaRest ? (s.word ? ` · ${metaRest}` : metaRest) : ""}
287
+ <PrSummaryText s={s} c={c} lead=" · " />
288
+ </Text>
289
+ <IconButton theme={theme} compact icon="PanelRightOpen" label="Open full" onPress={() => openFull(s)} />
290
+ </View>
291
+ </View> : <View style={{ paddingHorizontal: 20, paddingTop: 12, paddingBottom: 12, gap: 6, borderBottomWidth: 1, borderBottomColor: c.border }}>
211
292
  <View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
212
293
  {onBack && <IconButton theme={theme} compact icon="ChevronLeft" label="Back to Home" onPress={onBack} />}
213
294
  <Icon name={s.icon} size={16} color={color} />
@@ -222,7 +303,8 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, onB
222
303
  </View>
223
304
  </View>;
224
305
 
225
- const actionBar = (plan.buttons.includes("sign_off") || plan.buttons.includes("later")) && <View style={{ gap: 8 }}>
306
+ const canMove = plan.buttons.includes("sign_off") || plan.buttons.includes("later");
307
+ const actionBar = !compact && (plan.buttons.includes("sign_off") || plan.buttons.includes("later")) && <View style={{ gap: 8 }}>
226
308
  <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8 }}>
227
309
  <Button theme={theme} compact={compact} kind={plan.primary === "sign_off" ? "primary" : "secondary"} icon="Check" title="Sign off" loading={busy === "sign_off"}
228
310
  onPress={() => void run("sign_off", () => inbox.signOff([s.agentId!]))} />
@@ -235,36 +317,72 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, onB
235
317
  </View>}
236
318
  </View>;
237
319
 
320
+ const laterTimes = [["hour", "In 1 hour"], ["tonight", "Tonight 18:00"], ["tomorrow", "Tomorrow 09:00"], ["next-event", "Next event"]] as const;
321
+ // Phones: the moves sit in the dock above the composer, in thumb reach, on one row: Sign off, Sign off & next, Later.
322
+ const narrow = useWindowDimensions().width < 380;
323
+ const moves = compact && canMove && !typing && <View style={{ flexDirection: "row", gap: 8, paddingHorizontal: 12, paddingTop: 10 }}>
324
+ <View style={{ flex: 1 }}><Button theme={theme} compact grow kind={plan.primary === "sign_off" && !itemFirst ? "primary" : "secondary"} icon={narrow ? undefined : "Check"} title="Sign off" loading={busy === "sign_off"}
325
+ onPress={() => void run("sign_off", () => inbox.signOff([s.agentId!]))} /></View>
326
+ <View style={{ flex: 1.3 }}><Button theme={theme} compact grow icon={narrow ? undefined : "ArrowRight"} title="Sign off & next" onPress={() => signOffNext(s)} /></View>
327
+ <IconButton theme={theme} compact icon="AlarmClock" label="Later…" onPress={() => setLaterSheet(true)} />
328
+ </View>;
329
+ const laterModal = compact && <Modal title="Remind me later" open={laterSheet} onOpenChange={setLaterSheet}>
330
+ <Modal.Content contentContainerStyle={{ paddingVertical: 8 }}>
331
+ {laterTimes.map(([k, label]) => <Pressable key={k} accessibilityRole="button" onPress={() => { setLaterSheet(false); void inbox.snooze([s.agentId!], snoozeUntil(k, new Date())); }}
332
+ style={({ pressed }) => ({ minHeight: 48, justifyContent: "center", paddingHorizontal: 16, backgroundColor: pressed ? c.surface2 : "transparent" })}>
333
+ <Text style={t.body}>{label}</Text>
334
+ </Pressable>)}
335
+ </Modal.Content>
336
+ </Modal>;
337
+
338
+ const steps = s.agentId && <View style={{ gap: 8 }}>
339
+ {/* Phones: an unloaded agent is one row, label and why on the left, a quiet Load on the right. */}
340
+ {compact && tail.asleep && !tail.steps?.length && !tail.error ? <View style={{ flexDirection: "row", alignItems: "center", gap: 10, minHeight: 48 }}>
341
+ <Icon name="History" size={16} color={c.foregroundMuted} />
342
+ <View style={{ flex: 1, minWidth: 0 }}>
343
+ <Text style={t.label}>Recent steps</Text>
344
+ <Text style={t.meta}>{tail.seenAt ? `Last seen ${age(new Date(tail.seenAt).toISOString(), Date.now())} ago. ` : ""}Not loaded. Loading keeps it in memory for about an hour.</Text>
345
+ </View>
346
+ <Button theme={theme} compact kind="ghost" title={tail.loading ? "Loading…" : "Load"} accessibilityLabel="Load recent steps" accessibilityHint="Loads the agent into memory for about an hour" loading={tail.loading} disabled={tail.loading} onPress={tail.load} />
347
+ </View> : <>
348
+ <Text style={compact ? t.section : [t.small, { fontWeight: "600", letterSpacing: 0.5, textTransform: "uppercase" }]}>{tail.asleep && tail.seenAt ? `Last seen · ${age(new Date(tail.seenAt).toISOString(), Date.now()) === "now" ? "just now" : `${age(new Date(tail.seenAt).toISOString(), Date.now())} ago`}` : tail.steps?.length ? `Recent · last ${tail.steps.length} steps` : "Recent steps"}</Text>
349
+ {!!tail.error && <Text style={t.meta}>{`Couldn't load the agent's steps: ${tail.error}`}</Text>}
350
+ {tail.steps === null ? <Spinner color={c.foregroundMuted} size={12} label="Loading the agent's steps" />
351
+ : tail.steps.length === 0 ? (tail.error ? null : <Text style={t.meta}>{tail.asleep ? "This agent isn't loaded, so its steps aren't shown." : "No steps yet."}</Text>)
352
+ : tail.steps.map((step, i) => <Step key={i} step={step} c={c} last={i === tail.steps!.length - 1} />)}
353
+ {(tail.asleep || (tail.woken && tail.loading)) && <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8 }}>
354
+ <Button theme={theme} compact={compact} kind="secondary" title={tail.loading ? "Loading…" : "Load recent steps"} loading={tail.loading} disabled={tail.loading} onPress={tail.load} />
355
+ <Text style={[t.small, { flex: 1, minWidth: 160 }]}>Loads the agent into memory for about an hour.</Text>
356
+ </View>}
357
+ {!compact && !!tail.steps?.length && <Text style={t.small}>A preview, not the whole session. Open full for the chat.</Text>}
358
+ </>}
359
+ </View>;
360
+ // "No ask stated" only repeats the chat; the panel already hides it, and on a phone it's dead weight above the ask.
361
+ const showBrief = b && s.agentId && !(b.kind === "permission" && agent.permissions.length) && !(compact && b.source === "none");
362
+
238
363
  return <View style={{ flex: 1, backgroundColor: c.surface0 }}>
239
364
  {header}
240
365
  <ScrollView style={{ flex: 1 }} contentContainerStyle={{ padding: compact ? 16 : 20, gap: 16, paddingBottom: 24 }} keyboardShouldPersistTaps="handled">
241
- {!compact && s.workspaceId && w && <AboutSection key={s.workspaceId} workspaceId={s.workspaceId} theme={theme} compact={compact} flush />}
366
+ {/* What's this about? comes first on every size, directly under the header and above the ask. */}
367
+ {s.workspaceId && w && <AboutSection key={s.workspaceId} workspaceId={s.workspaceId} theme={theme} compact={compact} flush />}
242
368
  {agent.permissions.map(p => <PermissionBlock key={p.id} p={p} theme={theme} compact={compact} busy={busy === `perm:${p.id}`} primary={plan.primary === "allow"} onRespond={r => void respond(p, r)} />)}
243
- {b && s.agentId && !(b.kind === "permission" && agent.permissions.length) ? <BriefCard {...({ embedded: true, item: { data: b }, theme, layout: { compact }, agentId: s.agentId, deps: deps.briefDeps } as unknown as Parameters<typeof BriefCard>[0])} />
244
- : row?.needs && !agent.permissions.length && !b ? <Text style={[t.body, { fontSize: 15, lineHeight: 21, fontWeight: "600" }]}>{s.line || s.word || "Needs you"}</Text>
369
+ {showBrief ? <BriefCard {...({ embedded: true, item: { data: b }, theme, layout: { compact }, agentId: s.agentId, deps: deps.briefDeps } as unknown as Parameters<typeof BriefCard>[0])} />
370
+ : echoed || (b && compact && b.source === "none" && asks.length) ? null
371
+ : row?.needs && !agent.permissions.length && !b ? <Text style={compact ? t.ask : [t.body, { fontSize: 15, lineHeight: 21, fontWeight: "600" }]}>{s.line || s.word || "Needs you"}</Text>
245
372
  : !row?.needs && s.line ? <Text style={t.body}>{s.line}</Text> : null}
246
- {w && <NeedsYouList workspace={w} theme={theme} compact={compact} flush skip={b?.decisions.length ? ["question"] : []}
373
+ {w && <NeedsYouList workspace={w} theme={theme} compact={compact} flush skip={b?.decisions.length ? ["question"] : []} feature={compact}
247
374
  actions={{ openPr: (key, intent) => setSheet({ key, intent }), openQuestion: setQuestion, openAgent: () => openFull(s) }} />}
248
375
  {actionBar}
249
- {/* On a phone the ask and its moves come first; the reminder sits under them. */}
250
- {compact && s.workspaceId && w && <AboutSection key={s.workspaceId} workspaceId={s.workspaceId} theme={theme} compact={compact} flush />}
251
- {s.agentId && <View style={{ gap: 8 }}>
252
- <Text style={[t.small, { fontWeight: "600", letterSpacing: 0.5, textTransform: "uppercase" }]}>{tail.asleep && tail.seenAt ? `Last seen · ${age(new Date(tail.seenAt).toISOString(), Date.now()) === "now" ? "just now" : `${age(new Date(tail.seenAt).toISOString(), Date.now())} ago`}` : tail.steps?.length ? `Recent · last ${tail.steps.length} steps` : "Recent steps"}</Text>
253
- {!!tail.error && <Text style={t.meta}>{`Couldn't load the agent's steps: ${tail.error}`}</Text>}
254
- {tail.steps === null ? <Spinner color={c.foregroundMuted} size={12} label="Loading the agent's steps" />
255
- : tail.steps.length === 0 ? (tail.error ? null : <Text style={t.meta}>{tail.asleep ? "This agent isn't loaded, so its steps aren't shown." : "No steps yet."}</Text>)
256
- : tail.steps.map((step, i) => <Step key={i} step={step} c={c} last={i === tail.steps!.length - 1} />)}
257
- {(tail.asleep || (tail.woken && tail.loading)) && <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8 }}>
258
- <Button theme={theme} compact={compact} kind="secondary" title={tail.loading ? "Loading…" : "Load recent steps"} loading={tail.loading} disabled={tail.loading} onPress={tail.load} />
259
- <Text style={[t.small, { flex: 1, minWidth: 160 }]}>Loads the agent into memory for about an hour.</Text>
260
- </View>}
261
- {!!tail.steps?.length && <Text style={t.small}>A preview, not the whole session. Open full for the chat.</Text>}
262
- </View>}
376
+ {steps}
263
377
  </ScrollView>
264
- {s.agentId && <ReplyBox theme={theme} compact={compact} agentName={s.title} onSend={async text => {
265
- await agent.handle!.send(text);
266
- inbox.refresh();
267
- }} />}
378
+ {s.agentId && <View style={[{ borderTopWidth: 1, borderTopColor: c.border, backgroundColor: c.surface0 }, bottomInset(compact)]}>
379
+ {moves}
380
+ <ReplyBox theme={theme} compact={compact} agentName={s.title} placeholder={compact ? "Reply to the agent" : undefined} onFocusChange={setTyping} onSend={async text => {
381
+ await agent.handle!.send(text);
382
+ inbox.refresh();
383
+ }} />
384
+ </View>}
385
+ {laterModal}
268
386
  {w && sheet && <PrSheet workspace={w} prKey={sheet.key} intent={sheet.intent} theme={theme} compact={compact} browserReady={browser.data?.ready ?? false} onClose={() => setSheet(null)} />}
269
387
  {w && <QuestionSheet workspace={w} questionId={question} theme={theme} compact={compact} onClose={() => setQuestion(null)} />}
270
388
  </View>;
@@ -274,8 +392,8 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, onB
274
392
  * The Overseer's conversation on Home (1.4.0-beta.0): the tail and a reply box, like any agent's detail pane, plus its
275
393
  * decision card when it asks which agent should get a task. Before the first start, one Start button.
276
394
  */
277
- function OverseerPane({ theme, compact, o, agentId, deps, navigation, onBack }: { theme: Theme; compact: boolean; o: OverseerRowState; agentId: string | null; deps: HomeDeps; navigation: PluginScreenProps["navigation"]; onBack?: () => void }) {
278
- const c = theme.colors; const t = text(c);
395
+ function OverseerPane({ theme, compact, o, focus = 0, pending = null, agentId, model, restartWith, configured, deps, navigation, onBack }: { theme: Theme; compact: boolean; o: OverseerRowState; focus?: number; pending?: string | null; agentId: string | null; model: string | null; restartWith: string | null; configured: string | null; deps: HomeDeps; navigation: PluginScreenProps["navigation"]; onBack?: () => void }) {
396
+ const c = theme.colors; const t = text(c, compact);
279
397
  const toast = useToast();
280
398
  const { inbox, extras } = deps.sources;
281
399
  const row = useInbox(inbox, () => inbox.overseer());
@@ -285,26 +403,52 @@ function OverseerPane({ theme, compact, o, agentId, deps, navigation, onBack }:
285
403
  const brief = useQuery({ queryKey: ["follow-through", "overseer-brief", agentId, row?.seq ?? 0], queryFn: () => readBrief({ agentId: agentId! }), enabled: !!agentId && !!row?.brief });
286
404
  const b = brief.data?.brief?.state === "open" ? brief.data.brief : null;
287
405
  const [starting, setStarting] = useState(false);
406
+ const [restarting, setRestarting] = useState(false);
407
+ const restart = async () => {
408
+ if (restarting) return; setRestarting(true);
409
+ try { const next = await extras.restartOverseer(); toast.show(`The Overseer now runs on ${next?.model ?? restartWith}; its recent conversation was handed over`, { variant: "success" }); } catch (e) { toast.error(errorText(e)); } finally { setRestarting(false); }
410
+ };
288
411
  const start = async () => {
289
412
  if (starting) return; setStarting(true);
290
413
  try { await extras.startOverseer(); toast.show("The Overseer is ready", { variant: "success" }); } catch (e) { toast.error(errorText(e)); } finally { setStarting(false); }
291
414
  };
292
- const header = <View style={{ paddingHorizontal: compact ? 16 : 20, paddingTop: 12, paddingBottom: 12, gap: 4, borderBottomWidth: 1, borderBottomColor: c.border }}>
415
+ const restartRow = agentId && restartWith && (compact
416
+ // Phones: one row, the why on the left and a short Restart on the right; the full target is the a11y label.
417
+ ? <View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
418
+ <Text numberOfLines={2} style={[t.meta, { flex: 1, minWidth: 0 }]}>{`Settings say ${short(restartWith)}`}</Text>
419
+ <Button theme={theme} compact icon="RefreshCw" title="Restart" accessibilityLabel={`Restart with ${short(restartWith)}`} accessibilityHint={`Starts a new Overseer on ${restartWith} and hands it the recent conversation`} loading={restarting} onPress={() => void restart()} />
420
+ </View>
421
+ : <View style={{ flexDirection: "row", alignItems: "center", gap: 8, flexWrap: "wrap", paddingTop: 6 }}>
422
+ <Text style={[t.meta, { flex: 1, minWidth: 180 }]}>{`Running ${model ?? "its first model"} · Settings say ${restartWith}`}</Text>
423
+ <Button theme={theme} compact={compact} icon="RefreshCw" title={`Restart with ${short(restartWith)}`} accessibilityHint={`Starts a new Overseer on ${restartWith} and hands it the recent conversation`} loading={restarting} onPress={() => void restart()} />
424
+ </View>);
425
+ const header = compact ? <View style={{ paddingHorizontal: 16, paddingTop: 10, paddingBottom: 6, gap: 2, borderBottomWidth: 1, borderBottomColor: c.border }}>
426
+ <Text accessibilityRole="header" style={t.title}>Overseer</Text>
427
+ <View style={{ flexDirection: "row", alignItems: "center", gap: 6, minHeight: 44 }}>
428
+ <Icon name="MessagesSquare" size={14} color={c.foregroundMuted} />
429
+ <Text numberOfLines={1} style={[t.meta, { flex: 1, minWidth: 0 }]}>{model ?? configured ?? "Not started"}</Text>
430
+ {agentId && navigation && <IconButton theme={theme} compact icon="PanelRightOpen" label="Open full" onPress={() => navigation.openAgent({ agentId })} />}
431
+ </View>
432
+ {restartRow}
433
+ </View> : <View style={{ paddingHorizontal: 20, paddingTop: 12, paddingBottom: 12, gap: 4, borderBottomWidth: 1, borderBottomColor: c.border }}>
293
434
  <View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
294
435
  {onBack && <IconButton theme={theme} compact icon="ChevronLeft" label="Back to Home" onPress={onBack} />}
295
436
  <Icon name="MessagesSquare" size={16} color={c.foreground} />
296
- <Text accessibilityRole="header" style={[t.title, { flex: 1, fontSize: 16 }]}>Overseer</Text>
437
+ <Text accessibilityRole="header" style={[t.title, { fontSize: 16 }]}>Overseer</Text>
438
+ <Text numberOfLines={1} style={[t.meta, { flex: 1, minWidth: 0 }]}>{model ?? ""}</Text>
297
439
  {agentId && navigation && (compact
298
440
  ? <IconButton theme={theme} compact icon="PanelRightOpen" label="Open full" onPress={() => navigation.openAgent({ agentId })} />
299
441
  : <Button theme={theme} icon="PanelRightOpen" title="Open full" accessibilityHint="Opens the Overseer's whole chat" onPress={() => navigation.openAgent({ agentId })} />)}
300
442
  </View>
443
+ {/* Settings → Agents changed: offered, never done mid-conversation on its own. */}
444
+ {restartRow}
301
445
  </View>;
302
446
  if (o.state === "start") return <View style={{ flex: 1, backgroundColor: c.surface0 }}>
303
447
  {header}
304
448
  <ScrollView contentContainerStyle={{ padding: compact ? 16 : 20, gap: 12 }}>
305
- <Text style={[t.body, { fontSize: 15, lineHeight: 22 }]}>One Claude agent that knows every workspace's state. Tell it "the PRs look good, assign reviewers on all" or "tell the SCIM agent to use option B", and it finds the right agent and passes it on.</Text>
306
- <Text style={t.meta}>It never merges, posts to people or archives. It starts a new workspace only when you say so. It runs on Opus in its own workspace, which stays off your lists.</Text>
307
- <View style={{ flexDirection: "row" }}><Button theme={theme} compact={compact} kind="primary" icon="Play" title="Start the Overseer" loading={starting} onPress={() => void start()} /></View>
449
+ <Text style={compact ? t.body : [t.body, { fontSize: 15, lineHeight: 22 }]}>One agent that knows every workspace's state. Tell it "the PRs look good, assign reviewers on all" or "tell the SCIM agent to use option B", and it finds the right agent and passes it on.</Text>
450
+ <Text style={t.meta}>It never merges, posts to people or archives. It starts a new workspace only when you say so.{compact ? " It works in its own workspace, which stays off your lists." : ` It runs on ${configured ?? "Claude · Newest Opus"} in its own workspace, which stays off your lists.`} Change the model in Follow-up settings → Agents.</Text>
451
+ <View style={{ flexDirection: "row" }}><Button theme={theme} compact={compact} grow={compact} kind="primary" icon="Play" title="Start the Overseer" loading={starting} onPress={() => void start()} /></View>
308
452
  </ScrollView>
309
453
  </View>;
310
454
  return <View style={{ flex: 1, backgroundColor: c.surface0 }}>
@@ -314,15 +458,22 @@ function OverseerPane({ theme, compact, o, agentId, deps, navigation, onBack }:
314
458
  {tail.steps === null ? <Spinner color={c.foregroundMuted} size={12} label="Loading the conversation" />
315
459
  : tail.steps.length === 0 ? <Text style={t.meta}>{tail.error ? `Couldn't load the conversation: ${tail.error}` : "Nothing yet. Ask it what needs you, or give it a task for one of your agents."}</Text>
316
460
  : tail.steps.map((step, i) => <Step key={i} step={step} c={c} last={i === tail.steps!.length - 1} />)}
317
- {o.state === "running" && <Spinner color={c.foregroundMuted} size={12} label="The Overseer is working" />}
461
+ {/* An ask just sent from the omnibox, until the conversation shows it. */}
462
+ {pending && tail.steps && !tail.steps.some(x => x.kind === "you" && x.text.trim() === pending) && <Step step={{ kind: "you", text: pending }} c={c} last={false} />}
463
+ {(o.state === "running" || pending && tail.steps && !tail.steps.some(x => x.kind === "you" && x.text.trim() === pending)) && <Spinner color={c.foregroundMuted} size={12} label="The Overseer is working" />}
318
464
  {/* Its open ask, after the conversation that led to it. Only something Tom can act on; never "No ask stated". */}
319
465
  {b && agentId && (b.kind === "decision" && b.decisions.some(d => d.options.length) || b.kind === "action") ? <BriefCard {...({ embedded: true, item: { data: b }, theme, layout: { compact }, agentId, deps: deps.briefDeps } as unknown as Parameters<typeof BriefCard>[0])} /> : null}
320
466
  </ScrollView>
321
- {agentId && <ReplyBox theme={theme} compact={compact} agentName="the Overseer" placeholder="Ask or give a task: “assign reviewers on all ready PRs”" hint={null}
322
- onSend={async message => { await agent.handle!.send(message); inbox.refresh(); }} />}
467
+ {agentId && <View style={[{ borderTopWidth: 1, borderTopColor: c.border }, bottomInset(compact)]}>
468
+ <ReplyBox theme={theme} compact={compact} agentName="the Overseer" placeholder={compact ? "Ask or give a task" : "Ask or give a task: “assign reviewers on all ready PRs”"} hint={null} focus={focus}
469
+ onSend={async message => { await agent.handle!.send(message); inbox.refresh(); }} />
470
+ </View>}
323
471
  </View>;
324
472
  }
325
473
 
474
+ /** "Codex · GPT-6-Luna · low" → "GPT-6-Luna · low": the button already says it's the Overseer's provider change. */
475
+ const short = (summary: string) => summary.split(" · ").slice(1).join(" · ") || summary;
476
+
326
477
  function Step({ step, c, last }: { step: TailStep; c: Colors; last: boolean }) {
327
478
  const t = text(c);
328
479
  if (step.kind === "tool") return <View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
@@ -343,7 +494,7 @@ function permissionText(p: Permission): string {
343
494
  }
344
495
 
345
496
  function PermissionBlock({ p, theme, compact, busy, primary, onRespond }: { p: Permission; theme: Theme; compact: boolean; busy: boolean; primary: boolean; onRespond: (r: { behavior: "allow" | "deny"; selectedActionId?: string; message?: string }) => void }) {
346
- const c = theme.colors; const t = text(c);
497
+ const c = theme.colors; const t = text(c, compact);
347
498
  const command = permissionText(p);
348
499
  // Provider-defined choices ("Always for this session") show as extra secondaries; Allow and Deny always exist.
349
500
  const extra = (p.actions ?? []).filter(a => !/^(allow|deny|reject)$/i.test(a.label.trim()));
@@ -353,18 +504,38 @@ function PermissionBlock({ p, theme, compact, busy, primary, onRespond }: { p: P
353
504
  <Text style={[t.label, { color: c.statusWarning, flex: 1 }]}>{p.title || `Wants to use ${p.name}`}</Text>
354
505
  </View>
355
506
  {!!command && <View style={{ padding: 10, borderRadius: 7, backgroundColor: c.surface0 }}><Text selectable style={[t.body, { fontFamily: mono }]}>{command}</Text></View>}
356
- <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8 }}>
507
+ {compact ? <>
508
+ <Text style={t.meta}>Allow runs it once. Deny stops it; reply below with what to do instead.</Text>
509
+ {extra.map(a => <Button key={a.id} theme={theme} compact grow title={a.label} disabled={busy} onPress={() => onRespond({ behavior: a.behavior, selectedActionId: a.id })} />)}
510
+ <View style={{ flexDirection: "row", gap: 8 }}>
511
+ <View style={{ flex: 1 }}><Button theme={theme} compact grow title="Deny" disabled={busy} onPress={() => onRespond({ behavior: "deny" })} /></View>
512
+ <View style={{ flex: 1 }}><Button theme={theme} compact grow kind={primary ? "primary" : "secondary"} icon="Check" title="Allow" loading={busy} onPress={() => onRespond({ behavior: "allow" })} /></View>
513
+ </View>
514
+ </> : <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8 }}>
357
515
  <Text style={[t.meta, { flex: 1, minWidth: 180 }]}>Allow runs it once. Deny stops it; write below what to do instead.</Text>
358
516
  <Button theme={theme} compact={compact} title="Deny" disabled={busy} onPress={() => onRespond({ behavior: "deny" })} />
359
517
  {extra.map(a => <Button key={a.id} theme={theme} compact={compact} title={a.label} disabled={busy} onPress={() => onRespond({ behavior: a.behavior, selectedActionId: a.id })} />)}
360
518
  <Button theme={theme} compact={compact} kind={primary ? "primary" : "secondary"} icon="Check" title="Allow" loading={busy} onPress={() => onRespond({ behavior: "allow" })} />
361
- </View>
519
+ </View>}
362
520
  </View>;
363
521
  }
364
522
 
365
523
  /** The reply box. Sending is the developer writing to the agent, which clears Needs you (binding rule). */
366
- function ReplyBox({ theme, compact, agentName, onSend, placeholder = "Answer in your own words", hint = "Sending clears Needs you. Sign off & next moves on without a reply." }: { theme: Theme; compact: boolean; agentName: string; onSend: (text: string) => Promise<void>; placeholder?: string; hint?: string | null }) {
524
+ const REPLY_HINT = "Sending clears Needs you. Sign off & next moves on without a reply.";
525
+ function ReplyBox({ theme, compact, agentName, onSend, placeholder = "Answer in your own words", hint = REPLY_HINT, focus = 0, onFocusChange, docked = true }: { theme: Theme; compact: boolean; agentName: string; onSend: (text: string) => Promise<void>; placeholder?: string; hint?: string | null; focus?: number; onFocusChange?: (focused: boolean) => void; docked?: boolean }) {
367
526
  const c = theme.colors;
527
+ const inputRef = useRef<TextInput | null>(null);
528
+ // Focus when asked to (⌘K), never on a plain mount. The closing command palette hands focus back to where it was,
529
+ // after us, so keep claiming it for a moment until it sticks.
530
+ useEffect(() => {
531
+ if (!focus) return;
532
+ const timers = [0, 150, 400, 800, 1400].map(ms => setTimeout(() => {
533
+ const doc = (globalThis as { document?: { activeElement?: unknown } }).document;
534
+ const input = inputRef.current as unknown;
535
+ if (!doc || doc.activeElement !== input) inputRef.current?.focus();
536
+ }, ms));
537
+ return () => timers.forEach(clearTimeout);
538
+ }, [focus]);
368
539
  const toast = useToast();
369
540
  const [value, setValue] = useState("");
370
541
  const [sending, setSending] = useState(false);
@@ -375,21 +546,25 @@ function ReplyBox({ theme, compact, agentName, onSend, placeholder = "Answer in
375
546
  try { await onSend(text); setValue(""); toast.show("Sent", { variant: "success" }); }
376
547
  catch (e) { toast.error(errorText(e)); } finally { setSending(false); }
377
548
  };
378
- return <View style={{ padding: compact ? 12 : 14, borderTopWidth: 1, borderTopColor: c.border, gap: 6 }}>
379
- <View style={{ flexDirection: "row", alignItems: "flex-end", gap: 8, borderRadius: 10, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1, paddingLeft: 12, paddingRight: 6, paddingVertical: 6 }}>
380
- <TextInput accessibilityLabel={`Reply to ${agentName}`} value={value} onChangeText={setValue} placeholder={placeholder} placeholderTextColor={c.foregroundMuted} multiline
549
+ // Phones: a 48-tall box (46 + hairline) with the placeholder on one centred line; it grows as you type.
550
+ // In a dock (the detail pane), the dock draws the hairline; on its own it draws one. Phones keep the hint as the
551
+ // input's accessibility hint instead of small print under it, where it collided with the gesture bar.
552
+ return <View style={{ padding: compact ? 12 : 14, gap: 6, ...(docked ? {} : { borderTopWidth: 1, borderTopColor: c.border }) }}>
553
+ <View style={{ flexDirection: "row", alignItems: "flex-end", gap: 8, borderRadius: compact ? 12 : 10, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1, paddingLeft: 12, paddingRight: compact ? 1 : 6, paddingVertical: compact ? 0 : 6 }}>
554
+ <TextInput ref={inputRef} accessibilityLabel={`Reply to ${agentName}`} accessibilityHint={compact && hint ? hint : undefined} onFocus={() => onFocusChange?.(true)} onBlur={() => onFocusChange?.(false)} value={value} onChangeText={setValue} placeholder={placeholder} placeholderTextColor={c.foregroundMuted} multiline
555
+ numberOfLines={compact ? 1 : undefined}
381
556
  onKeyPress={e => { const k = e.nativeEvent as unknown as { key: string; metaKey?: boolean; ctrlKey?: boolean }; if (k.key === "Enter" && (k.metaKey || k.ctrlKey)) void send(); }}
382
- style={{ flex: 1, minHeight: compact ? 44 : 36, maxHeight: 140, color: c.foreground, fontSize: 14, lineHeight: 20, paddingVertical: 6, ...(Platform.OS === "web" ? { outlineStyle: "none" } as object : {}) }} />
557
+ style={{ flex: 1, minHeight: compact ? 46 : 36, maxHeight: 140, color: c.foreground, fontSize: 14, lineHeight: 20, paddingVertical: compact ? 13 : 6, ...(Platform.OS === "web" ? { outlineStyle: "none" } as object : {}) }} />
383
558
  <IconButton theme={theme} compact={compact} icon="ArrowUp" label="Send" disabled={!value.trim() || sending} spinning={sending} onPress={() => void send()} color={value.trim() ? c.foreground : undefined} />
384
559
  </View>
385
- {!!hint && <Text style={{ color: c.foregroundMuted, fontSize: 11, lineHeight: 15 }}>{hint}</Text>}
560
+ {!!hint && !compact && <Text style={{ color: c.foregroundMuted, fontSize: 11, lineHeight: 15 }}>{hint}</Text>}
386
561
  </View>;
387
562
  }
388
563
 
389
564
  // ---------- brief pane ----------
390
565
 
391
566
  function BriefPane({ theme, compact, pane, onSelect, openLog, sources }: { theme: Theme; compact: boolean; pane: ReturnType<typeof briefPane>; onSelect: (key: string) => void; openLog: () => void; sources: HomeSources }) {
392
- const c = theme.colors; const t = text(c);
567
+ const c = theme.colors; const t = text(c, compact);
393
568
  useTick(30_000);
394
569
  const now = Date.now();
395
570
  const offline = sources.inbox.offlineSince();
@@ -397,19 +572,35 @@ function BriefPane({ theme, compact, pane, onSelect, openLog, sources }: { theme
397
572
  const date = new Date(now).toLocaleDateString([], { weekday: "long", day: "numeric", month: "long" });
398
573
  const time = new Date(now).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hour12: false });
399
574
  const section = (title: string, right?: React.ReactNode) => <View style={{ flexDirection: "row", alignItems: "center", marginTop: 6 }}>
400
- <Text accessibilityRole="header" style={[t.small, { flex: 1, fontWeight: "600", letterSpacing: 0.5, textTransform: "uppercase" }]}>{title}</Text>{right}
575
+ <Text accessibilityRole="header" style={[t.section, { flex: 1 }]}>{title}</Text>{right}
401
576
  </View>;
402
577
  const dot = (ok: boolean) => <View style={{ width: 8, height: 8, borderRadius: 4, backgroundColor: ok ? c.statusSuccess : c.statusWarning }} />;
403
578
  return <ScrollView style={{ flex: 1 }} contentContainerStyle={{ padding: compact ? 16 : 22, gap: 10 }}>
404
- <Text style={t.meta}>{date} · {time}</Text>
405
- <Text accessibilityRole="header" style={{ color: c.foreground, fontSize: compact ? 19 : 21, lineHeight: compact ? 26 : 29, fontWeight: "600", letterSpacing: -0.2 }}>{pane.headline}</Text>
406
- {pane.first && <Button theme={theme} compact={compact} kind="primary" icon="ArrowRight" title={`Open ${pane.first.title.length > 40 ? `${pane.first.title.slice(0, 40)}…` : pane.first.title}`} onPress={() => onSelect(pane.first!.key)} />}
579
+ {/* Phones: the headline leads and the date sits under it; desktop keeps the date as an eyebrow. */}
580
+ {!compact && <Text style={t.meta}>{date} · {time}</Text>}
581
+ <Text accessibilityRole="header" style={t.headline}>{pane.headline}</Text>
582
+ {compact && <Text style={t.meta}>Morning brief · {date} · {time}</Text>}
583
+ {pane.first && <Button theme={theme} compact={compact} grow={compact} kind="primary" icon="ArrowRight" title={`Open ${pane.first.title.length > 40 ? `${pane.first.title.slice(0, 40)}…` : pane.first.title}`} onPress={() => onSelect(pane.first!.key)} />}
407
584
  {!!pane.waiting && <Text style={t.body}><Text style={{ color: c.foregroundMuted }}>Waiting on others: </Text>{pane.waiting}</Text>}
408
585
  <Text style={t.body}><Text style={{ color: c.foregroundMuted }}>Cleared since {sinceLabel(now)}: </Text>{pane.cleared ?? "nothing yet"}.</Text>
409
586
 
410
- {section("Done while you were away", <Pressable accessibilityRole="link" onPress={openLog} hitSlop={8}><Text style={[t.small, { color: c.foreground }]}>{pane.away.count} · log</Text></Pressable>)}
411
- {pane.away.top.length ? pane.away.top.map(l => <LogRow key={l.key} l={l} c={c} />) : <Text style={t.meta}>Follow-up didn't act on its own since {sinceLabel(now)}.</Text>}
412
- <Text style={t.meta}>No merges, no messages to people. Those stay yours.</Text>
587
+ {/* Phones: the section head is itself a 44 row into the log ("· N · View log ›"), not a tiny "0 · log" link. With
588
+ nothing done, one muted line says so instead of a header, an empty log and the same "since" twice. */}
589
+ {compact && !pane.away.count
590
+ ? <Text style={[t.meta, { marginTop: 6 }]}>Nothing done on its own since {sinceLabel(now)} · no merges, no messages to people.</Text>
591
+ : compact
592
+ ? <Pressable accessibilityRole="link" accessibilityLabel={`Done while you were away: ${pane.away.count}. View log`} onPress={openLog}
593
+ style={state => ({ flexDirection: "row", alignItems: "center", gap: 6, minHeight: 44, marginTop: 6, marginHorizontal: -8, paddingHorizontal: 8, borderRadius: 8, backgroundColor: state.pressed ? c.surface2 : "transparent" })}>
594
+ <Text accessibilityRole="header" numberOfLines={1} style={[t.section, { flexShrink: 1 }]}>Done while you were away · {pane.away.count}</Text>
595
+ <View style={{ flex: 1 }} />
596
+ <Text style={[t.meta, { color: c.foreground }]}>View log</Text>
597
+ <Icon name="ChevronRight" size={14} color={c.foregroundMuted} />
598
+ </Pressable>
599
+ : section("Done while you were away", <Pressable accessibilityRole="link" onPress={openLog} hitSlop={8}><Text style={[t.small, { color: c.foreground }]}>{pane.away.count} · log</Text></Pressable>)}
600
+ {!(compact && !pane.away.count) && <>
601
+ {pane.away.top.length ? pane.away.top.map(l => <LogRow key={l.key} l={l} c={c} />) : <Text style={t.meta}>Follow-up didn't act on its own since {sinceLabel(now)}.</Text>}
602
+ <Text style={t.meta}>No merges, no messages to people. Those stay yours.</Text>
603
+ </>}
413
604
 
414
605
  {section("Sources")}
415
606
  <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 14 }}>