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

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/OVERVIEW.md CHANGED
@@ -5,7 +5,7 @@ Follow-up watches every pull request a Paseo workspace opens until the work is a
5
5
  ## What you see
6
6
 
7
7
  - Home: every workspace grouped by what it needs from you (Needs you, Follow-up is fixing, Running, Waiting on others, Quiet), with the selected one beside the list so you can allow a permission, answer, merge, reply or sign off in place, and a brief with what Follow-up did while you were away. Above the list: the status counts, provider limits from Smart Session when it's installed, a search over names, branches, PRs, agents and asks, and a sort menu (Priority, Recent, Oldest waiting, Name, By project).
8
- - The Overseer (1.4 beta), pinned on Home: one agent you talk to about all your workspaces. It forwards your asks to the agent that owns them, asks you when it isn't sure, and starts a new workspace only when you say so.
8
+ - The Overseer (1.4 beta), pinned on Home: one agent you talk to about all your workspaces. It forwards your asks to the agent that owns them, asks you when it isn't sure, and starts a new workspace only when you say so. You can ask it from Home's search box (the last row, "Ask the Overseer: …") or with ⌘K → Follow-up: Ask the Overseer.
9
9
  - What's this about?, a collapsible section at the top of Home's detail pane and the workspace panel: a one-line gist, a short AI overview of what the workspace is for and where it stands, and its linked Linear issues, PRs, Slack threads and docs.
10
10
  - A workspace panel for the open workspace only, with a Home button: PRs merged, what needs you, what needs fixing, a bar with one segment per PR, and what the agent is doing now. "Open full" on Home docks it beside the agent's chat.
11
11
  - A Needs you card with one button per decision: Send repairs, Merge, Resume, Retry, or Answer.
package/README.md CHANGED
@@ -139,6 +139,8 @@ An overview is written when you open the section and none exists, or when the in
139
139
 
140
140
  One agent you talk to about all your workspaces. It sits pinned at the top of Home's list, under the morning brief. Click **Start the Overseer** once, and Follow-up creates it in its own workspace, which is never tracked, never shown under Needs you, and never sent repairs. Its row shows whether it is idle, working, or asking you something. Selecting it opens the conversation in the right pane with a reply box, and **Open full** opens its chat.
141
141
 
142
+ **Ask from anywhere.** Type in Home's search box and the last row is always **Ask the Overseer: <what you typed>**. Arrow down to it and press Enter (or tap it), and it goes to the Overseer as you wrote it. The search clears and its conversation opens. If no workspace matches, it is the only row, so Enter sends it straight away; a single word that matches nothing waits for ↓ or a tap, so a typo never reaches an agent. The first ask starts the Overseer, so you don't have to click Start first. While the Overseer is on, ⌘K → **Follow-up: Ask the Overseer** opens it from any screen with the reply box focused. Both work on the phone too.
143
+
142
144
  - **It routes your asks; it doesn't do the work.** "Tell the HER-1312 agent to use option A" goes to the agent that owns HER-1312, and the Overseer answers in one line: "Sent to Okta SCIM sync (key HER-1312)". It scores candidates by Linear key, PR number, branch, workspace name, open asks and recent activity. When no candidate stands out, it asks you with a decision (the top two or three plus **New workspace**) instead of guessing.
143
145
  - **What it forwards keeps your voice.** A forwarded message starts "From Tom via Overseer:". It clears that agent's Needs-you flag only when it answers the agent's open ask. A new task leaves the ask standing.
144
146
  - **New workspaces only on your word.** It starts one, branched off main and named from the task, only after you asked or picked **New workspace**, and only through a dry run and confirm.
@@ -146,14 +148,16 @@ One agent you talk to about all your workspaces. It sits pinned at the top of Ho
146
148
  - **It is cheap to keep.** Each turn begins with a digest of what changed since the last one, built from Paseo's workspace metadata and Follow-up's own state. That's about 800 tokens at 100 workspaces, with resting workspaces in one line. The digest file is rewritten only when its content changes, and not at all while the resource governor pauses background work. The Overseer never reads the timeline of an agent that isn't loaded, because that would load the agent for an hour. Instead it reads the agent's transcript from disk, or Follow-up's cached goal and PRs. Sending to a resting agent wakes it, so that happens only when you ask for it, and the reply says "woke …".
147
149
  - **Archived it by accident?** Follow-up starts a new one with a handoff from the old one's last steps.
148
150
 
149
- Turn it off under Settings → **Overseer (beta)**.
151
+ Turn it off under Settings → **Overseer (beta)**. While it's off, search has no ask row.
152
+
153
+ ![Home's search with "scim" typed: the matching workspace, then the active row "Ask the Overseer: scim" with an Enter hint](docs/media/overseer/omnibox-ask-dark.png)
150
154
 
151
155
  ![Home with the Overseer selected: the pinned row asks which agent should take a broken export, and the pane shows the conversation, the routed task and the decision with two candidates plus New workspace](docs/media/overseer/overseer-dark.png)
152
156
 
153
157
  Install the beta:
154
158
 
155
159
  ```sh
156
- paseo plugin update follow-through --version 1.4.0-beta.2
160
+ paseo plugin update follow-through --version 1.4.0-beta.3
157
161
  # or, for a fresh install:
158
162
  paseo plugin install npm:paseo-follow-up@beta
159
163
  ```
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore
2
2
  import { Platform, Pressable, Text, TextInput, View } from "react-native";
3
3
  import { Icon } from "@getpaseo/plugin/client/ui";
4
4
  import { GROUP_TITLE, homeCounts, type HomeGroupId, type HomeModel } from "../shared/home";
5
- import { FIELD_LABEL, excerpt, highlightRuns, homeSearchDocs, indexDocs, omniboxResults, workspaceProvider, type OmniboxItem, type OmniboxProvider, type Range } from "../shared/search";
5
+ import { FIELD_LABEL, excerpt, highlightRuns, homeSearchDocs, indexDocs, defaultActive, omniboxResults, overseerProvider, workspaceProvider, type OmniboxItem, type OmniboxProvider, type Range, type WorkspaceItem } from "../shared/search";
6
6
  import { SORT_HINT, SORT_LABEL, SORT_MODES, type SortMode } from "../shared/sort";
7
7
  import { priorityNote, PRIORITY_SOURCE_LABEL } from "../shared/priorities";
8
8
  import { meters, meterText, type Meter } from "../shared/usage";
@@ -11,6 +11,7 @@ import type { HomeSources } from "./home-data";
11
11
  import type { Workstream } from "../shared/home";
12
12
  import { Age, PrChipView } from "./home-list";
13
13
  import { useMinute } from "./home-data";
14
+ import { Spinner } from "./motion";
14
15
  import { withAlpha, type Colors } from "./theme";
15
16
  import type { Theme } from "./kit";
16
17
 
@@ -29,33 +30,40 @@ export type Omnibox = {
29
30
  active: number;
30
31
  move(delta: number): void;
31
32
  inputRef: React.RefObject<TextInput | null>;
33
+ /** The Overseer is on, so a query can also be an ask. */
34
+ askOn: boolean;
32
35
  };
33
36
 
34
37
  /**
35
38
  * The search state for one list. The index is rebuilt only when Home's sources change, never per keystroke.
36
- * `extraProviders` is the seam for the next build's "Ask the Overseer" row, listed after the workspace results.
39
+ * The Overseer's "Ask the Overseer: <query>" row comes last while the Overseer is on; `extraProviders` go between.
37
40
  */
38
41
  export function useOmnibox(model: HomeModel, sources: HomeSources, extraProviders: readonly OmniboxProvider[] = []): Omnibox {
39
42
  const [query, setQueryState] = useState("");
40
- const [active, setActive] = useState(0);
43
+ // null: the default row. -1: none, so Enter does nothing.
44
+ const [active, setActive] = useState<number | null>(null);
41
45
  const inputRef = useRef<TextInput | null>(null);
42
46
  const live = useSyncExternalStore(sources.live.subscribe, sources.live.version, sources.live.version);
43
47
  const paseo = useSyncExternalStore(sources.paseo.subscribe, sources.paseo.version, sources.paseo.version);
44
48
  const extras = useSyncExternalStore(sources.extras.subscribe, sources.extras.version, sources.extras.version);
45
49
  const searching = query.trim().length > 0;
50
+ const overseer = useSyncExternalStore(sources.extras.subscribe, sources.extras.overseer, sources.extras.overseer);
51
+ const askOn = !!overseer?.enabled;
46
52
  // Built lazily: nothing is indexed until the developer types.
47
53
  const index = useMemo(() => searching ? indexDocs(homeSearchDocs({ model, paseo: sources.paseo.all(), tracked: sources.live.all(), archived: sources.live.archived(), agents: sources.extras.agents() })) : null,
48
54
  // eslint-disable-next-line react-hooks/exhaustive-deps
49
55
  [searching, model, live, paseo, extras]);
50
- const providers = useMemo(() => index ? [workspaceProvider(index), ...extraProviders] : [], [index, extraProviders]);
56
+ const providers = useMemo(() => index ? [workspaceProvider(index), ...extraProviders, overseerProvider(askOn)] : [], [index, extraProviders, askOn]);
51
57
  const results = useMemo(() => searching ? omniboxResults(providers, query) : null, [providers, query, searching]);
52
- const setQuery = useCallback((q: string) => { setQueryState(q); setActive(0); }, []);
53
- const move = useCallback((delta: number) => setActive(a => Math.max(0, Math.min((results?.length ?? 1) - 1, a + delta))), [results]);
58
+ const setQuery = useCallback((q: string) => { setQueryState(q); setActive(null); }, []);
59
+ const fallback = defaultActive(results);
60
+ const current = active ?? fallback;
61
+ const move = useCallback((delta: number) => setActive(a => Math.max(0, Math.min((results?.length ?? 1) - 1, (a ?? fallback) + delta))), [results, fallback]);
54
62
  // ⌘K "Follow-up: Search".
55
63
  const token = useSyncExternalStore(sources.extras.subscribe, sources.extras.focusToken, sources.extras.focusToken);
56
64
  const first = useRef(token);
57
65
  useEffect(() => { if (token !== first.current) inputRef.current?.focus(); }, [token]);
58
- return { query, setQuery, results, active: Math.min(active, Math.max(0, (results?.length ?? 1) - 1)), move, inputRef };
66
+ return { query, setQuery, results, active: Math.min(current, Math.max(0, (results?.length ?? 1) - 1)), move, inputRef, askOn };
59
67
  }
60
68
 
61
69
  type DomKey = { key: string; metaKey: boolean; ctrlKey: boolean; altKey: boolean; target: unknown; preventDefault(): void };
@@ -79,12 +87,13 @@ export function useSlashToFocus(omnibox: Omnibox, enabled = true) {
79
87
  export function SearchField({ theme, omnibox, dense, onEnter }: { theme: Theme; omnibox: Omnibox; dense: boolean; onEnter: (item: OmniboxItem) => void }) {
80
88
  const c = theme.colors;
81
89
  const [focused, setFocused] = useState(false);
82
- const { query, setQuery, results, active, move, inputRef } = omnibox;
90
+ const { query, setQuery, results, active, move, inputRef, askOn } = omnibox;
91
+ const placeholder = askOn ? "Search, or ask the Overseer" : "Search workspaces, branches, PRs";
83
92
  return <View style={{ flex: 1, minWidth: 0, flexDirection: "row", alignItems: "center", gap: 6, height: dense ? 30 : 32, paddingHorizontal: 8, borderRadius: 6,
84
93
  borderWidth: 1, borderColor: focused ? withAlpha(c.foreground, 0.35) : c.border, backgroundColor: c.surface1 }}>
85
94
  <Icon name="Search" size={13} color={c.foregroundMuted} />
86
- <TextInput ref={inputRef} value={query} onChangeText={setQuery} placeholder="Search workspaces, branches, PRs" placeholderTextColor={c.foregroundMuted}
87
- accessibilityLabel="Search workspaces, branches, PRs" autoCorrect={false} autoCapitalize="none" spellCheck={false} returnKeyType="go"
95
+ <TextInput ref={inputRef} value={query} onChangeText={setQuery} placeholder={placeholder} placeholderTextColor={c.foregroundMuted}
96
+ accessibilityLabel={placeholder} autoCorrect={false} autoCapitalize="none" spellCheck={false} returnKeyType="go"
88
97
  onFocus={() => setFocused(true)} onBlur={() => setFocused(false)}
89
98
  onSubmitEditing={() => { const item = results?.[active]; if (item) onEnter(item); }}
90
99
  onKeyPress={e => {
@@ -232,7 +241,7 @@ export function GroupChip({ group, c }: { group: HomeGroupId | "archived"; c: Co
232
241
  </View>;
233
242
  }
234
243
 
235
- export function ResultRow({ item, theme, active, dense, touch, onPress, s: row }: { item: OmniboxItem; theme: Theme; active: boolean; dense: boolean; touch: boolean; onPress: () => void; s?: Workstream }) {
244
+ 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 }) {
236
245
  const c = theme.colors;
237
246
  const { hit } = item;
238
247
  const via = hit.via ? excerpt(hit.via.text, hit.via.ranges, dense ? 56 : 90) : null;
@@ -255,6 +264,26 @@ export function ResultRow({ item, theme, active, dense, touch, onPress, s: row }
255
264
  </Pressable>;
256
265
  }
257
266
 
267
+ /**
268
+ * The omnibox's last row: the query as an ask for the Overseer. Enter (or a tap) sends it as typed; the Overseer
269
+ * finds the agent that owns it. Quiet until it's the active row, so it never competes with real matches.
270
+ */
271
+ export function AskRow({ ask, theme, active, dense, touch, sending, onPress }: { ask: string; theme: Theme; active: boolean; dense: boolean; touch: boolean; sending: boolean; onPress: () => void }) {
272
+ const c = theme.colors;
273
+ return <Pressable accessibilityRole="button" accessibilityState={{ selected: active, busy: sending }} accessibilityLabel={`Ask the Overseer: ${ask}`} accessibilityHint="Sends this to the Overseer, which passes it to the agent that owns it" disabled={sending} onPress={onPress}
274
+ style={state => ({ flexDirection: "row", alignItems: "center", gap: 10, minHeight: touch ? 56 : dense ? 40 : 44, paddingHorizontal: dense ? 8 : 16, paddingVertical: 4,
275
+ borderLeftWidth: 2, borderLeftColor: active ? withAlpha(c.foreground, 0.5) : "transparent",
276
+ backgroundColor: active ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
277
+ <Text numberOfLines={dense ? 2 : 1} style={{ flex: 1, minWidth: 0, fontSize: 13, lineHeight: 18 }}>
278
+ <Text style={{ color: c.foregroundMuted }}>Ask the Overseer: </Text>
279
+ <Text style={{ color: c.foreground, fontWeight: "500" }}>{ask}</Text>
280
+ </Text>
281
+ {sending ? <Spinner color={c.foregroundMuted} size={12} label="Sending to the Overseer" />
282
+ : active && Platform.OS === "web" && !touch ? <Text style={{ color: c.foregroundMuted, fontSize: 11, paddingHorizontal: 4, borderRadius: 3, borderWidth: 1, borderColor: withAlpha(c.foreground, 0.2) }}>↵</Text> : null}
283
+ <Icon name="MessagesSquare" size={14} color={active ? c.foreground : c.foregroundMuted} />
284
+ </Pressable>;
285
+ }
286
+
258
287
  /** The muted reason and source chip a fresh external priority adds to a row. */
259
288
  export function PriorityLine({ reason, source, c, size = 12 }: { reason: string; source: { kind: keyof typeof PRIORITY_SOURCE_LABEL; label: string } | null; c: Colors; size?: number }) {
260
289
  return <View style={{ flexDirection: "row", alignItems: "center", gap: 6, minWidth: 0 }}>
@@ -2,8 +2,8 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState, type ReactNode
2
2
  import { FlatList, Pressable, Text, View } from "react-native";
3
3
  import { Icon } from "@getpaseo/plugin/client/ui";
4
4
  import { GROUP_TITLE, quietFolds, type Badge, type HomeGroupId, type HomeModel, type Workstream } from "../shared/home";
5
- import type { OmniboxItem } from "../shared/search";
6
- import { PriorityLine, ResultRow } from "./home-chrome";
5
+ import { ASK_KEY, type OmniboxItem, type WorkspaceItem } from "../shared/search";
6
+ import { AskRow, PriorityLine, ResultRow } from "./home-chrome";
7
7
  import { age } from "../shared/inbox";
8
8
  import { headlineColor, mergedColor, runningColor, tint, toneColor, withAlpha, type Colors } from "./theme";
9
9
  import { useMinute } from "./home-data";
@@ -29,7 +29,8 @@ type Entry =
29
29
  | { type: "row"; key: string; s: Workstream }
30
30
  | { type: "fold"; key: string; project: string; count: number; archivable: number; open: boolean }
31
31
  | { type: "more"; key: string; project: string; left: number }
32
- | { type: "result"; key: string; item: OmniboxItem; index: number }
32
+ | { type: "result"; key: string; item: WorkspaceItem; index: number }
33
+ | { type: "ask"; key: string; ask: string; index: number }
33
34
  | { type: "label"; key: string; text: string };
34
35
 
35
36
  export type HomeListProps = {
@@ -56,9 +57,11 @@ export type HomeListProps = {
56
57
  filter?: HomeGroupId | null;
57
58
  /** The pinned Overseer row under the brief. Absent: the Overseer is off (or this surface has none). */
58
59
  overseer?: OverseerRowState | null;
60
+ /** An omnibox ask is on its way to the Overseer. */
61
+ asking?: boolean;
59
62
  };
60
63
 
61
- export function HomeList({ model, theme, dense = false, touch, selectedKey, onSelect, briefLine, renderExpanded, header, footer, top, results, activeResult = 0, onResult, filter = null, overseer = null }: HomeListProps) {
64
+ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSelect, briefLine, renderExpanded, header, footer, top, results, activeResult = 0, onResult, filter = null, overseer = null, asking = false }: HomeListProps) {
62
65
  const c = theme.colors;
63
66
  const [closed, setClosed] = useState<Set<string>>(new Set(["quiet"]));
64
67
  const [openProjects, setOpenProjects] = useState<Set<string>>(new Set());
@@ -72,6 +75,12 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
72
75
  // Search ignores the sort and the groups: ranked by match, archived ones last under their own label.
73
76
  let archivedShown = false;
74
77
  results.forEach((item, index) => {
78
+ if (item.ask !== undefined) {
79
+ // The ask row closes the list; with no match it follows the "no match" line.
80
+ if (index === 0) out.push({ type: "label", key: "l:none", text: "No workspace, branch or PR matches." });
81
+ out.push({ type: "ask", key: item.key, ask: item.ask, index });
82
+ return;
83
+ }
75
84
  if (item.hit.group === "archived" && !archivedShown) { archivedShown = true; out.push({ type: "label", key: "l:archived", text: "Archived" }); }
76
85
  out.push({ type: "result", key: `r:${item.provider}:${item.key}`, item, index });
77
86
  });
@@ -105,6 +114,7 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
105
114
  case "label": return <Text accessibilityRole={item.key === "l:archived" ? "header" : undefined} style={{ color: c.foregroundMuted, fontSize: item.key === "l:archived" ? 11 : 13, fontWeight: item.key === "l:archived" ? "600" : "400",
106
115
  letterSpacing: item.key === "l:archived" ? 0.6 : 0, textTransform: item.key === "l:archived" ? "uppercase" : "none", paddingHorizontal: dense ? 8 : 16, paddingTop: 12, paddingBottom: 4 }}>{item.text}</Text>;
107
116
  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)} />;
117
+ 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 })} />;
108
118
  case "brief": return <BriefRow theme={theme} line={briefLine ?? ""} selected={selectedKey === null || selectedKey === BRIEF_KEY} touch={touch} onSelect={onSelect} />;
109
119
  case "overseer": return overseer ? <OverseerRow theme={theme} o={overseer} selected={selectedKey === OVERSEER_KEY} touch={touch} onSelect={onSelect} /> : null;
110
120
  case "header": return <GroupHeader theme={theme} title={item.title} count={item.count} open={item.open} tone={item.group === "needs" && item.count ? c.statusWarning : undefined} dense={dense} touch={touch} onPress={() => toggle(item.group)} />;
@@ -127,16 +137,16 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
127
137
  </View>;
128
138
  }
129
139
  }
130
- }, [theme, c, dense, touch, selectedKey, onSelect, briefLine, renderExpanded, toggle, toggleProject, activeResult, onResult, model, overseer?.state, overseer?.line]);
140
+ }, [theme, c, dense, touch, selectedKey, onSelect, briefLine, renderExpanded, toggle, toggleProject, activeResult, onResult, model, overseer?.state, overseer?.line, asking]);
131
141
 
132
142
  const listRef = useRef<FlatList<Entry>>(null);
133
143
  // Keep the keyboard-active result in view.
134
144
  useEffect(() => {
135
145
  if (!results?.length) return;
136
- const at = data.findIndex(e => e.type === "result" && e.index === activeResult);
146
+ const at = data.findIndex(e => (e.type === "result" || e.type === "ask") && e.index === activeResult);
137
147
  if (at >= 0) listRef.current?.scrollToIndex({ index: at, viewPosition: 0.5, animated: false });
138
148
  }, [activeResult, results, data]);
139
- const list = <FlatList ref={listRef} data={data} keyExtractor={e => e.key} renderItem={render} extraData={`${selectedKey}:${activeResult}`} onScrollToIndexFailed={() => undefined}
149
+ const list = <FlatList ref={listRef} data={data} keyExtractor={e => e.key} renderItem={render} extraData={`${selectedKey}:${activeResult}:${asking}`} onScrollToIndexFailed={() => undefined}
140
150
  initialNumToRender={30} maxToRenderPerBatch={30} windowSize={9} removeClippedSubviews={false}
141
151
  ListHeaderComponent={header ? <>{header}</> : null} ListFooterComponent={footer ? <>{footer}</> : <View style={{ height: 32 }} />}
142
152
  style={{ flex: 1 }} contentContainerStyle={{ paddingBottom: 8 }} keyboardShouldPersistTaps="handled" />;
@@ -1,5 +1,5 @@
1
1
  import type { PluginClientContext } from "@getpaseo/plugin/client";
2
- import { overseerStartRpc, overseerStatusRpc, prioritiesRpc, usageRpc } from "../shared/contracts";
2
+ import { overseerAskRpc, overseerStartRpc, overseerStatusRpc, prioritiesRpc, usageRpc } from "../shared/contracts";
3
3
  import type { RpcOutput } from "@getpaseo/plugin";
4
4
  import type { Priority } from "../shared/priorities";
5
5
  import { DEFAULT_SORT, isSortMode, type SortMode } from "../shared/sort";
@@ -97,6 +97,8 @@ export function createHomeExtras(client: PluginClientContext) {
97
97
  /** The Overseer: off, not started yet, or its agent and workspace. */
98
98
  overseer: () => overseer,
99
99
  async startOverseer() { overseer = await client.rpc(overseerStartRpc, {}); emit(); return overseer; },
100
+ /** Sends the omnibox's ask to the Overseer, starting it on first use. */
101
+ async askOverseer(text: string) { overseer = await client.rpc(overseerAskRpc, { text }); emit(); return overseer; },
100
102
  agents: () => [...agents.values()],
101
103
  /** Bumped by ⌘K "Follow-up: Search"; the visible search field focuses when it changes. */
102
104
  focusToken: () => focusToken,
package/client/home.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { useCallback, useEffect, useMemo, useState, useSyncExternalStore } from "react";
1
+ import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
2
2
  import { Platform, Pressable, ScrollView, Text, TextInput, View } from "react-native";
3
3
  import { usePaseo, useRpc, type PluginScreenProps } from "@getpaseo/plugin/client";
4
4
  import { Icon, useToast } from "@getpaseo/plugin/client/ui";
@@ -17,6 +17,7 @@ import { PrSheet } from "./pr-sheet";
17
17
  import { QuestionSheet } from "./questions";
18
18
  import { Age, BadgeView, BRIEF_KEY, glyphColor, HomeList, OVERSEER_KEY, PrChipView, type OverseerRowState } from "./home-list";
19
19
  import { answerLine, overseerRowState } from "../shared/overseer";
20
+ import type { OmniboxItem } from "../shared/search";
20
21
  import { ListTop, SearchField, SortMenu, StatusStrip, UsageMeters, useOmnibox, useSlashToFocus } from "./home-chrome";
21
22
  import { useHomeModel, useTick, type HomeSources } from "./home-data";
22
23
  import { useInbox, UndoBar, useNextRelay } from "./inbox";
@@ -61,6 +62,27 @@ export function FollowHome(props: PluginScreenProps & { deps: HomeDeps }) {
61
62
  const overseerStatus = useSyncExternalStore(deps.sources.extras.subscribe, deps.sources.extras.overseer, deps.sources.extras.overseer);
62
63
  const overseerInbox = useInbox(inbox, () => inbox.overseer());
63
64
  const overseer = overseerRowState(overseerStatus, overseerInbox);
65
+ const toast = useToast();
66
+ // The omnibox's "Ask the Overseer" row: send, then show the conversation it lands in.
67
+ const [asking, setAsking] = useState(false);
68
+ const [pendingAsk, setPendingAsk] = useState<string | null>(null);
69
+ const pick = useCallback(async (item: OmniboxItem) => {
70
+ if (item.ask === undefined) { setSelected(item.key); return; }
71
+ if (asking) return;
72
+ setAsking(true);
73
+ // No toast: the conversation opens on the sent words, which says it more plainly.
74
+ try { await deps.sources.extras.askOverseer(item.ask); omnibox.setQuery(""); omnibox.inputRef.current?.blur(); setPendingAsk(item.ask); setSelected(OVERSEER_KEY); inbox.refresh(); }
75
+ catch (e) { toast.error(errorText(e)); } finally { setAsking(false); }
76
+ }, [asking, deps.sources.extras, omnibox, inbox, toast]);
77
+ // ⌘K "Follow-up: Ask the Overseer" opens Home with `?ask=<nonce>`: select it and focus its reply box. A param, not
78
+ // shared state, so it works whether Home was already open or mounts fresh.
79
+ const [replyFocus, setReplyFocus] = useState(0);
80
+ useEffect(() => {
81
+ if (!params.ask) return;
82
+ if (overseerStatus && !overseerStatus.enabled) { toast.show("The Overseer is off. Turn it on in Follow-up settings."); return; }
83
+ setSelected(OVERSEER_KEY); setReplyFocus(n => n + 1);
84
+ // eslint-disable-next-line react-hooks/exhaustive-deps
85
+ }, [params.ask]);
64
86
  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
87
 
66
88
  const openFull = useCallback((s: Workstream) => {
@@ -78,17 +100,17 @@ export function FollowHome(props: PluginScreenProps & { deps: HomeDeps }) {
78
100
  if (params.view === "log") return <LogView theme={theme} compact={compact} sources={deps.sources} onHome={deps.openHome} onOpen={key => { setSelected(key); deps.openHome(); }} />;
79
101
 
80
102
  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} />
103
+ ? <OverseerPane theme={theme} compact={compact} o={overseer} focus={replyFocus} pending={pendingAsk} agentId={overseerStatus?.agentId ?? null} deps={deps} navigation={navigation} onBack={compact ? () => setSelected(null) : undefined} />
82
104
  : current
83
105
  ? <DetailPane key={current.key} s={current} model={model} theme={theme} compact={compact} deps={deps} openFull={openFull} signOffNext={signOffNext} onBack={compact ? () => setSelected(null) : undefined} />
84
106
  : <BriefPane theme={theme} compact={compact} pane={pane} onSelect={key => setSelected(key)} openLog={deps.openLog} sources={deps.sources} />;
85
107
  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}
108
+ results={omnibox.results} activeResult={omnibox.active} onResult={item => void pick(item)} filter={filter} overseer={overseer} asking={asking}
87
109
  top={<ListTop theme={theme} dense={compact} title={<ListHeader theme={theme} compact={compact} onSettings={deps.openSettings} />}>
88
110
  {/* zIndex: on web every View is its own stacking context, so the sort menu only paints and hit-tests above the
89
111
  strip and meters below if this row sits above them. */}
90
112
  <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)} />
113
+ <SearchField theme={theme} omnibox={omnibox} dense={compact} onEnter={item => void pick(item)} />
92
114
  <SortMenu theme={theme} mode={model.sort} onChange={deps.sources.extras.setSort} rankedAt={model.rankedAt} touch={compact} />
93
115
  </View>
94
116
  {!omnibox.results && <StatusStrip theme={theme} model={model} filter={filter} onFilter={setFilter} touch={compact} dense={compact} />}
@@ -274,7 +296,7 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, onB
274
296
  * 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
297
  * decision card when it asks which agent should get a task. Before the first start, one Start button.
276
298
  */
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 }) {
299
+ function OverseerPane({ theme, compact, o, focus = 0, pending = null, agentId, deps, navigation, onBack }: { theme: Theme; compact: boolean; o: OverseerRowState; focus?: number; pending?: string | null; agentId: string | null; deps: HomeDeps; navigation: PluginScreenProps["navigation"]; onBack?: () => void }) {
278
300
  const c = theme.colors; const t = text(c);
279
301
  const toast = useToast();
280
302
  const { inbox, extras } = deps.sources;
@@ -314,11 +336,13 @@ function OverseerPane({ theme, compact, o, agentId, deps, navigation, onBack }:
314
336
  {tail.steps === null ? <Spinner color={c.foregroundMuted} size={12} label="Loading the conversation" />
315
337
  : 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
338
  : 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" />}
339
+ {/* An ask just sent from the omnibox, until the conversation shows it. */}
340
+ {pending && tail.steps && !tail.steps.some(x => x.kind === "you" && x.text.trim() === pending) && <Step step={{ kind: "you", text: pending }} c={c} last={false} />}
341
+ {(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
342
  {/* Its open ask, after the conversation that led to it. Only something Tom can act on; never "No ask stated". */}
319
343
  {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
344
  </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}
345
+ {agentId && <ReplyBox theme={theme} compact={compact} agentName="the Overseer" placeholder="Ask or give a task: “assign reviewers on all ready PRs”" hint={null} focus={focus}
322
346
  onSend={async message => { await agent.handle!.send(message); inbox.refresh(); }} />}
323
347
  </View>;
324
348
  }
@@ -363,8 +387,20 @@ function PermissionBlock({ p, theme, compact, busy, primary, onRespond }: { p: P
363
387
  }
364
388
 
365
389
  /** 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 }) {
390
+ 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.", focus = 0 }: { theme: Theme; compact: boolean; agentName: string; onSend: (text: string) => Promise<void>; placeholder?: string; hint?: string | null; focus?: number }) {
367
391
  const c = theme.colors;
392
+ const inputRef = useRef<TextInput | null>(null);
393
+ // Focus when asked to (⌘K), never on a plain mount. The closing command palette hands focus back to where it was,
394
+ // after us, so keep claiming it for a moment until it sticks.
395
+ useEffect(() => {
396
+ if (!focus) return;
397
+ const timers = [0, 150, 400, 800, 1400].map(ms => setTimeout(() => {
398
+ const doc = (globalThis as { document?: { activeElement?: unknown } }).document;
399
+ const input = inputRef.current as unknown;
400
+ if (!doc || doc.activeElement !== input) inputRef.current?.focus();
401
+ }, ms));
402
+ return () => timers.forEach(clearTimeout);
403
+ }, [focus]);
368
404
  const toast = useToast();
369
405
  const [value, setValue] = useState("");
370
406
  const [sending, setSending] = useState(false);
@@ -377,7 +413,7 @@ function ReplyBox({ theme, compact, agentName, onSend, placeholder = "Answer in
377
413
  };
378
414
  return <View style={{ padding: compact ? 12 : 14, borderTopWidth: 1, borderTopColor: c.border, gap: 6 }}>
379
415
  <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
416
+ <TextInput ref={inputRef} accessibilityLabel={`Reply to ${agentName}`} value={value} onChangeText={setValue} placeholder={placeholder} placeholderTextColor={c.foregroundMuted} multiline
381
417
  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
418
  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 : {}) }} />
383
419
  <IconButton theme={theme} compact={compact} icon="ArrowUp" label="Send" disabled={!value.trim() || sending} spinning={sending} onPress={() => void send()} color={value.trim() ? c.foreground : undefined} />
package/index.client.tsx CHANGED
@@ -84,6 +84,15 @@ export default function contribute(host: PluginClientContext) {
84
84
  contributeInboxCommands(client, inbox, openNext),
85
85
  contributeBrief(client, briefDeps),
86
86
  ];
87
+ // ⌘K "Follow-up: Ask the Overseer": opens Home on the Overseer with its reply box focused (1.4.0-beta.0). Listed
88
+ // only while the Overseer is on, so it never leads to a dead end.
89
+ let removeAsk: (() => unknown) | null = null;
90
+ const syncAsk = () => {
91
+ const on = !!extras.overseer()?.enabled;
92
+ if (on && !removeAsk) removeAsk = client.addCommandCenterItem({ id: "follow-through-ask-overseer", title: "Follow-up: Ask the Overseer", icon: "MessagesSquare", keywords: ["overseer", "ask", "route", "tell", "delegate", "assign", "which agent"], context: "global", onSelect({ openScreen }) { openScreen({ screenId: OVERVIEW, params: { ask: String(Date.now()) } }); } });
93
+ else if (!on && removeAsk) { void removeAsk(); removeAsk = null; }
94
+ };
95
+ removers.push(extras.subscribe(syncAsk), () => removeAsk?.());
87
96
  // Phase 2: only on hosts with the sidebar-view API (Paseo main after 2026-11-07).
88
97
  const views = sidebarViewHost(host);
89
98
  if (views) removers.push(views.addSidebarView({ id: "needs-you", title: "Follow-up: Needs you", description: "Agents that need you until you sign them off, then your workspaces.", Component: inboxSidebarView(sources) }));
package/index.server.ts CHANGED
@@ -542,6 +542,7 @@ export default function contribute(server: PluginServerContext) {
542
542
  const overseerStatus = async () => { const s = await overseer!.state(); return { enabled: await overseerOn(), agentId: s.agentId, workspaceId: s.workspaceId, startedAt: s.startedAt, generation: s.generation, error: s.error }; };
543
543
  handle(rpc.overseerStatusRpc, async () => { await requireReady(); return overseerStatus(); });
544
544
  handle(rpc.overseerStartRpc, async (_input, { paseo }) => { await requireReady(); seen(paseo); await overseer!.start(paseo as unknown as OverseerPaseo); return overseerStatus(); });
545
+ handle(rpc.overseerAskRpc, async ({ text }, { paseo }) => { await requireReady(); seen(paseo); await overseer!.ask(paseo as unknown as OverseerPaseo, text); return overseerStatus(); });
545
546
  handle(rpc.overseerActRpc, async ({ agentId, tool, args }, { paseo }) => {
546
547
  await requireReady(); seen(paseo);
547
548
  if (!(OVERSEER_TOOLS as readonly string[]).includes(tool)) throw new Error(`Unknown Overseer tool ${tool}.`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "paseo-follow-up",
3
3
  "private": false,
4
- "version": "1.4.0-beta.2",
4
+ "version": "1.4.0-beta.3",
5
5
  "description": "Follow every workspace PR stack in Paseo, answer agent questions, batch repairs for the main agent, and see what needs you.",
6
6
  "type": "module",
7
7
  "files": [
@@ -118,6 +118,21 @@ export class Overseer {
118
118
  return this.starting;
119
119
  }
120
120
 
121
+ /**
122
+ * The developer's words from the omnibox: start the Overseer if this is the first use (asking is the click), bring
123
+ * it back if it was archived, then send the text unchanged. Sending may load the Overseer; that's the ask.
124
+ */
125
+ async ask(paseo: OverseerPaseo, text: string): Promise<OverseerState> {
126
+ const ask = text.trim();
127
+ if (!ask) throw new Error("Type what you want the Overseer to do.");
128
+ if (!await this.d.enabled()) throw new Error("The Overseer is off. Turn it on in Follow-up settings.");
129
+ let s = await this.state();
130
+ if (!s.agentId) s = await this.start(paseo);
131
+ else if (!await this.alive(paseo, s)) { await this.ensure(paseo); s = await this.state(); }
132
+ await paseo.agents.ref(s.agentId!).send(ask);
133
+ return s;
134
+ }
135
+
121
136
  private async alive(paseo: OverseerPaseo, s: OverseerState): Promise<boolean> {
122
137
  if (!s.agentId) return false;
123
138
  const agent = (await paseo.agents.ref(s.agentId).refresh().catch(() => null))?.agent;
@@ -140,4 +140,5 @@ export const agentActRpc = defineRpc({ name: "follow.agent-act", input: z.strict
140
140
  export const overseerStatusSchema = z.object({ enabled: z.boolean(), agentId: z.string().nullable(), workspaceId: z.string().nullable(), startedAt: z.string().nullable(), generation: z.number().int(), error: z.string().nullable() });
141
141
  export const overseerStatusRpc = defineRpc({ name: "follow.overseer-status", input: z.object({}), output: overseerStatusSchema });
142
142
  export const overseerStartRpc = defineRpc({ name: "follow.overseer-start", input: z.object({}), output: overseerStatusSchema });
143
+ export const overseerAskRpc = defineRpc({ name: "follow.overseer-ask", input: z.strictObject({ text: z.string().trim().min(1).max(2000) }), output: overseerStatusSchema });
143
144
  export const overseerActRpc = defineRpc({ name: "follow.overseer-act", input: z.strictObject({ agentId: idSchema, tool: z.string().max(60), args: z.record(z.string(), z.unknown()).default({}) }), output: z.unknown() });
package/shared/search.ts CHANGED
@@ -168,14 +168,34 @@ export function excerpt(text: string, ranges: Range[], max = 80): { text: string
168
168
  // ---------- the omnibox seam ----------
169
169
 
170
170
  /**
171
- * One row of the omnibox. Home's own provider returns workstreams; the next build adds the Overseer's
172
- * "Ask the Overseer: <query>" row as a second provider, listed after the workspace results.
171
+ * One row of the omnibox. Home's own provider returns workstreams; the Overseer's provider adds one
172
+ * "Ask the Overseer: <query>" row (1.4.0-beta.0), always listed last.
173
173
  */
174
- export type OmniboxItem = { provider: string; key: string; hit: SearchHit };
174
+ export type WorkspaceItem = { provider: string; key: string; hit: SearchHit; ask?: undefined };
175
+ export type AskItem = { provider: "overseer"; key: typeof ASK_KEY; ask: string; hit?: undefined };
176
+ export type OmniboxItem = WorkspaceItem | AskItem;
175
177
  export type OmniboxProvider = { id: string; results(query: string): OmniboxItem[] };
176
- /** Results of every provider, in provider order; each provider ranks its own. */
178
+ export const ASK_KEY = "ask:overseer";
179
+ /** The longest ask the omnibox sends; anything longer belongs in the Overseer's reply box. */
180
+ export const ASK_MAX = 2000;
181
+ /** Results of every provider, in provider order; each provider ranks its own. An ask row always goes last. */
177
182
  export function omniboxResults(providers: readonly OmniboxProvider[], query: string): OmniboxItem[] {
178
- return providers.flatMap(p => p.results(query));
183
+ const all = providers.flatMap(p => p.results(query));
184
+ return [...all.filter(i => !i.ask), ...all.filter(i => i.ask)];
185
+ }
186
+ /** The Overseer's row: the query as it was typed, trimmed. Nothing while the Overseer is off or the query is blank. */
187
+ export function overseerProvider(enabled: boolean): OmniboxProvider {
188
+ return { id: "overseer", results: query => {
189
+ const ask = query.trim().replace(/\s+/g, " ");
190
+ return enabled && ask && ask.length <= ASK_MAX ? [{ provider: "overseer", key: ASK_KEY, ask }] : [];
191
+ } };
192
+ }
193
+ /**
194
+ * The row Enter picks before any arrow key: the first one, except a lone one-word ask. That is usually a typo or
195
+ * a search that missed, and Enter must not send it to an agent; ↓ or a tap still picks it.
196
+ */
197
+ export function defaultActive(results: readonly OmniboxItem[] | null): number {
198
+ return results?.length === 1 && results[0].ask !== undefined && !/\s/.test(results[0].ask) ? -1 : 0;
179
199
  }
180
200
  export function workspaceProvider(index: SearchIndex, now = Date.now()): OmniboxProvider {
181
201
  return { id: "workspaces", results: query => search(index, query, now).map(hit => ({ provider: "workspaces", key: hit.key, hit })) };